mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-22 09:07:44 +01:00
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:
parent
75d07b6dad
commit
b8f9ceafbb
src/main/java/com/sk89q/worldguard/bukkit
@ -19,19 +19,18 @@
|
|||||||
|
|
||||||
package com.sk89q.worldguard.bukkit;
|
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.worldedit.Vector;
|
||||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
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
|
* 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());
|
Vector playerLocation = toVector(player.getLocation());
|
||||||
RegionManager regionManager = plugin.getGlobalRegionManager()
|
RegionManager regionManager = plugin.getGlobalRegionManager().get(player.getWorld());
|
||||||
.get(player.getWorld());
|
ApplicableRegionSet applicable = regionManager.getApplicableRegions(playerLocation);
|
||||||
ApplicableRegionSet applicable = regionManager
|
|
||||||
.getApplicableRegions(playerLocation);
|
|
||||||
|
|
||||||
if (!RegionQueryUtil.isInvincible(plugin, player, applicable)
|
if (!RegionQueryUtil.isInvincible(plugin, player, applicable)
|
||||||
&& !plugin.getGlobalStateManager().hasGodMode(player)
|
&& !plugin.getGlobalStateManager().hasGodMode(player)
|
||||||
|
@ -708,9 +708,6 @@ public void flag(CommandContext args, CommandSender sender) throws CommandExcept
|
|||||||
|
|
||||||
// Need to build a list
|
// Need to build a list
|
||||||
for (Flag<?> flag : DefaultFlag.getFlags()) {
|
for (Flag<?> flag : DefaultFlag.getFlags()) {
|
||||||
if (list.length() > 0) {
|
|
||||||
list.append(", ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// @TODO deprecate inconsistant "owner" permission
|
// @TODO deprecate inconsistant "owner" permission
|
||||||
if (region.isOwner(localPlayer)) {
|
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());
|
list.append(flag.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user