From b3c5f24b259e6c6bdc1cafef071ed3e641dd7f8b Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 1 May 2018 16:46:21 +0000 Subject: [PATCH] Unified shutdown functions for Telnet. --- .../telnethandlers/server/ServerAbort.java | 2 +- .../telnethandlers/server/ServerRestart.java | 2 +- .../telnethandlers/server/ServerShutdown.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 61 +----- .../telnethandlers/server/ServerAbort.java | 2 +- .../telnethandlers/server/ServerRestart.java | 2 +- .../telnethandlers/server/ServerShutdown.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 61 +----- .../telnethandlers/server/ServerAbort.java | 2 +- .../telnethandlers/server/ServerRestart.java | 2 +- .../telnethandlers/server/ServerShutdown.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 61 +----- .../telnethandlers/server/ServerAbort.java | 2 +- .../telnethandlers/server/ServerRestart.java | 2 +- .../telnethandlers/server/ServerShutdown.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 61 +----- .../com/l2jmobius/gameserver/Shutdown.java | 185 ++---------------- .../taskmanager/tasks/TaskRestart.java | 4 +- .../taskmanager/tasks/TaskShutdown.java | 4 +- .../l2jmobius/status/GameStatusThread.java | 6 +- .../telnethandlers/server/ServerAbort.java | 2 +- .../telnethandlers/server/ServerRestart.java | 2 +- .../telnethandlers/server/ServerShutdown.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 61 +----- .../telnethandlers/server/ServerAbort.java | 2 +- .../telnethandlers/server/ServerRestart.java | 2 +- .../telnethandlers/server/ServerShutdown.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 61 +----- .../telnethandlers/server/ServerAbort.java | 2 +- .../telnethandlers/server/ServerRestart.java | 2 +- .../telnethandlers/server/ServerShutdown.java | 2 +- .../com/l2jmobius/gameserver/GameServer.java | 2 +- .../com/l2jmobius/gameserver/Shutdown.java | 61 +----- 39 files changed, 53 insertions(+), 629 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java index 752c375c4c..768cfd61ce 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java @@ -41,7 +41,7 @@ public class ServerAbort implements ITelnetCommand @Override public String handle(ChannelHandlerContext ctx, String[] args) { - Shutdown.getInstance().telnetAbort(ctx.channel().remoteAddress().toString()); + Shutdown.getInstance().abort(null); return "Server shutdown/restart aborted!"; } } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java index 788e7709a5..6a317bd900 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java @@ -47,7 +47,7 @@ public class ServerRestart implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, true); + Shutdown.getInstance().startShutdown(null, time, true); return "Server will restart in " + time + " seconds!"; } } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java index fc7632572e..9c1fd417bd 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java @@ -47,7 +47,7 @@ public class ServerShutdown implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, false); + Shutdown.getInstance().startShutdown(null, time, false); return "Server will shutdown in " + time + " seconds!"; } } diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java index 1cf4fa4602..9545157efd 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java @@ -400,7 +400,7 @@ public class GameServer if (Config.RESTART_ON_DEADLOCK) { Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now."); - Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true); + Shutdown.getInstance().startShutdown(null, 60, true); } }); _deadDetectThread.setDaemon(true); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java index 0c900c0861..dbaf36b403 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java @@ -83,65 +83,6 @@ public class Shutdown extends Thread Broadcast.toAllOnlinePlayers(sysm); } - public void startTelnetShutdown(String IP, int seconds, boolean restart) - { - LOGGER.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - - _shutdownMode = restart ? GM_RESTART : GM_SHUTDOWN; - - if (_shutdownMode > 0) - { - switch (seconds) - { - case 540: - case 480: - case 420: - case 360: - case 300: - case 240: - case 180: - case 120: - case 60: - case 30: - case 10: - case 5: - case 4: - case 3: - case 2: - case 1: - { - break; - } - default: - { - SendServerQuit(seconds); - } - } - } - - if (_counterInstance != null) - { - _counterInstance._abort(); - } - _counterInstance = new Shutdown(seconds, restart); - _counterInstance.start(); - } - - /** - * This function aborts a running countdown - * @param IP IP Which Issued shutdown command - */ - public void telnetAbort(String IP) - { - LOGGER.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); - - if (_counterInstance != null) - { - _counterInstance._abort(); - Broadcast.toAllOnlinePlayers("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!", false); - } - } - /** * Default constructor is only used internal to create the shutdown-hook instance */ @@ -382,7 +323,7 @@ public class Shutdown extends Thread */ public void abort(L2PcInstance activeChar) { - LOGGER.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); + LOGGER.warning("GM: " + (activeChar != null ? activeChar.getName() + "(" + activeChar.getObjectId() + ") " : "") + "issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); if (_counterInstance != null) { _counterInstance._abort(); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java index 752c375c4c..768cfd61ce 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java @@ -41,7 +41,7 @@ public class ServerAbort implements ITelnetCommand @Override public String handle(ChannelHandlerContext ctx, String[] args) { - Shutdown.getInstance().telnetAbort(ctx.channel().remoteAddress().toString()); + Shutdown.getInstance().abort(null); return "Server shutdown/restart aborted!"; } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java index 788e7709a5..6a317bd900 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java @@ -47,7 +47,7 @@ public class ServerRestart implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, true); + Shutdown.getInstance().startShutdown(null, time, true); return "Server will restart in " + time + " seconds!"; } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java index fc7632572e..9c1fd417bd 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java @@ -47,7 +47,7 @@ public class ServerShutdown implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, false); + Shutdown.getInstance().startShutdown(null, time, false); return "Server will shutdown in " + time + " seconds!"; } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java index 9a7f440209..7df21deee2 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java @@ -408,7 +408,7 @@ public class GameServer if (Config.RESTART_ON_DEADLOCK) { Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now."); - Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true); + Shutdown.getInstance().startShutdown(null, 60, true); } }); _deadDetectThread.setDaemon(true); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java index 0c900c0861..dbaf36b403 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java @@ -83,65 +83,6 @@ public class Shutdown extends Thread Broadcast.toAllOnlinePlayers(sysm); } - public void startTelnetShutdown(String IP, int seconds, boolean restart) - { - LOGGER.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - - _shutdownMode = restart ? GM_RESTART : GM_SHUTDOWN; - - if (_shutdownMode > 0) - { - switch (seconds) - { - case 540: - case 480: - case 420: - case 360: - case 300: - case 240: - case 180: - case 120: - case 60: - case 30: - case 10: - case 5: - case 4: - case 3: - case 2: - case 1: - { - break; - } - default: - { - SendServerQuit(seconds); - } - } - } - - if (_counterInstance != null) - { - _counterInstance._abort(); - } - _counterInstance = new Shutdown(seconds, restart); - _counterInstance.start(); - } - - /** - * This function aborts a running countdown - * @param IP IP Which Issued shutdown command - */ - public void telnetAbort(String IP) - { - LOGGER.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); - - if (_counterInstance != null) - { - _counterInstance._abort(); - Broadcast.toAllOnlinePlayers("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!", false); - } - } - /** * Default constructor is only used internal to create the shutdown-hook instance */ @@ -382,7 +323,7 @@ public class Shutdown extends Thread */ public void abort(L2PcInstance activeChar) { - LOGGER.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); + LOGGER.warning("GM: " + (activeChar != null ? activeChar.getName() + "(" + activeChar.getObjectId() + ") " : "") + "issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); if (_counterInstance != null) { _counterInstance._abort(); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java index 752c375c4c..768cfd61ce 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java @@ -41,7 +41,7 @@ public class ServerAbort implements ITelnetCommand @Override public String handle(ChannelHandlerContext ctx, String[] args) { - Shutdown.getInstance().telnetAbort(ctx.channel().remoteAddress().toString()); + Shutdown.getInstance().abort(null); return "Server shutdown/restart aborted!"; } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java index 788e7709a5..6a317bd900 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java @@ -47,7 +47,7 @@ public class ServerRestart implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, true); + Shutdown.getInstance().startShutdown(null, time, true); return "Server will restart in " + time + " seconds!"; } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java index fc7632572e..9c1fd417bd 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java @@ -47,7 +47,7 @@ public class ServerShutdown implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, false); + Shutdown.getInstance().startShutdown(null, time, false); return "Server will shutdown in " + time + " seconds!"; } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java index c7870a0045..dafad09f2e 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java @@ -408,7 +408,7 @@ public class GameServer if (Config.RESTART_ON_DEADLOCK) { Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now."); - Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true); + Shutdown.getInstance().startShutdown(null, 60, true); } }); _deadDetectThread.setDaemon(true); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java index 0c900c0861..dbaf36b403 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java @@ -83,65 +83,6 @@ public class Shutdown extends Thread Broadcast.toAllOnlinePlayers(sysm); } - public void startTelnetShutdown(String IP, int seconds, boolean restart) - { - LOGGER.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - - _shutdownMode = restart ? GM_RESTART : GM_SHUTDOWN; - - if (_shutdownMode > 0) - { - switch (seconds) - { - case 540: - case 480: - case 420: - case 360: - case 300: - case 240: - case 180: - case 120: - case 60: - case 30: - case 10: - case 5: - case 4: - case 3: - case 2: - case 1: - { - break; - } - default: - { - SendServerQuit(seconds); - } - } - } - - if (_counterInstance != null) - { - _counterInstance._abort(); - } - _counterInstance = new Shutdown(seconds, restart); - _counterInstance.start(); - } - - /** - * This function aborts a running countdown - * @param IP IP Which Issued shutdown command - */ - public void telnetAbort(String IP) - { - LOGGER.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); - - if (_counterInstance != null) - { - _counterInstance._abort(); - Broadcast.toAllOnlinePlayers("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!", false); - } - } - /** * Default constructor is only used internal to create the shutdown-hook instance */ @@ -382,7 +323,7 @@ public class Shutdown extends Thread */ public void abort(L2PcInstance activeChar) { - LOGGER.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); + LOGGER.warning("GM: " + (activeChar != null ? activeChar.getName() + "(" + activeChar.getObjectId() + ") " : "") + "issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); if (_counterInstance != null) { _counterInstance._abort(); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java index 752c375c4c..768cfd61ce 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java @@ -41,7 +41,7 @@ public class ServerAbort implements ITelnetCommand @Override public String handle(ChannelHandlerContext ctx, String[] args) { - Shutdown.getInstance().telnetAbort(ctx.channel().remoteAddress().toString()); + Shutdown.getInstance().abort(null); return "Server shutdown/restart aborted!"; } } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java index 788e7709a5..6a317bd900 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java @@ -47,7 +47,7 @@ public class ServerRestart implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, true); + Shutdown.getInstance().startShutdown(null, time, true); return "Server will restart in " + time + " seconds!"; } } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java index fc7632572e..9c1fd417bd 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java @@ -47,7 +47,7 @@ public class ServerShutdown implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, false); + Shutdown.getInstance().startShutdown(null, time, false); return "Server will shutdown in " + time + " seconds!"; } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java index cf3c1f47cf..bf94971882 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java @@ -408,7 +408,7 @@ public class GameServer if (Config.RESTART_ON_DEADLOCK) { Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now."); - Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true); + Shutdown.getInstance().startShutdown(null, 60, true); } }); _deadDetectThread.setDaemon(true); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java index 0c900c0861..dbaf36b403 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java @@ -83,65 +83,6 @@ public class Shutdown extends Thread Broadcast.toAllOnlinePlayers(sysm); } - public void startTelnetShutdown(String IP, int seconds, boolean restart) - { - LOGGER.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - - _shutdownMode = restart ? GM_RESTART : GM_SHUTDOWN; - - if (_shutdownMode > 0) - { - switch (seconds) - { - case 540: - case 480: - case 420: - case 360: - case 300: - case 240: - case 180: - case 120: - case 60: - case 30: - case 10: - case 5: - case 4: - case 3: - case 2: - case 1: - { - break; - } - default: - { - SendServerQuit(seconds); - } - } - } - - if (_counterInstance != null) - { - _counterInstance._abort(); - } - _counterInstance = new Shutdown(seconds, restart); - _counterInstance.start(); - } - - /** - * This function aborts a running countdown - * @param IP IP Which Issued shutdown command - */ - public void telnetAbort(String IP) - { - LOGGER.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); - - if (_counterInstance != null) - { - _counterInstance._abort(); - Broadcast.toAllOnlinePlayers("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!", false); - } - } - /** * Default constructor is only used internal to create the shutdown-hook instance */ @@ -382,7 +323,7 @@ public class Shutdown extends Thread */ public void abort(L2PcInstance activeChar) { - LOGGER.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); + LOGGER.warning("GM: " + (activeChar != null ? activeChar.getName() + "(" + activeChar.getObjectId() + ") " : "") + "issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); if (_counterInstance != null) { _counterInstance._abort(); diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/Shutdown.java index 8c5701c7f0..598bd901ed 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/Shutdown.java @@ -55,11 +55,7 @@ public class Shutdown extends Thread SIGTERM("Terminating"), SHUTDOWN("Shutting down"), RESTART("Restarting"), - ABORT("Aborting"), - TASK_SHUT("Shuting down"), - TASK_RES("Restarting"), - TELL_SHUT("Shuting down"), - TELL_RES("Restarting"); + ABORT("Aborting"); private final String _modeText; @@ -93,78 +89,14 @@ public class Shutdown extends Thread public static final int GM_RESTART = 2; /** 3 */ public static final int ABORT = 3; - /** 4 */ - public static final int TASK_SHUTDOWN = 4; - /** 5 */ - public static final int TASK_RESTART = 5; - /** 6 */ - public static final int TELL_SHUTDOWN = 6; - /** 7 */ - public static final int TELL_RESTART = 7; private static final String[] MODE_TEXT = { "SIGTERM", "shutting down", "restarting", - "aborting", // standart - "shutting down", - "restarting", // task - "shutting down", - "restarting" - }; // telnet - - /** - * This function starts a shutdown count down from Telnet (Copied from Function startShutdown()) - * @param IP Which Issued shutdown command - * @param seconds seconds until shutdown - * @param restart true if the server will restart after shutdown - */ - - public void startTelnetShutdown(String IP, int seconds, boolean restart) - { - final Announcements _an = Announcements.getInstance(); - LOGGER.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - _an.announceToAll("Server is " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - - if (restart) - { - _shutdownMode = TELL_RESTART; - } - else - { - _shutdownMode = TELL_SHUTDOWN; - } - - if (_shutdownMode > 0) - { - _an.announceToAll("Server is " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - _an.announceToAll("Please exit game now!!"); - } - - if (_counterInstance != null) - { - _counterInstance._abort(); - } - _counterInstance = new Shutdown(seconds, restart, false, true); - _counterInstance.start(); - } - - /** - * This function aborts a running countdown - * @param IP IP Which Issued shutdown command - */ - public void telnetAbort(String IP) - { - Announcements _an = Announcements.getInstance(); - LOGGER.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); - _an.announceToAll("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!"); - - if (_counterInstance != null) - { - _counterInstance._abort(); - } - } + "aborting" + }; /** * Default constructor is only used internal to create the shutdown-hook instance @@ -180,10 +112,8 @@ public class Shutdown extends Thread * This creates a count down instance of Shutdown. * @param seconds how many seconds until shutdown * @param restart true is the server shall restart after shutdown - * @param task - * @param telnet */ - public Shutdown(int seconds, boolean restart, boolean task, boolean telnet) + private Shutdown(int seconds, boolean restart) { if (seconds < 0) { @@ -192,30 +122,11 @@ public class Shutdown extends Thread _secondsShut = seconds; if (restart) { - if (!task) - { - _shutdownMode = GM_RESTART; - } - else if (telnet) - { - _shutdownMode = TELL_RESTART; - } - else - { - _shutdownMode = TASK_RESTART; - } - } - else if (!task) - { - _shutdownMode = GM_SHUTDOWN; - } - else if (telnet) - { - _shutdownMode = TELL_SHUTDOWN; + _shutdownMode = GM_RESTART; } else { - _shutdownMode = TASK_SHUTDOWN; + _shutdownMode = GM_SHUTDOWN; } _shutdownStarted = false; @@ -254,10 +165,6 @@ public class Shutdown extends Thread @Override public void run() { - /* - * // disallow new logins try { //Doesnt actually do anything //Server.gameServer.getLoginController().setMaxAllowedOnlinePlayers(0); } catch(Throwable t) { if(Config.ENABLE_ALL_EXCEPTIONS) t.printStackTrace(); } - */ - if (this == _instance) { closeServer(); @@ -287,14 +194,7 @@ public class Shutdown extends Thread { Announcements _an = Announcements.getInstance(); - if (activeChar != null) - { - LOGGER.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - } - else - { - LOGGER.warning("External Service issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - } + LOGGER.warning((activeChar != null ? "GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ")" : "Server") + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); if (restart) { @@ -317,7 +217,7 @@ public class Shutdown extends Thread } // the main instance should only run for shutdown hook, so we start a new instance - _counterInstance = new Shutdown(seconds, restart, false, false); + _counterInstance = new Shutdown(seconds, restart); _counterInstance.start(); } @@ -334,14 +234,7 @@ public class Shutdown extends Thread { Announcements _an = Announcements.getInstance(); - if (activeChar != null) - { - LOGGER.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); - } - else - { - LOGGER.warning("External Service issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); - } + LOGGER.warning((activeChar != null ? "GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ")" : "Server") + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); _an.announceToAll("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!"); @@ -351,14 +244,6 @@ public class Shutdown extends Thread } } - /** - * set the shutdown mode - * @param mode what mode shall be set - */ - /* - * private void setMode(int mode) { _shutdownMode = mode; } - */ - /** * set shutdown mode to ABORT */ @@ -425,8 +310,7 @@ public class Shutdown extends Thread private void closeServer() { - // last byebye, save all data and quit this server - // logging doesnt work here :( + // Save all data and quit this server. _shutdownStarted = true; try @@ -494,32 +378,10 @@ public class Shutdown extends Thread LOGGER.info("[STATUS] Server shutdown successfully."); - // server will quit, when this function ends. - /* - * switch (_shutdownMode) { case GM_SHUTDOWN: _instance.setMode(GM_SHUTDOWN); System.exit(0); break; case GM_RESTART: _instance.setMode(GM_RESTART); System.exit(2); break; case TASK_SHUTDOWN: _instance.setMode(TASK_SHUTDOWN); System.exit(4); break; case TASK_RESTART: - * _instance.setMode(TASK_RESTART); System.exit(5); break; case TELL_SHUTDOWN: _instance.setMode(TELL_SHUTDOWN); System.exit(6); break; case TELL_RESTART: _instance.setMode(TELL_RESTART); System.exit(7); break; } - */ - if (_instance._shutdownMode == GM_RESTART) { Runtime.getRuntime().halt(2); } - else if (_instance._shutdownMode == TASK_RESTART) - { - Runtime.getRuntime().halt(5); - } - else if (_instance._shutdownMode == TASK_SHUTDOWN) - { - Runtime.getRuntime().halt(4); - } - else if (_instance._shutdownMode == TELL_RESTART) - { - Runtime.getRuntime().halt(7); - } - else if (_instance._shutdownMode == TELL_SHUTDOWN) - { - Runtime.getRuntime().halt(6); - } else { Runtime.getRuntime().halt(0); @@ -549,26 +411,6 @@ public class Shutdown extends Thread LOGGER.info("GM restart received. Restarting NOW!"); break; } - case TASK_SHUTDOWN: - { - LOGGER.info("Auto task shutdown received. Shutting down NOW!"); - break; - } - case TASK_RESTART: - { - LOGGER.info("Auto task restart received. Restarting NOW!"); - break; - } - case TELL_SHUTDOWN: - { - LOGGER.info("Telnet shutdown received. Shutting down NOW!"); - break; - } - case TELL_RESTART: - { - LOGGER.info("Telnet restart received. Restarting NOW!"); - break; - } } try { @@ -640,7 +482,7 @@ public class Shutdown extends Thread // Save data CountStore TradeController.getInstance().dataCountStore(); - LOGGER.info("TradeController: All count Item Saved"); + LOGGER.info("TradeController: All count Item Saved!!"); // Save Olympiad status try @@ -661,11 +503,11 @@ public class Shutdown extends Thread // Save Fishing tournament data FishingChampionshipManager.getInstance().shutdown(); - LOGGER.info("Fishing Championship data has been saved."); + LOGGER.info("Fishing Championship data has been saved!!"); // Schemes save. BufferTable.getInstance().saveSchemes(); - LOGGER.info("BufferTable data has been saved."); + LOGGER.info("BufferTable data has been saved!!"); // Save all global (non-player specific) Quest data that needs to persist after reboot if (!Config.ALT_DEV_NO_QUESTS) @@ -744,5 +586,4 @@ public class Shutdown extends Thread } } } - } diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRestart.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRestart.java index 02c7e5366c..9e7dba306b 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRestart.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRestart.java @@ -48,8 +48,6 @@ public final class TaskRestart extends Task public void onTimeElapsed(ExecutedTask task) { LOGGER.info("[GlobalTask] Server Restart launched."); - - final Shutdown handler = new Shutdown(Integer.valueOf(task.getParams()[2]), true, true, false); - handler.start(); + Shutdown.getInstance().startShutdown(null, Integer.valueOf(task.getParams()[2]), true); } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskShutdown.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskShutdown.java index 3f95051e49..0230cc4866 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskShutdown.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskShutdown.java @@ -48,8 +48,6 @@ public class TaskShutdown extends Task public void onTimeElapsed(ExecutedTask task) { LOGGER.info("[GlobalTask] Server Shutdown launched."); - - final Shutdown handler = new Shutdown(Integer.valueOf(task.getParams()[2]), false, true, false); - handler.start(); + Shutdown.getInstance().startShutdown(null, Integer.valueOf(task.getParams()[2]), false); } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java index c21141b01d..1b1e33366d 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java @@ -456,7 +456,7 @@ public class GameStatusThread extends Thread try { final int val = Integer.parseInt(_usrCommand.substring(9)); - Shutdown.getInstance().startTelnetShutdown(_cSocket.getInetAddress().getHostAddress(), val, false); + Shutdown.getInstance().startShutdown(null, val, false); _print.println("Server Will Shutdown In " + val + " Seconds!"); _print.println("Type \"abort\" To Abort Shutdown!"); } @@ -474,7 +474,7 @@ public class GameStatusThread extends Thread try { final int val = Integer.parseInt(_usrCommand.substring(8)); - Shutdown.getInstance().startTelnetShutdown(_cSocket.getInetAddress().getHostAddress(), val, true); + Shutdown.getInstance().startShutdown(null, val, true); _print.println("Server Will Restart In " + val + " Seconds!"); _print.println("Type \"abort\" To Abort Restart!"); } @@ -489,7 +489,7 @@ public class GameStatusThread extends Thread } else if (_usrCommand.startsWith("abort")) { - Shutdown.getInstance().telnetAbort(_cSocket.getInetAddress().getHostAddress()); + Shutdown.getInstance().abort(null); _print.println("OK! - Shutdown/Restart Aborted."); } else if (_usrCommand.equals("quit")) diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java index 752c375c4c..768cfd61ce 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java @@ -41,7 +41,7 @@ public class ServerAbort implements ITelnetCommand @Override public String handle(ChannelHandlerContext ctx, String[] args) { - Shutdown.getInstance().telnetAbort(ctx.channel().remoteAddress().toString()); + Shutdown.getInstance().abort(null); return "Server shutdown/restart aborted!"; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java index 788e7709a5..6a317bd900 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java @@ -47,7 +47,7 @@ public class ServerRestart implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, true); + Shutdown.getInstance().startShutdown(null, time, true); return "Server will restart in " + time + " seconds!"; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java index fc7632572e..9c1fd417bd 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java @@ -47,7 +47,7 @@ public class ServerShutdown implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, false); + Shutdown.getInstance().startShutdown(null, time, false); return "Server will shutdown in " + time + " seconds!"; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java index 1651b3e111..d2c54dcb86 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java @@ -405,7 +405,7 @@ public class GameServer if (Config.RESTART_ON_DEADLOCK) { Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now."); - Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true); + Shutdown.getInstance().startShutdown(null, 60, true); } }); _deadDetectThread.setDaemon(true); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java index 5cef32d8f2..e15719d422 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java @@ -84,65 +84,6 @@ public class Shutdown extends Thread Broadcast.toAllOnlinePlayers(sysm); } - public void startTelnetShutdown(String IP, int seconds, boolean restart) - { - LOGGER.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - - _shutdownMode = restart ? GM_RESTART : GM_SHUTDOWN; - - if (_shutdownMode > 0) - { - switch (seconds) - { - case 540: - case 480: - case 420: - case 360: - case 300: - case 240: - case 180: - case 120: - case 60: - case 30: - case 10: - case 5: - case 4: - case 3: - case 2: - case 1: - { - break; - } - default: - { - SendServerQuit(seconds); - } - } - } - - if (_counterInstance != null) - { - _counterInstance._abort(); - } - _counterInstance = new Shutdown(seconds, restart); - _counterInstance.start(); - } - - /** - * This function aborts a running countdown - * @param IP IP Which Issued shutdown command - */ - public void telnetAbort(String IP) - { - LOGGER.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); - - if (_counterInstance != null) - { - _counterInstance._abort(); - Broadcast.toAllOnlinePlayers("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!", false); - } - } - /** * Default constructor is only used internal to create the shutdown-hook instance */ @@ -383,7 +324,7 @@ public class Shutdown extends Thread */ public void abort(L2PcInstance activeChar) { - LOGGER.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); + LOGGER.warning("GM: " + (activeChar != null ? activeChar.getName() + "(" + activeChar.getObjectId() + ") " : "") + "issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); if (_counterInstance != null) { _counterInstance._abort(); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java index 752c375c4c..768cfd61ce 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java @@ -41,7 +41,7 @@ public class ServerAbort implements ITelnetCommand @Override public String handle(ChannelHandlerContext ctx, String[] args) { - Shutdown.getInstance().telnetAbort(ctx.channel().remoteAddress().toString()); + Shutdown.getInstance().abort(null); return "Server shutdown/restart aborted!"; } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java index 788e7709a5..6a317bd900 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java @@ -47,7 +47,7 @@ public class ServerRestart implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, true); + Shutdown.getInstance().startShutdown(null, time, true); return "Server will restart in " + time + " seconds!"; } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java index fc7632572e..9c1fd417bd 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java @@ -47,7 +47,7 @@ public class ServerShutdown implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, false); + Shutdown.getInstance().startShutdown(null, time, false); return "Server will shutdown in " + time + " seconds!"; } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java index 528b4f1000..c9830de34b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java @@ -399,7 +399,7 @@ public class GameServer if (Config.RESTART_ON_DEADLOCK) { Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now."); - Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true); + Shutdown.getInstance().startShutdown(null, 60, true); } }); _deadDetectThread.setDaemon(true); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/Shutdown.java index 0c900c0861..dbaf36b403 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/Shutdown.java @@ -83,65 +83,6 @@ public class Shutdown extends Thread Broadcast.toAllOnlinePlayers(sysm); } - public void startTelnetShutdown(String IP, int seconds, boolean restart) - { - LOGGER.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - - _shutdownMode = restart ? GM_RESTART : GM_SHUTDOWN; - - if (_shutdownMode > 0) - { - switch (seconds) - { - case 540: - case 480: - case 420: - case 360: - case 300: - case 240: - case 180: - case 120: - case 60: - case 30: - case 10: - case 5: - case 4: - case 3: - case 2: - case 1: - { - break; - } - default: - { - SendServerQuit(seconds); - } - } - } - - if (_counterInstance != null) - { - _counterInstance._abort(); - } - _counterInstance = new Shutdown(seconds, restart); - _counterInstance.start(); - } - - /** - * This function aborts a running countdown - * @param IP IP Which Issued shutdown command - */ - public void telnetAbort(String IP) - { - LOGGER.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); - - if (_counterInstance != null) - { - _counterInstance._abort(); - Broadcast.toAllOnlinePlayers("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!", false); - } - } - /** * Default constructor is only used internal to create the shutdown-hook instance */ @@ -382,7 +323,7 @@ public class Shutdown extends Thread */ public void abort(L2PcInstance activeChar) { - LOGGER.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); + LOGGER.warning("GM: " + (activeChar != null ? activeChar.getName() + "(" + activeChar.getObjectId() + ") " : "") + "issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); if (_counterInstance != null) { _counterInstance._abort(); diff --git a/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java b/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java index 752c375c4c..768cfd61ce 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java +++ b/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerAbort.java @@ -41,7 +41,7 @@ public class ServerAbort implements ITelnetCommand @Override public String handle(ChannelHandlerContext ctx, String[] args) { - Shutdown.getInstance().telnetAbort(ctx.channel().remoteAddress().toString()); + Shutdown.getInstance().abort(null); return "Server shutdown/restart aborted!"; } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java b/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java index 788e7709a5..6a317bd900 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java +++ b/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerRestart.java @@ -47,7 +47,7 @@ public class ServerRestart implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, true); + Shutdown.getInstance().startShutdown(null, time, true); return "Server will restart in " + time + " seconds!"; } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java b/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java index fc7632572e..9c1fd417bd 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java +++ b/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/telnethandlers/server/ServerShutdown.java @@ -47,7 +47,7 @@ public class ServerShutdown implements ITelnetCommand return null; } final int time = Integer.parseInt(args[0]); - Shutdown.getInstance().startTelnetShutdown(ctx.channel().remoteAddress().toString(), time, false); + Shutdown.getInstance().startShutdown(null, time, false); return "Server will shutdown in " + time + " seconds!"; } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameServer.java index 528b4f1000..c9830de34b 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/GameServer.java @@ -399,7 +399,7 @@ public class GameServer if (Config.RESTART_ON_DEADLOCK) { Broadcast.toAllOnlinePlayers("Server has stability issues - restarting now."); - Shutdown.getInstance().startTelnetShutdown("DeadLockDetector - Auto Restart", 60, true); + Shutdown.getInstance().startShutdown(null, 60, true); } }); _deadDetectThread.setDaemon(true); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/Shutdown.java index 0c900c0861..dbaf36b403 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/Shutdown.java @@ -83,65 +83,6 @@ public class Shutdown extends Thread Broadcast.toAllOnlinePlayers(sysm); } - public void startTelnetShutdown(String IP, int seconds, boolean restart) - { - LOGGER.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!"); - - _shutdownMode = restart ? GM_RESTART : GM_SHUTDOWN; - - if (_shutdownMode > 0) - { - switch (seconds) - { - case 540: - case 480: - case 420: - case 360: - case 300: - case 240: - case 180: - case 120: - case 60: - case 30: - case 10: - case 5: - case 4: - case 3: - case 2: - case 1: - { - break; - } - default: - { - SendServerQuit(seconds); - } - } - } - - if (_counterInstance != null) - { - _counterInstance._abort(); - } - _counterInstance = new Shutdown(seconds, restart); - _counterInstance.start(); - } - - /** - * This function aborts a running countdown - * @param IP IP Which Issued shutdown command - */ - public void telnetAbort(String IP) - { - LOGGER.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); - - if (_counterInstance != null) - { - _counterInstance._abort(); - Broadcast.toAllOnlinePlayers("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!", false); - } - } - /** * Default constructor is only used internal to create the shutdown-hook instance */ @@ -382,7 +323,7 @@ public class Shutdown extends Thread */ public void abort(L2PcInstance activeChar) { - LOGGER.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); + LOGGER.warning("GM: " + (activeChar != null ? activeChar.getName() + "(" + activeChar.getObjectId() + ") " : "") + "issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!"); if (_counterInstance != null) { _counterInstance._abort();