当前位置: 首页>>代码示例>>Java>>正文


Java DisconnectMessage类代码示例

本文整理汇总了Java中net.sf.freecol.common.networking.DisconnectMessage的典型用法代码示例。如果您正苦于以下问题:Java DisconnectMessage类的具体用法?Java DisconnectMessage怎么用?Java DisconnectMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DisconnectMessage类属于net.sf.freecol.common.networking包,在下文中一共展示了DisconnectMessage类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import net.sf.freecol.common.networking.DisconnectMessage; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public Message handle(Connection connection, Message message)
    throws FreeColException {
    final FreeColServer freeColServer = getFreeColServer();
    ChangeSet cs = null;
    switch (message.getType()) {
    case DisconnectMessage.TAG:
        break;
    case LoginMessage.TAG:
        cs = ((LoginMessage)message).loginHandler(freeColServer, connection);
        break;
    default:
        cs = ChangeSet.clientError((ServerPlayer)null,
            StringTemplate.template("server.couldNotLogin"));
        break;
    }
    ServerPlayer serverPlayer = freeColServer.getPlayer(connection);
    return (cs == null) ? null : cs.build(serverPlayer);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:22,代码来源:UserConnectionHandler.java

示例2: handle

import net.sf.freecol.common.networking.DisconnectMessage; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public Message handle(Connection connection, Message message)
    throws FreeColException {
    if (message == null) return null;
    final String tag = message.getType();
    switch (tag) {
    case DisconnectMessage.TAG:
        break;
    case ServerListMessage.TAG:
        ServerListMessage slm = (ServerListMessage)message;
        this.consumer.accept(slm.getServers());
        break;
    default:
        logger.warning("MetaInputHandler does not handle: " + tag);
        break;
    }
    return null;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:21,代码来源:MetaServerUtils.java

示例3: handle

import net.sf.freecol.common.networking.DisconnectMessage; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Message handle(Connection connection, Message message)
    throws FreeColException {
    if (message == null) return null;
    Message reply = null;
    final String tag = message.getType();
    switch (tag) {
    case DisconnectMessage.TAG:
        disconnect(connection);
        break;
    case RegisterServerMessage.TAG:
        RegisterServerMessage rsm = (RegisterServerMessage)message;
        rsm.setAddress(connection.getHostAddress()); // Trust the connection
        register(rsm);
        break;
    case RemoveServerMessage.TAG:
        remove((RemoveServerMessage)message);
        break;
    case ServerListMessage.TAG:
        reply = serverList();
        break;
    case UpdateServerMessage.TAG:
        UpdateServerMessage usm = (UpdateServerMessage)message;
        usm.setAddress(connection.getHostAddress()); // Trust the connection
        update(usm);
        break;
    default:
        logger.warning("Unknown request: " + tag);
        break;
    }
    return reply;
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:36,代码来源:MetaServerHandler.java


注:本文中的net.sf.freecol.common.networking.DisconnectMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。