Package l2p.gameserver.clientpackets

Source Code of l2p.gameserver.clientpackets.CharacterSelected

package l2p.gameserver.clientpackets;

import l2p.Config;
import l2p.gameserver.model.L2Player;
import l2p.gameserver.network.L2GameClient;
import l2p.gameserver.network.L2GameClient.GameClientState;
import l2p.gameserver.serverpackets.CharSelected;
import l2p.util.AutoBan;

public class CharacterSelected extends L2GameClientPacket
{
  private int _charSlot;

  @Override
  public void readImpl()
  {
    _charSlot = readD();
  }

  @Override
  public void runImpl()
  {
    L2GameClient client = getClient();
    if(client.getActiveChar() != null)
    {
      return;
    }
    L2Player activeChar = client.loadCharFromDisk(_charSlot);
    if(activeChar == null)
    {
      return;
    }
    if(AutoBan.isBanned(activeChar.getObjectId()))
    {
      activeChar.setAccessLevel(-100);
      activeChar.logout(false, false, true, true);
      return;
    }
    if(activeChar.getAccessLevel() < 0)
    {
      activeChar.setAccessLevel(0);
    }
    if(Config.SERVER_GMONLY && !activeChar.isGM())
    {
      return;
    }
    client.setState(GameClientState.IN_GAME);
    sendPacket(new CharSelected(activeChar, client.getSessionId().playOkID1));
  }
}
TOP

Related Classes of l2p.gameserver.clientpackets.CharacterSelected

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.