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

View File

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