本文整理汇总了Java中net.sf.freecol.server.model.MonarchSession类的典型用法代码示例。如果您正苦于以下问题:Java MonarchSession类的具体用法?Java MonarchSession怎么用?Java MonarchSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MonarchSession类属于net.sf.freecol.server.model包,在下文中一共展示了MonarchSession类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: monarchAction
import net.sf.freecol.server.model.MonarchSession; //导入依赖的package包/类
/**
* Respond to a monarch action.
*
* @param serverPlayer The {@code ServerPlayer} that is to respond.
* @param action The {@code MonarchAction} to respond to.
* @param result The player response.
* @return A {@code ChangeSet} containing the response.
*/
public ChangeSet monarchAction(ServerPlayer serverPlayer,
MonarchAction action, boolean result) {
MonarchSession session = Session.lookup(MonarchSession.class,
serverPlayer.getId(), "");
if (session == null) {
return serverPlayer.clientError("Bogus monarch action: " + action);
} else if (action != session.getAction()) {
return serverPlayer.clientError("Session action mismatch, "
+ session.getAction() + " expected: " + action);
}
ChangeSet cs = new ChangeSet();
session.complete(result, cs);
return cs;
}