Archiviert
13
0

Correctly modify player sample with hidden player counts.

At the moment the setPlayers() method will throw a NullPointerException
if the player count has been hidden. This will correctly reset the
player counts before setting the player list and return null in the
getter instead of throwing an exception.
Dieser Commit ist enthalten in:
Minecrell 2014-01-09 16:45:05 +01:00
Ursprung 31b26fd0c5
Commit 3e7fe52681

Datei anzeigen

@ -241,9 +241,11 @@ public class WrappedServerPing extends AbstractWrapper {
/**
* Retrieve a copy of all the logged in players.
* @return Logged in players.
* @return Logged in players or NULL if the player count has been hidden via {@link #setPlayersVisible(boolean)}.
*/
public ImmutableList<WrappedGameProfile> getPlayers() {
if (players == null)
return null;
return ImmutableList.copyOf(PROFILE_CONVERT.getSpecific(PLAYERS_PROFILES.get(players)));
}
@ -252,6 +254,8 @@ public class WrappedServerPing extends AbstractWrapper {
* @param profile - every logged in player.
*/
public void setPlayers(Iterable<? extends WrappedGameProfile> profile) {
if (players == null)
resetPlayers();
PLAYERS_PROFILES.set(players, PROFILE_CONVERT.getGeneric(GameProfile[].class, profile));
}