From 6bba018e17b33e4a24db04ca929731ff22668acb Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 1 May 2021 21:05:58 +0000 Subject: [PATCH] Removal of unused login server support. --- .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 10 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ .../org/l2jmobius/gameserver/GameServer.java | 12 +-- .../network/loginserver/IncomingPackets.java | 81 ------------------- .../loginserver/LoginServerHandler.java | 34 -------- .../loginserver/LoginServerInitializer.java | 48 ----------- .../LoginServerNetworkManager.java | 80 ------------------ 115 files changed, 24 insertions(+), 5797 deletions(-) delete mode 100644 L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java delete mode 100644 L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java delete mode 100644 L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java delete mode 100644 L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java delete mode 100644 L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/GameServer.java index 4df08e3d52..089ac383d5 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/GameServer.java @@ -150,7 +150,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -458,14 +457,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/GameServer.java index 6e6044e866..25b3b668da 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/GameServer.java @@ -154,7 +154,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -466,14 +465,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/GameServer.java index 6e6044e866..25b3b668da 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/GameServer.java @@ -154,7 +154,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -466,14 +465,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/GameServer.java index 9e4183a551..cfdac0ed6f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/GameServer.java @@ -154,7 +154,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -466,14 +465,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/GameServer.java index cac91bf103..9f9cd23296 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/GameServer.java @@ -156,7 +156,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -470,14 +469,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/GameServer.java index cac91bf103..9f9cd23296 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/GameServer.java @@ -156,7 +156,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -470,14 +469,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/GameServer.java index 681efa0e52..206cf86d3c 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/GameServer.java @@ -157,7 +157,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -472,14 +471,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/GameServer.java index f5df9cdd92..3156ab5e86 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/GameServer.java @@ -160,7 +160,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -478,14 +477,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/GameServer.java index 8bce59d124..2a5edbe856 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/GameServer.java @@ -159,7 +159,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -476,14 +475,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/GameServer.java index 8bce59d124..2a5edbe856 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/GameServer.java @@ -159,7 +159,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -476,14 +475,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/GameServer.java index 44a47f0582..8805487aae 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/GameServer.java @@ -117,7 +117,6 @@ import org.l2jmobius.gameserver.model.siege.clanhalls.DevastatedCastle; import org.l2jmobius.gameserver.model.siege.clanhalls.FortressOfResistance; import org.l2jmobius.gameserver.model.spawn.AutoSpawnHandler; import org.l2jmobius.gameserver.network.ClientNetworkManager; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.script.EventDroplist; import org.l2jmobius.gameserver.script.faenor.FaenorScriptEngine; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; @@ -489,14 +488,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java index f4d7addbc2..6d3206dbe6 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java @@ -121,7 +121,6 @@ import org.l2jmobius.gameserver.model.siege.clanhalls.DevastatedCastle; import org.l2jmobius.gameserver.model.siege.clanhalls.FortressOfResistance; import org.l2jmobius.gameserver.model.spawn.AutoSpawnHandler; import org.l2jmobius.gameserver.network.ClientNetworkManager; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.script.EventDroplist; import org.l2jmobius.gameserver.script.faenor.FaenorScriptEngine; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; @@ -501,14 +500,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/GameServer.java index 9700fc2a49..e631419f73 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/GameServer.java @@ -150,7 +150,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -470,14 +469,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/GameServer.java index 9b52766448..726e403b02 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/GameServer.java @@ -151,7 +151,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -472,14 +471,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/GameServer.java index 25d7983aae..ce3a3abb45 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/GameServer.java @@ -153,7 +153,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -467,14 +466,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/GameServer.java index 25d7983aae..ce3a3abb45 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/GameServer.java @@ -153,7 +153,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -467,14 +466,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/GameServer.java index 3d39a231ef..dcdf5c3ad8 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/GameServer.java @@ -154,7 +154,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -469,14 +468,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/GameServer.java index b20cf540c6..21e00af824 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/GameServer.java @@ -155,7 +155,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -471,14 +470,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/GameServer.java index ac3816bbe1..3bd95e8f1a 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/GameServer.java @@ -156,7 +156,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -473,14 +472,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/GameServer.java index 54fb7b5630..616bdf5f4e 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/GameServer.java @@ -159,7 +159,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -479,14 +478,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/GameServer.java index 6798b41eae..8965a94443 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/GameServer.java @@ -151,7 +151,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -463,14 +462,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java index f2c5e1d59a..ecc47e8d17 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/GameServer.java @@ -163,7 +163,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -487,14 +486,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -} diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/GameServer.java index 931130e54c..ba556ce9f1 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/GameServer.java @@ -81,8 +81,8 @@ import org.l2jmobius.gameserver.data.xml.InitialShortcutData; import org.l2jmobius.gameserver.data.xml.ItemCrystallizationData; import org.l2jmobius.gameserver.data.xml.KarmaData; import org.l2jmobius.gameserver.data.xml.LimitShopClanData; -import org.l2jmobius.gameserver.data.xml.LimitShopData; import org.l2jmobius.gameserver.data.xml.LimitShopCraftData; +import org.l2jmobius.gameserver.data.xml.LimitShopData; import org.l2jmobius.gameserver.data.xml.LuckyGameData; import org.l2jmobius.gameserver.data.xml.MagicLampData; import org.l2jmobius.gameserver.data.xml.MultisellData; @@ -164,7 +164,6 @@ import org.l2jmobius.gameserver.model.votereward.VoteSystem; import org.l2jmobius.gameserver.network.ClientNetworkManager; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.SystemMessageId; -import org.l2jmobius.gameserver.network.loginserver.LoginServerNetworkManager; import org.l2jmobius.gameserver.network.telnet.TelnetServer; import org.l2jmobius.gameserver.scripting.ScriptEngineManager; import org.l2jmobius.gameserver.taskmanager.TaskManager; @@ -489,14 +488,7 @@ public class GameServer ClientNetworkManager.getInstance().start(); - if (Boolean.getBoolean("newLoginServer")) - { - LoginServerNetworkManager.getInstance().connect(); - } - else - { - LoginServerThread.getInstance().start(); - } + LoginServerThread.getInstance().start(); Toolkit.getDefaultToolkit().beep(); } diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java deleted file mode 100644 index fce8fd7deb..0000000000 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/IncomingPackets.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.function.Supplier; - -import org.l2jmobius.commons.network.IConnectionState; -import org.l2jmobius.commons.network.IIncomingPacket; -import org.l2jmobius.commons.network.IIncomingPackets; - -/** - * @author NosBit - */ -enum IncomingPackets implements IIncomingPackets -{ - NONE(0, null); - - public static final IncomingPackets[] PACKET_ARRAY; - - static - { - final short maxPacketId = (short) Arrays.stream(values()).mapToInt(IIncomingPackets::getPacketId).max().orElse(0); - PACKET_ARRAY = new IncomingPackets[maxPacketId + 1]; - for (IncomingPackets incomingPacket : values()) - { - PACKET_ARRAY[incomingPacket.getPacketId()] = incomingPacket; - } - } - - private short _packetId; - private Supplier> _incomingPacketFactory; - private Set _connectionStates; - - IncomingPackets(int packetId, Supplier> incomingPacketFactory, IConnectionState... connectionStates) - { - // packetId is an unsigned byte - if (packetId > 0xFF) - { - throw new IllegalArgumentException("packetId must not be bigger than 0xFF"); - } - - _packetId = (short) packetId; - _incomingPacketFactory = incomingPacketFactory != null ? incomingPacketFactory : () -> null; - _connectionStates = new HashSet<>(Arrays.asList(connectionStates)); - } - - @Override - public int getPacketId() - { - return _packetId; - } - - @Override - public IIncomingPacket newIncomingPacket() - { - return _incomingPacketFactory.get(); - } - - @Override - public Set getConnectionStates() - { - return _connectionStates; - } -} diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java deleted file mode 100644 index 5eb5d384a9..0000000000 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import org.l2jmobius.commons.network.ChannelInboundHandler; -import org.l2jmobius.commons.network.IIncomingPacket; - -import io.netty.channel.ChannelHandlerContext; - -/** - * @author NosBit - */ -public class LoginServerHandler extends ChannelInboundHandler -{ - @Override - protected void channelRead0(ChannelHandlerContext ctx, IIncomingPacket msg) throws Exception - { - msg.run(this); - } -} diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java deleted file mode 100644 index 42f5df97f2..0000000000 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerInitializer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.nio.ByteOrder; - -import org.l2jmobius.commons.network.codecs.LengthFieldBasedFrameEncoder; -import org.l2jmobius.commons.network.codecs.PacketDecoder; -import org.l2jmobius.commons.network.codecs.PacketEncoder; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -/** - * @author NosBit - */ -public class LoginServerInitializer extends ChannelInitializer -{ - private static final LengthFieldBasedFrameEncoder LENGTH_ENCODER = new LengthFieldBasedFrameEncoder(); - private static final PacketEncoder PACKET_ENCODER = new PacketEncoder(0x8000 - 2); - - @Override - protected void initChannel(SocketChannel ch) - { - final LoginServerHandler loginServerHandler = new LoginServerHandler(); - ch.pipeline().addLast("length-decoder", new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, 0x8000 - 2, 0, 2, -2, 2, false)); - ch.pipeline().addLast("length-encoder", LENGTH_ENCODER); - // ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)); - ch.pipeline().addLast("packet-decoder", new PacketDecoder<>(IncomingPackets.PACKET_ARRAY, loginServerHandler)); - ch.pipeline().addLast("packet-encoder", PACKET_ENCODER); - ch.pipeline().addLast(loginServerHandler); - } -} diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java deleted file mode 100644 index d6dd35de81..0000000000 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/loginserver/LoginServerNetworkManager.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.network.loginserver; - -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.gameserver.network.EventLoopGroupManager; - -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.socket.nio.NioSocketChannel; - -/** - * @author NosBit - */ -public class LoginServerNetworkManager -{ - private static final Logger LOGGER = Logger.getLogger(LoginServerNetworkManager.class.getName()); - - private final Bootstrap _bootstrap; - - private ChannelFuture _channelFuture; - - public LoginServerNetworkManager() - { - //@formatter:off - _bootstrap = new Bootstrap() - .group(EventLoopGroupManager.getInstance().getWorkerGroup()) - .channel(NioSocketChannel.class) - .option(ChannelOption.SO_KEEPALIVE, true) - .handler(new LoginServerInitializer()); - //@formatter:on - } - - public ChannelFuture getChannelFuture() - { - return _channelFuture; - } - - public void connect() throws InterruptedException - { - if ((_channelFuture != null) && _channelFuture.isSuccess()) - { - return; - } - _channelFuture = _bootstrap.connect(Config.GAME_SERVER_LOGIN_HOST, Config.GAME_SERVER_LOGIN_PORT).sync(); - LOGGER.info("Connected to " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT); - } - - public void disconnect() throws InterruptedException - { - _channelFuture.channel().close().sync(); - } - - public static LoginServerNetworkManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final LoginServerNetworkManager INSTANCE = new LoginServerNetworkManager(); - } -}