Merge branch 'development' into FS-156

This commit is contained in:
Ryan 2021-05-03 15:45:25 +01:00 committed by GitHub
commit eb9107bedf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -5,7 +5,7 @@
<groupId>me.totalfreedom</groupId> <groupId>me.totalfreedom</groupId>
<artifactId>TotalFreedomMod</artifactId> <artifactId>TotalFreedomMod</artifactId>
<version>2021.02-Patch.01-RC01</version> <version>2021.04</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>

View File

@ -101,7 +101,8 @@ public class Command_list extends FreedomCommand
} }
else else
{ {
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(server.getOnlinePlayers().size() - AdminList.vanished.size()) int count = server.getOnlinePlayers().size() - AdminList.vanished.size();
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(count < 0 ? 0 : count)
.append(ChatColor.BLUE) .append(ChatColor.BLUE)
.append(" out of a maximum ") .append(" out of a maximum ")
.append(ChatColor.RED) .append(ChatColor.RED)

View File

@ -88,6 +88,8 @@ public class Module_list extends HTTPDModule
} }
} }
int count = server.getOnlinePlayers().size() - AdminList.vanished.size();
// for future refernce - any multi-worded ranks are to be delimited by underscores in the json; eg. senior_admins // for future refernce - any multi-worded ranks are to be delimited by underscores in the json; eg. senior_admins
responseObject.put("owners", owners); responseObject.put("owners", owners);
responseObject.put("executives", executives); responseObject.put("executives", executives);
@ -97,7 +99,7 @@ public class Module_list extends HTTPDModule
responseObject.put("master_builders", masterbuilders); responseObject.put("master_builders", masterbuilders);
responseObject.put("operators", operators); responseObject.put("operators", operators);
responseObject.put("imposters", imposters); responseObject.put("imposters", imposters);
responseObject.put("online", server.getOnlinePlayers().size() - AdminList.vanished.size()); responseObject.put("online", count < 0 ? 0 : count);
responseObject.put("max", server.getMaxPlayers()); responseObject.put("max", server.getMaxPlayers());
final NanoHTTPD.Response response = new NanoHTTPD.Response(NanoHTTPD.Response.Status.OK, NanoHTTPD.MIME_JSON, responseObject.toString()); final NanoHTTPD.Response response = new NanoHTTPD.Response(NanoHTTPD.Response.Status.OK, NanoHTTPD.MIME_JSON, responseObject.toString());
@ -110,7 +112,8 @@ public class Module_list extends HTTPDModule
final Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers(); final Collection<? extends Player> onlinePlayers = Bukkit.getOnlinePlayers();
body.append("<p>There are ").append(onlinePlayers.size() - AdminList.vanished.size()).append("/") int count = onlinePlayers.size() - AdminList.vanished.size();
body.append("<p>There are ").append(count < 0 ? 0 : count).append("/")
.append(Bukkit.getMaxPlayers()).append(" players online:</p>\r\n"); .append(Bukkit.getMaxPlayers()).append(" players online:</p>\r\n");
body.append("<ul>\r\n"); body.append("<ul>\r\n");