Addition of Disconnection class.
Adapted from: L2jUnity free files.
This commit is contained in:
		| @@ -26,6 +26,7 @@ import com.l2jmobius.gameserver.handler.IAdminCommandHandler; | ||||
| import com.l2jmobius.gameserver.model.L2AccessLevel; | ||||
| import com.l2jmobius.gameserver.model.L2World; | ||||
| import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; | ||||
| import com.l2jmobius.gameserver.network.Disconnection; | ||||
| import com.l2jmobius.gameserver.network.SystemMessageId; | ||||
|  | ||||
| /** | ||||
| @@ -129,7 +130,7 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler | ||||
| 		{ | ||||
| 			player.setAccessLevel(lvl, false, true); | ||||
| 			player.sendMessage("Your character has been banned. Bye."); | ||||
| 			player.logout(); | ||||
| 			Disconnection.of(player).defaultSequence(false); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -19,6 +19,7 @@ package handlers.admincommandhandlers; | ||||
| import com.l2jmobius.gameserver.handler.IAdminCommandHandler; | ||||
| import com.l2jmobius.gameserver.model.L2Object; | ||||
| import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; | ||||
| import com.l2jmobius.gameserver.network.Disconnection; | ||||
|  | ||||
| /** | ||||
|  * This class handles following admin commands: - character_disconnect = disconnects target player | ||||
| @@ -68,7 +69,7 @@ public class AdminDisconnect implements IAdminCommandHandler | ||||
| 		{ | ||||
| 			activeChar.sendMessage("Character " + player.getName() + " disconnected from server."); | ||||
| 			 | ||||
| 			player.logout(); | ||||
| 			Disconnection.of(player).defaultSequence(false); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -18,10 +18,10 @@ package handlers.admincommandhandlers; | ||||
|  | ||||
| import java.util.StringTokenizer; | ||||
|  | ||||
| import com.l2jmobius.gameserver.data.sql.impl.OfflineTradersTable; | ||||
| import com.l2jmobius.gameserver.handler.IAdminCommandHandler; | ||||
| import com.l2jmobius.gameserver.model.L2World; | ||||
| import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; | ||||
| import com.l2jmobius.gameserver.network.Disconnection; | ||||
|  | ||||
| public class AdminKick implements IAdminCommandHandler | ||||
| { | ||||
| @@ -44,11 +44,7 @@ public class AdminKick implements IAdminCommandHandler | ||||
| 				final L2PcInstance plyr = L2World.getInstance().getPlayer(player); | ||||
| 				if (plyr != null) | ||||
| 				{ | ||||
| 					if (plyr.getOfflineStartTime() > 0) | ||||
| 					{ | ||||
| 						OfflineTradersTable.removeTrader(plyr.getObjectId()); | ||||
| 					} | ||||
| 					plyr.logout(); | ||||
| 					Disconnection.of(plyr).defaultSequence(false); | ||||
| 					activeChar.sendMessage("You kicked " + plyr.getName() + " from the game."); | ||||
| 				} | ||||
| 			} | ||||
| @@ -61,7 +57,7 @@ public class AdminKick implements IAdminCommandHandler | ||||
| 				if (!player.isGM()) | ||||
| 				{ | ||||
| 					counter++; | ||||
| 					player.logout(); | ||||
| 					Disconnection.of(player).defaultSequence(false); | ||||
| 				} | ||||
| 			} | ||||
| 			activeChar.sendMessage("Kicked " + counter + " players."); | ||||
|   | ||||
| @@ -21,7 +21,6 @@ import java.util.logging.Level; | ||||
| import java.util.logging.Logger; | ||||
|  | ||||
| import com.l2jmobius.Config; | ||||
| import com.l2jmobius.gameserver.data.sql.impl.OfflineTradersTable; | ||||
| import com.l2jmobius.gameserver.data.xml.impl.AdminData; | ||||
| import com.l2jmobius.gameserver.handler.AdminCommandHandler; | ||||
| import com.l2jmobius.gameserver.handler.IAdminCommandHandler; | ||||
| @@ -31,6 +30,7 @@ import com.l2jmobius.gameserver.model.L2World; | ||||
| import com.l2jmobius.gameserver.model.Location; | ||||
| import com.l2jmobius.gameserver.model.actor.L2Character; | ||||
| import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; | ||||
| import com.l2jmobius.gameserver.network.Disconnection; | ||||
| import com.l2jmobius.gameserver.network.SystemMessageId; | ||||
|  | ||||
| /** | ||||
| @@ -170,11 +170,7 @@ public class AdminMenu implements IAdminCommandHandler | ||||
| 				String text; | ||||
| 				if (plyr != null) | ||||
| 				{ | ||||
| 					if (plyr.getOfflineStartTime() > 0) | ||||
| 					{ | ||||
| 						OfflineTradersTable.removeTrader(plyr.getObjectId()); | ||||
| 					} | ||||
| 					plyr.logout(); | ||||
| 					Disconnection.of(plyr).defaultSequence(false); | ||||
| 					text = "You kicked " + plyr.getName() + " from the game."; | ||||
| 				} | ||||
| 				else | ||||
|   | ||||
| @@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.model.L2World; | ||||
| import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; | ||||
| import com.l2jmobius.gameserver.model.punishment.PunishmentTask; | ||||
| import com.l2jmobius.gameserver.model.punishment.PunishmentType; | ||||
| import com.l2jmobius.gameserver.network.Disconnection; | ||||
| import com.l2jmobius.gameserver.network.L2GameClient; | ||||
|  | ||||
| /** | ||||
| @@ -58,7 +59,7 @@ public class BanHandler implements IPunishmentHandler | ||||
| 					} | ||||
| 					else | ||||
| 					{ | ||||
| 						client.closeNow(); | ||||
| 						Disconnection.of(client).defaultSequence(false); | ||||
| 					} | ||||
| 				} | ||||
| 				break; | ||||
| @@ -90,7 +91,7 @@ public class BanHandler implements IPunishmentHandler | ||||
| 	 */ | ||||
| 	private static void applyToPlayer(L2PcInstance player) | ||||
| 	{ | ||||
| 		player.logout(); | ||||
| 		Disconnection.of(player).defaultSequence(false); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
|   | ||||
| @@ -18,6 +18,7 @@ package handlers.telnethandlers.player; | ||||
|  | ||||
| import com.l2jmobius.gameserver.model.L2World; | ||||
| import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; | ||||
| import com.l2jmobius.gameserver.network.Disconnection; | ||||
| import com.l2jmobius.gameserver.network.telnet.ITelnetCommand; | ||||
|  | ||||
| import io.netty.channel.ChannelHandlerContext; | ||||
| @@ -49,7 +50,7 @@ public class Kick implements ITelnetCommand | ||||
| 		final L2PcInstance player = L2World.getInstance().getPlayer(args[0]); | ||||
| 		if (player != null) | ||||
| 		{ | ||||
| 			player.logout(); | ||||
| 			Disconnection.of(player).defaultSequence(false); | ||||
| 			return "Player has been successfully kicked."; | ||||
| 		} | ||||
| 		return "Couldn't find player with such name."; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDev
					MobiusDev