/** * Method onRemoveEvent. * * @param o GameObject */ @Override public void onRemoveEvent(GameObject o) { if (o.isPlayer()) { o.getPlayer().removeListener(_playerExitListener); } }
/** * Method useAdminCommand. * * @param command String * @param wordList String[] * @param fullString String * @param activeChar Player * @return boolean * @see lineage2.gameserver.handlers.IAdminCommandHandler#useAdminCommand(String, String[], * String, Player) */ @Override public boolean useAdminCommand( String command, String[] wordList, String fullString, Player activeChar) { if (!activeChar.getPlayerAccess().CanKick) { return false; } switch (command) { case "admin_disconnect": case "admin_kick": final Player player; if (wordList.length == 1) { GameObject target = activeChar.getTarget(); if (target == null) { activeChar.sendMessage("Select character or specify player name."); break; } if (!target.isPlayer()) { activeChar.sendPacket(new SystemMessage(SystemMessage.INVALID_TARGET)); break; } player = (Player) target; } else { player = World.getPlayer(wordList[1]); if (player == null) { activeChar.sendMessage("Character " + wordList[1] + " not found in game."); break; } } if (player.getObjectId() == activeChar.getObjectId()) { activeChar.sendMessage("You can't logout your character."); break; } activeChar.sendMessage("Character " + player.getName() + " disconnected from server."); if (player.isInOfflineMode()) { player.setOfflineMode(false); player.kick(); return true; } player.sendMessage("You where kicked by a GM."); player.sendPacket( new SystemMessage( SystemMessage.YOU_HAVE_BEEN_DISCONNECTED_FROM_THE_SERVER_PLEASE_LOGIN_AGAIN)); ThreadPoolManager.getInstance() .schedule( new RunnableImpl() { @Override public void runImpl() { player.kick(); } }, 500); break; } return true; }
/** * Method onAddEvent. * * @param o GameObject */ @Override public void onAddEvent(GameObject o) { if (o.isPlayer()) { o.getPlayer().addListener(_playerExitListener); } }