Skip to content

Commit

Permalink
Added uptime command and utility functions (#648)
Browse files Browse the repository at this point in the history
* Added uptime command and utility functions

* Don't use NumberFormat it's slower
  • Loading branch information
ipkpjersi authored Sep 21, 2024
1 parent 4fe3f44 commit 4377501
Show file tree
Hide file tree
Showing 3 changed files with 747 additions and 5 deletions.
6 changes: 6 additions & 0 deletions 2006Scape Server/src/main/java/com/rs2/GameEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ public static long getMinutesCounter() {
private final static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
private final static Lock lock = new ReentrantLock();
public static ControlPanel panel;
private static long serverStartTime;

static {
shutdownServer = false;
}

public static void main(java.lang.String[] args)
throws NullPointerException, IOException {
serverStartTime = System.currentTimeMillis();
if (NetworkConstants.RSA_EXPONENT != Constants.RSA_EXPONENT) {
NetworkConstants.RSA_EXPONENT = Constants.RSA_EXPONENT;
NetworkConstants.RSA_MODULUS = Constants.RSA_MODULUS;
Expand Down Expand Up @@ -316,4 +318,8 @@ public void run() {

public static boolean playerExecuted = false;
private static BufferedReader minuteFile;

public static long getServerStartTime() {
return serverStartTime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ public void run() {
else
player.gfx0(Integer.parseInt(arguments[0]));
break;
case "uptime":
player.getPacketSender().sendMessage("The server has now been online for: " + Misc.getServerUptime(GameEngine.getServerStartTime()));
break;
case "tele":
if (player.connectedFrom.equals("127.0.0.1")) {
try {
Expand Down
Loading

0 comments on commit 4377501

Please sign in to comment.