From 91b60be572cd005170a11ff18dd23511f9743010 Mon Sep 17 00:00:00 2001 From: zeeZ Date: Mon, 11 Apr 2011 23:57:10 +0200 Subject: [PATCH] Less config checks in loop, added newline at EOF --- permissions.txt | 2 +- src/main/java/org/dynmap/PlayerList.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/permissions.txt b/permissions.txt index 9b7e9007..324c5246 100644 --- a/permissions.txt +++ b/permissions.txt @@ -3,4 +3,4 @@ dynmap.fullrender # Issue a full render dynmap.hide.self # Hide self from map dynmap.hide.others # Hide others from map dynmap.show.self # Reveal self on map -dynmap.show.others # Reveal others on map \ No newline at end of file +dynmap.show.others # Reveal others on map diff --git a/src/main/java/org/dynmap/PlayerList.java b/src/main/java/org/dynmap/PlayerList.java index e2d784f4..3954264c 100644 --- a/src/main/java/org/dynmap/PlayerList.java +++ b/src/main/java/org/dynmap/PlayerList.java @@ -76,9 +76,10 @@ public class PlayerList { public Player[] getVisiblePlayers(String worldName) { ArrayList visiblePlayers = new ArrayList(); Player[] onlinePlayers = server.getOnlinePlayers(); + boolean useWhitelist = configuration.getBoolean("display-whitelist", false); for (int i = 0; i < onlinePlayers.length; i++) { Player p = onlinePlayers[i]; - if (p.getWorld().getName().equals(worldName) && !(configuration.getBoolean("display-whitelist", false) ^ hiddenPlayerNames.contains(p.getName().toLowerCase()))) { + if (p.getWorld().getName().equals(worldName) && !(useWhitelist ^ hiddenPlayerNames.contains(p.getName().toLowerCase()))) { visiblePlayers.add(p); } } @@ -90,9 +91,10 @@ public class PlayerList { public Player[] getVisiblePlayers() { ArrayList visiblePlayers = new ArrayList(); Player[] onlinePlayers = server.getOnlinePlayers(); + boolean useWhitelist = configuration.getBoolean("display-whitelist", false); for (int i = 0; i < onlinePlayers.length; i++) { Player p = onlinePlayers[i]; - if (!(configuration.getBoolean("display-whitelist", false) ^ hiddenPlayerNames.contains(p.getName().toLowerCase()))) { + if (!(useWhitelist ^ hiddenPlayerNames.contains(p.getName().toLowerCase()))) { visiblePlayers.add(p); } }