Force the count to be zero if the value is negative (FS-216) (#56)

This commit is contained in:
Nathan Curran
2021-05-01 23:58:03 +10:00
committed by GitHub
parent 6073712fdf
commit f240a15af3
2 changed files with 7 additions and 3 deletions

View File

@ -101,7 +101,8 @@ public class Command_list extends FreedomCommand
}
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(" out of a maximum ")
.append(ChatColor.RED)