mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-26 04:25:37 +01:00
Should fix #738.
This commit is contained in:
parent
8cb4f22467
commit
220f6a31de
@ -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,14 +90,15 @@ 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) {
|
||||||
playerBuilder.append(player.getDisplayName()).append(", ");
|
if ((viewer == null) || viewer.canSee(player))
|
||||||
|
playerBuilder.append(player.getDisplayName()).append(", ");
|
||||||
}
|
}
|
||||||
String bString = playerBuilder.toString();
|
String bString = playerBuilder.toString();
|
||||||
return bString.substring(0, bString.length() - 2);
|
return bString.substring(0, bString.length() - 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user