本文整理汇总了Java中net.sf.freecol.common.model.Game.LogoutReason.RECONNECT属性的典型用法代码示例。如果您正苦于以下问题:Java LogoutReason.RECONNECT属性的具体用法?Java LogoutReason.RECONNECT怎么用?Java LogoutReason.RECONNECT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.sf.freecol.common.model.Game.LogoutReason
的用法示例。
在下文中一共展示了LogoutReason.RECONNECT属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: requestLogout
/**
* Request that this client log out from the server.
*
* @param reason The reason to logout from the server.
* @return True if the player is already logged out,
* or a logout request was sent.
*/
public boolean requestLogout(LogoutReason reason) {
final FreeColClient fcc = getFreeColClient();
final Player player = fcc.getMyPlayer();
if (!fcc.isLoggedIn()) return true;
// Save our active unit on reconnect.
if (reason == LogoutReason.RECONNECT) {
Unit active = getGUI().getActiveUnit();
if (active != null && player.owns(active)) {
FreeColServer fcs = fcc.getFreeColServer();
if (fcs != null) {
fcs.getGame().setInitialActiveUnitId(active.getId());
}
}
}
logger.info("Logout begin for client " + player.getName()
+ ": " + reason.toString());
return askServer().logout(player, reason);
}