Fix offline worlds showing population of 65535
The service has been updated to return -1 when worlds are offline, and then the UI updated to display OFF when the count is less than 0
This commit is contained in:
@@ -74,7 +74,7 @@ public class WorldsService
|
||||
.address(readString(buf))
|
||||
.activity(readString(buf))
|
||||
.location(buf.get() & 0xFF)
|
||||
.players(buf.getShort() & 0xFFFF);
|
||||
.players(buf.getShort());
|
||||
|
||||
worlds.add(worldBuilder.build());
|
||||
}
|
||||
|
||||
@@ -207,7 +207,12 @@ class WorldTableRow extends JPanel
|
||||
void updatePlayerCount(int playerCount)
|
||||
{
|
||||
this.updatedPlayerCount = playerCount;
|
||||
playerCountField.setText(String.valueOf(playerCount));
|
||||
playerCountField.setText(playerCountString(playerCount));
|
||||
}
|
||||
|
||||
private static String playerCountString(int playerCount)
|
||||
{
|
||||
return playerCount < 0 ? "OFF" : Integer.toString(playerCount);
|
||||
}
|
||||
|
||||
void setPing(int ping)
|
||||
@@ -272,7 +277,7 @@ class WorldTableRow extends JPanel
|
||||
JPanel column = new JPanel(new BorderLayout());
|
||||
column.setBorder(new EmptyBorder(0, 5, 0, 5));
|
||||
|
||||
playerCountField = new JLabel(world.getPlayers() + "");
|
||||
playerCountField = new JLabel(playerCountString(world.getPlayers()));
|
||||
playerCountField.setFont(FontManager.getRunescapeSmallFont());
|
||||
|
||||
column.add(playerCountField, BorderLayout.WEST);
|
||||
|
||||
Reference in New Issue
Block a user