Resolves comma issue relating to flag listing

This stops commas from being added when a player types in an invalid flag and the player does not have permission to use one or more of the flag that are listed.
This commit is contained in:
Dark Arc 2012-11-07 14:20:15 -05:00
parent 75d07b6dad
commit b8f9ceafbb
2 changed files with 15 additions and 18 deletions

View File

@ -19,19 +19,18 @@
package com.sk89q.worldguard.bukkit;
import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.GameMode;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.flags.DefaultFlag;
import com.sk89q.worldguard.protection.managers.RegionManager;
import org.bukkit.GameMode;
import org.bukkit.World;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.Map;
import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector;
/**
* This processes per-player state information and is also meant to be used
@ -83,10 +82,8 @@ public void run() {
}
Vector playerLocation = toVector(player.getLocation());
RegionManager regionManager = plugin.getGlobalRegionManager()
.get(player.getWorld());
ApplicableRegionSet applicable = regionManager
.getApplicableRegions(playerLocation);
RegionManager regionManager = plugin.getGlobalRegionManager().get(player.getWorld());
ApplicableRegionSet applicable = regionManager.getApplicableRegions(playerLocation);
if (!RegionQueryUtil.isInvincible(plugin, player, applicable)
&& !plugin.getGlobalStateManager().hasGodMode(player)

View File

@ -708,9 +708,6 @@ public void flag(CommandContext args, CommandSender sender) throws CommandExcept
// Need to build a list
for (Flag<?> flag : DefaultFlag.getFlags()) {
if (list.length() > 0) {
list.append(", ");
}
// @TODO deprecate inconsistant "owner" permission
if (region.isOwner(localPlayer)) {
@ -732,6 +729,9 @@ public void flag(CommandContext args, CommandSender sender) throws CommandExcept
}
}
if (list.length() > 0) {
list.append(", ");
}
list.append(flag.getName());
}