Examples of GameVersionMessage


Examples of net.cis.common.model.system.message.GameVersionMessage

      doHandshake(client, m);
  }

  private void doHandshake(ClientState client, Message m) {
    if (m instanceof GameVersionMessage) {
      GameVersionMessage msg = (GameVersionMessage) m;
      if (!systemManager.validateGameVersion(msg.getGameVersion())) {
        client.setUpToDate(false);
        client.conn.send(new GameVersionMessage(systemManager.getGameVersion()));
      } else {
        client.setUpToDate(true);
        client.conn.send(new GameInformationMessage(systemManager.getActualGameInformation()));
      }
    } else if (m instanceof AuthorizeMessage) {
      if (!client.isUpToDate()) {
        clientMap.remove(client.conn.getId());
        client.conn.close("You MUST update your Client!");
      }

      if (client.isAuthorized())
        return;

      AuthorizeMessage msg = (AuthorizeMessage) m;

      UserAuthorizedToken token = securityManager.authorize(msg.getUsername(), msg.getPassword());
      if (token == null) {
        clientMap.remove(client.conn.getId());
        client.conn.close("Username/password not known or incorrect!");
      } else {
        client.setAuthenticationToken(token);
View Full Code Here

Examples of net.cis.common.model.system.message.GameVersionMessage

    this.client = client;
    this.callback = callback;
  }

  public void initHandshake() {
    client.send(new GameVersionMessage(GAME_VERSION));
  }
View Full Code Here

Examples of net.cis.common.model.system.message.GameVersionMessage

  }

  @Override
  public void messageReceived(Client source, Message m) {
    if (m instanceof GameVersionMessage) { // something is wrong with client version
      GameVersionMessage message = (GameVersionMessage) m;
      if (message.getGameVersion() != GAME_VERSION) {
        // TODO Handle wrong GameVersion, update
        String msg = "Wrong GameVersion! You must Update your client!";
        callback.statusMessage(msg);
        LogFactory.getLog(HandshakeController.class).info(msg);
      } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.