Fixes for hidden worlds displaying as null

This commit is contained in:
fernferret 2011-10-11 21:57:35 -04:00
parent 750adcf376
commit 86af11b662
3 changed files with 12 additions and 7 deletions

View File

@ -200,6 +200,9 @@ public class MVWorld implements MultiverseWorld {
} }
public String getColoredWorldString() { public String getColoredWorldString() {
if (this.getColor() == null) {
return this.getAlias() + ChatColor.WHITE;
}
return this.getColor() + this.getAlias() + ChatColor.WHITE; return this.getColor() + this.getAlias() + ChatColor.WHITE;
} }

View File

@ -40,7 +40,6 @@ public class ListCommand extends MultiverseCommand {
String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n"; String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n";
for (MultiverseWorld world : this.plugin.getMVWorldManager().getMVWorlds()) { for (MultiverseWorld world : this.plugin.getMVWorldManager().getMVWorlds()) {
if (p != null && (!this.plugin.getMVPerms().canEnterWorld(p, world))) { if (p != null && (!this.plugin.getMVPerms().canEnterWorld(p, world))) {
continue; continue;
} }
@ -57,14 +56,14 @@ public class ListCommand extends MultiverseCommand {
String outputCache = world.getColoredWorldString() + ChatColor.WHITE + " - " + color + world.getEnvironment() + " \n"; String outputCache = world.getColoredWorldString() + ChatColor.WHITE + " - " + color + world.getEnvironment() + " \n";
if (world.isHidden()) { if (world.isHidden()) {
// TODO: Add an actual permission for this. // TODO: Add an actual permission for this.
if (p != null && !p.isOp()) { if (p == null || p.isOp()) {
continue; // Prefix hidden worlds with an "[H]"
outputCache = ChatColor.GRAY + "[H]" + outputCache;
output += outputCache;
} }
// Prefix hidden worlds with an "[H]" } else {
outputCache = ChatColor.GRAY + "[H]" + outputCache; output += outputCache;
} }
output += outputCache;
} }
String[] response = output.split("\n"); String[] response = output.split("\n");
for (String msg : response) { for (String msg : response) {

View File

@ -47,6 +47,9 @@ public class MVPlayerListener extends PlayerListener {
return; return;
} }
MultiverseWorld mvworld = this.worldManager.getMVWorld(world); MultiverseWorld mvworld = this.worldManager.getMVWorld(world);
if(mvworld.isHidden()) {
return;
}
prefix = mvworld.getColoredWorldString(); prefix = mvworld.getColoredWorldString();
String format = event.getFormat(); String format = event.getFormat();
event.setFormat("[" + prefix + "]" + format); event.setFormat("[" + prefix + "]" + format);