Added worldguard.region.flag.regions permissions and flags.<flag>.own for consistency. The old ones will probably be deprecated at some point. Also cleaned up /wg report output slightly.

This commit is contained in:
Wizjany 2011-08-10 19:50:51 -04:00
parent 4194b2ca86
commit dec469caef
2 changed files with 18 additions and 7 deletions

View File

@ -122,6 +122,7 @@ private void appendGlobalConfiguration(ConfigurationManager config) {
Class<? extends ConfigurationManager> cls = config.getClass(); Class<? extends ConfigurationManager> cls = config.getClass();
for (Field field : cls.getFields()) { for (Field field : cls.getFields()) {
try { try {
if (field.getName().equalsIgnoreCase("CONFIG_HEADER")) continue;
Object val = field.get(config); Object val = field.get(config);
configLog.put(field.getName(), val); configLog.put(field.getName(), val);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
@ -204,7 +205,7 @@ private void appendWorldInformation(List<World> worlds) {
LogListBlock infoLog = worldLog.putChild("Information"); LogListBlock infoLog = worldLog.putChild("Information");
LogListBlock entitiesLog = worldLog.putChild("Entities"); LogListBlock entitiesLog = worldLog.putChild("Entities");
infoLog.put("ID", world.getId()); infoLog.put("Seed", world.getSeed());
infoLog.put("Environment", world.getEnvironment().toString()); infoLog.put("Environment", world.getEnvironment().toString());
infoLog.put("Player count", world.getPlayers().size()); infoLog.put("Player count", world.getPlayers().size());
infoLog.put("Entity count", world.getEntities().size()); infoLog.put("Entity count", world.getEntities().size());

View File

@ -32,6 +32,7 @@
import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.CommandPermissionsException;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
@ -592,14 +593,20 @@ public static void flag(CommandContext args, WorldGuardPlugin plugin,
throw new CommandException("Could not find a region by that ID."); throw new CommandException("Could not find a region by that ID.");
} }
} }
// @TODO deprecate "flag.[own./member./blank]"
boolean hasPerm = false;
if (region.isOwner(localPlayer)) { if (region.isOwner(localPlayer)) {
plugin.checkPermission(sender, "worldguard.region.flag.own." + id.toLowerCase()); if (plugin.hasPermission(sender, "worldguard.region.flag.own." + id.toLowerCase())) hasPerm = true;
else if (plugin.hasPermission(sender, "worldguard.region.flag.regions.own." + id.toLowerCase())) hasPerm = true;
} else if (region.isMember(localPlayer)) { } else if (region.isMember(localPlayer)) {
plugin.checkPermission(sender, "worldguard.region.flag.member." + id.toLowerCase()); if (plugin.hasPermission(sender, "worldguard.region.flag.member." + id.toLowerCase())) hasPerm = true;
else if (plugin.hasPermission(sender, "worldguard.region.flag.regions.member." + id.toLowerCase())) hasPerm = true;
} else { } else {
plugin.checkPermission(sender, "worldguard.region.flag." + id.toLowerCase()); if (plugin.hasPermission(sender, "worldguard.region.flag." + id.toLowerCase())) hasPerm = true;
} else if (plugin.hasPermission(sender, "worldguard.region.flag.regions." + id.toLowerCase())) hasPerm = true;
}
if (!hasPerm) throw new CommandPermissionsException();
Flag<?> foundFlag = null; Flag<?> foundFlag = null;
@ -621,9 +628,12 @@ public static void flag(CommandContext args, WorldGuardPlugin plugin,
list.append(", "); list.append(", ");
} }
// @TODO deprecate inconsistant "owner" permission
if (region.isOwner(localPlayer)) { if (region.isOwner(localPlayer)) {
if (!plugin.hasPermission(sender, "worldguard.region.flag.flags." if (!plugin.hasPermission(sender, "worldguard.region.flag.flags."
+ flag.getName() + ".owner." + id.toLowerCase())) { + flag.getName() + ".owner." + id.toLowerCase())
&& !plugin.hasPermission(sender, "worldguard.region.flag.flags."
+ flag.getName() + ".own." + id.toLowerCase())) {
continue; continue;
} }
} else if (region.isMember(localPlayer)) { } else if (region.isMember(localPlayer)) {