Should fix #738.

This commit is contained in:
main() 2012-06-16 10:27:27 +02:00
parent 8cb4f22467
commit 220f6a31de

View File

@ -68,7 +68,7 @@ public class WhoCommand extends MultiverseCommand {
sender.sendMessage(String.format("%s--- Players in %s%s ---", ChatColor.AQUA, sender.sendMessage(String.format("%s--- Players in %s%s ---", ChatColor.AQUA,
world.getColoredWorldString(), ChatColor.AQUA)); world.getColoredWorldString(), ChatColor.AQUA));
sender.sendMessage(buildPlayerString(world)); sender.sendMessage(buildPlayerString(world, p));
return; return;
} }
} }
@ -79,7 +79,7 @@ public class WhoCommand extends MultiverseCommand {
for (MultiverseWorld world : this.worldManager.getMVWorlds()) { for (MultiverseWorld world : this.worldManager.getMVWorlds()) {
if (this.plugin.getMVPerms().canEnterWorld(p, world)) { // only show world if the player can access it if (this.plugin.getMVPerms().canEnterWorld(p, world)) { // only show world if the player can access it
if (showAll || !world.getCBWorld().getPlayers().isEmpty()) { // either show all or show if the world is not empty if (showAll || !world.getCBWorld().getPlayers().isEmpty()) { // either show all or show if the world is not empty
sender.sendMessage(String.format("%s%s - %s", world.getColoredWorldString(), ChatColor.WHITE, buildPlayerString(world))); sender.sendMessage(String.format("%s%s - %s", world.getColoredWorldString(), ChatColor.WHITE, buildPlayerString(world, p)));
shownOne = true; shownOne = true;
} }
} }
@ -90,13 +90,14 @@ public class WhoCommand extends MultiverseCommand {
return; return;
} }
private static String buildPlayerString(MultiverseWorld world) { private static String buildPlayerString(MultiverseWorld world, Player viewer) {
List<Player> players = world.getCBWorld().getPlayers(); List<Player> players = world.getCBWorld().getPlayers();
if (players.size() == 0) { if (players.size() == 0) {
return "No players found."; return "No players found.";
} else { } else {
StringBuilder playerBuilder = new StringBuilder(); StringBuilder playerBuilder = new StringBuilder();
for (Player player : players) { for (Player player : players) {
if ((viewer == null) || viewer.canSee(player))
playerBuilder.append(player.getDisplayName()).append(", "); playerBuilder.append(player.getDisplayName()).append(", ");
} }
String bString = playerBuilder.toString(); String bString = playerBuilder.toString();