Basic cleanup for the Shutdown class.

This commit is contained in:
MobiusDevelopment
2021-11-30 02:50:06 +00:00
parent a1d39adb1c
commit 0410494e1c
25 changed files with 290 additions and 269 deletions

View File

@ -79,7 +79,7 @@ public class Shutdown extends Thread
* This function starts a shutdown count down from Telnet (Copied from Function startShutdown())
* @param seconds seconds until shutdown
*/
private void SendServerQuit(int seconds)
private void sendServerQuit(int seconds)
{
final SystemMessage sysm = new SystemMessage(SystemMessageId.THE_SERVER_WILL_BE_COMING_DOWN_IN_S1_SECOND_S_PLEASE_FIND_A_SAFE_PLACE_TO_LOG_OUT);
sysm.addInt(seconds);
@ -302,14 +302,14 @@ public class Shutdown extends Thread
}
default:
{
SendServerQuit(seconds);
sendServerQuit(seconds);
}
}
}
if (_counterInstance != null)
{
_counterInstance._abort();
_counterInstance.abort();
}
if (Config.PRECAUTIONARY_RESTART_ENABLED)
@ -331,7 +331,7 @@ public class Shutdown extends Thread
LOGGER.warning("GM: " + (player != null ? player.getName() + "(" + player.getObjectId() + ") " : "") + "issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!");
if (_counterInstance != null)
{
_counterInstance._abort();
_counterInstance.abort();
if (Config.PRECAUTIONARY_RESTART_ENABLED)
{
@ -354,7 +354,7 @@ public class Shutdown extends Thread
/**
* Set shutdown mode to ABORT.
*/
private void _abort()
private void abort()
{
_shutdownMode = ABORT;
}
@ -396,7 +396,9 @@ public class Shutdown extends Thread
case 3:
case 2:
case 1:
SendServerQuit(_secondsShut);
{
sendServerQuit(_secondsShut);
}
}
// Prevent players from logging in.
@ -407,8 +409,7 @@ public class Shutdown extends Thread
_secondsShut--;
final int delay = 1000; // milliseconds
Thread.sleep(delay);
Thread.sleep(1000);
}
}
catch (Exception e)
@ -527,19 +528,19 @@ public class Shutdown extends Thread
restartCounter();
}
protected void restartCounter()
public void restartCounter()
{
_startTime = Chronos.currentTimeMillis();
}
protected long getEstimatedTimeAndRestartCounter()
public long getEstimatedTimeAndRestartCounter()
{
final long toReturn = Chronos.currentTimeMillis() - _startTime;
restartCounter();
return toReturn;
}
protected long getEstimatedTime()
public long getEstimatedTime()
{
return Chronos.currentTimeMillis() - _startTime;
}