Code:private int currentPlayers; private int maxPlayers; if (currentPlayers > maxPlayers) { maxPlayers = currentPlayers; }
|
How can i add a 667 command :: players that tells you how many are online and the highest amount of players online at one time today? Thanks. Much appreciated - a thanks and rep to whoever helps me.
Declare this in either your Server or World class:
Upon a player registering into the world:Code:private static int highestOnline; public static void setHighestOnline(int highestOnline) { this.highestOnline = highestOnline; } public static int getHighestOnline() { return highestOnline; }
To display this information:Code:if (players.size() < highestOnline) highestOnline = players.size();
Code:System.out.println(String.format("The highest amount of players online simultaneously is %i", highestOnline));
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |