Package marauroa.common.net.message

Examples of marauroa.common.net.message.MessageS2CLoginMessageNACK


          logger.debug("Login failed. Reason: " + msgNACK.getResolution());
          throw new LoginFailedException(msgNACK.getResolution(), msgNACK.getResolutionCode());

        /* Login failed, explain reason on event */
        case S2C_LOGIN_MESSAGE_NACK:
          MessageS2CLoginMessageNACK msgMessageNACK = (MessageS2CLoginMessageNACK) msg;
          logger.debug("Login failed. Reason: " + msgMessageNACK.getReason());
          throw new LoginFailedException(msgMessageNACK.getReason());

        /* If message doesn't match, store it, someone will need it. */
        default:
          messages.add(msg);
      }
 
View Full Code Here


       */
      if (command.getFailMessage() != null) {
        logger.info("Banned/Inactive account for player " + info.username + ": " + command.getFailMessage());

        /* Send player the Login NACK message */
        MessageS2CLoginMessageNACK msgLoginMessageNACK = new MessageS2CLoginMessageNACK(command.getChannel(), command.getFailMessage());
        msgLoginMessageNACK.setProtocolVersion(command.getProtocolVersion());
        netMan.sendMessage(msgLoginMessageNACK);

        /*
         * Disconnect player of server.
         */
        netMan.disconnectClient(command.getChannel());

        return;
      }

      /* Now we count the number of connections from this ip-address */
      int count = info.countConnectionsFromSameIPAddress(playerContainer);
      Configuration conf = Configuration.getConfiguration();
      int limit = conf.getInt("parallel_connection_limit", TimeoutConf.PARALLEL_CONNECTION_LIMIT);
      if (count > limit) {
        String whiteList = "," + conf.get("ip_whitelist", "127.0.0.1") + ",";
        if (whiteList.indexOf("," + info.address + ",") < 0) {
          logger.info("to many parallel connections from " + info.address + " rejecting login of " + info.username);

          /* Send player the Login NACK message */
          MessageS2CLoginMessageNACK msgLoginMessageNACK = new MessageS2CLoginMessageNACK(command.getChannel(),
            "There are too many connections from your ip-address.\nPlease contact /support, if you are at a conference or something similar.");
          msgLoginMessageNACK.setProtocolVersion(command.getProtocolVersion());
          netMan.sendMessage(msgLoginMessageNACK);

          // Disconnect player of server.
          netMan.disconnectClient(command.getChannel());
          return;
View Full Code Here

TOP

Related Classes of marauroa.common.net.message.MessageS2CLoginMessageNACK

Copyright © 2018 www.massapicom. 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.