Package net.sf.l2j.loginserver.GameServerTable

Examples of net.sf.l2j.loginserver.GameServerTable.GameServerInfo


   */
  public ServerStatus(byte[] decrypt, int serverId)
  {
    super(decrypt);

    GameServerInfo gsi = GameServerTable.getInstance().getRegisteredGameServerById(serverId);
    if (gsi != null)
    {
      int size = readD();
      for (int i = 0; i < size; i++)
      {
        int type = readD();
        int value = readD();
        switch (type)
        {
        case SERVER_LIST_STATUS:
          gsi.setStatus(value);
          break;
        case SERVER_LIST_CLOCK:
          gsi.setShowingClock(value == ON);
          break;
        case SERVER_LIST_SQUARE_BRACKET:
          gsi.setShowingBrackets(value == ON);
          break;
        case TEST_SERVER:
          gsi.setTestServer(value == ON);
          break;
        case MAX_PLAYERS:
          gsi.setMaxPlayers(value);
          break;
        }
      }
    }
  }
View Full Code Here


          oldClient.close(LoginFailReason.REASON_ACCOUNT_IN_USE);
          lc.removeAuthedLoginClient(_user);
        }
        break;
      case ALREADY_ON_GS:
        GameServerInfo gsi;
        if ((gsi = lc.getAccountOnGameServer(_user)) != null)
        {
          client.close(LoginFailReason.REASON_ACCOUNT_IN_USE);

          // kick from there
          if (gsi.isAuthed())
          {
            gsi.getGameServerThread().kickPlayer(_user);
          }
        }
        break;
    }
  }
View Full Code Here

    return null;
  }

  public int getOnlinePlayerCount(int serverId)
  {
    GameServerInfo gsi = GameServerTable.getInstance().getRegisteredGameServerById(serverId);
    if (gsi != null && gsi.isAuthed())
    {
      return gsi.getCurrentPlayerCount();
    }
    return 0;
  }
View Full Code Here

    return total;
  }

  public int getMaxAllowedOnlinePlayers(int id)
  {
    GameServerInfo gsi = GameServerTable.getInstance().getRegisteredGameServerById(id);
    if (gsi != null)
    {
      return gsi.getMaxPlayers();
    }
    return 0;
  }
View Full Code Here

   * @param serverId
   * @return
   */
  public boolean isLoginPossible(L2LoginClient client, int serverId)
  {
    GameServerInfo gsi = GameServerTable.getInstance().getRegisteredGameServerById(serverId);
    int access = client.getAccessLevel();
    if (gsi != null && gsi.isAuthed())
    {
      boolean loginOk = (gsi.getCurrentPlayerCount() < gsi.getMaxPlayers() && gsi.getStatus() != ServerStatus.STATUS_GM_ONLY) || access >= Config.GM_MIN;

      if (loginOk && client.getLastServer() != serverId)
      {
        java.sql.Connection con = null;
        PreparedStatement statement = null;
View Full Code Here

    GameServerTable gameServerTable = GameServerTable.getInstance();

    int id = gameServerAuth.getDesiredID();
    byte[] hexId = gameServerAuth.getHexID();

    GameServerInfo gsi = gameServerTable.getRegisteredGameServerById(id);
    // is there a gameserver registered with this id?
    if (gsi != null)
    {
      // does the hex id match?
      if (Arrays.equals(gsi.getHexId(), hexId))
      {
        // check to see if this GS is already connected
        synchronized (gsi)
        {
          if (gsi.isAuthed())
          {
            forceClose(LoginServerFail.REASON_ALREADY_LOGGED8IN);
          }
          else
          {
            attachGameServerInfo(gsi, gameServerAuth);
          }
        }
      }
      else
      {
        // there is already a server registered with the desired id and different hex id
        // try to register this one with an alternative id
        if (Config.ACCEPT_NEW_GAMESERVER && gameServerAuth.acceptAlternateID())
        {
          gsi = new GameServerInfo(id, hexId, this);
          if (gameServerTable.registerWithFirstAvaliableId(gsi))
          {
            attachGameServerInfo(gsi, gameServerAuth);
            gameServerTable.registerServerOnDB(gsi);
          }
          else
          {
            forceClose(LoginServerFail.REASON_NO_FREE_ID);
          }
        }
        else
        {
          // server id is already taken, and we cant get a new one for you
          forceClose(LoginServerFail.REASON_WRONG_HEXID);
        }
      }
    }
    else
    {
      // can we register on this id?
      if (Config.ACCEPT_NEW_GAMESERVER)
      {
        gsi = new GameServerInfo(id, hexId, this);
        if (gameServerTable.register(id, gsi))
        {
          attachGameServerInfo(gsi, gameServerAuth);
          gameServerTable.registerServerOnDB(gsi);
        }
View Full Code Here

TOP

Related Classes of net.sf.l2j.loginserver.GameServerTable.GameServerInfo

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.