From 9667e92d66848bd64450390c25bf745870cd3dff Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 19 Feb 2011 01:25:08 -0800 Subject: [PATCH] Added 'no-op-permissions' setting for Bukkit. --- config.yml | 1 + src/com/sk89q/worldedit/bukkit/BukkitConfiguration.java | 4 ++++ src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 5 +++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config.yml b/config.yml index 9efa6fc03..0b1a61511 100644 --- a/config.yml +++ b/config.yml @@ -56,6 +56,7 @@ history: wand-item: 271 shell-save-type: no-double-slash: false +no-op-permissions: false debug: false # See http://wiki.sk89q.com/wiki/WorldEdit/Permissions/Bukkit diff --git a/src/com/sk89q/worldedit/bukkit/BukkitConfiguration.java b/src/com/sk89q/worldedit/bukkit/BukkitConfiguration.java index 09d666641..dfab46b9d 100644 --- a/src/com/sk89q/worldedit/bukkit/BukkitConfiguration.java +++ b/src/com/sk89q/worldedit/bukkit/BukkitConfiguration.java @@ -35,6 +35,8 @@ public class BukkitConfiguration extends LocalConfiguration { private Configuration config; private Logger logger; + public boolean noOpPermissions = false; + public BukkitConfiguration(Configuration config, Logger logger) { this.config = config; this.logger = logger; @@ -76,6 +78,8 @@ public class BukkitConfiguration extends LocalConfiguration { disallowedBlocks = new HashSet(config.getIntList("limits.disallowed-blocks", null)); allowedDataCycleBlocks = new HashSet(config.getIntList("limits.allowed-data-cycle-blocks", null)); + + noOpPermissions = config.getBoolean("no-op-permissions", false); LocalSession.MAX_HISTORY_SIZE = Math.max(15, config.getInt("history.size", 15)); diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 04b96c61f..4ffbe9583 100644 --- a/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -51,7 +51,7 @@ public class WorldEditPlugin extends JavaPlugin { final WorldEdit controller; final WorldEditAPI api; - private final LocalConfiguration config; + private final BukkitConfiguration config; private final PermissionsResolverManager perms; private final WorldEditPlayerListener playerListener = @@ -280,7 +280,8 @@ public class WorldEditPlugin extends JavaPlugin { } boolean hasPermission(Player player, String perm) { - return player.isOp() || perms.hasPermission(player.getName(), perm); + return (!config.noOpPermissions && player.isOp()) + || perms.hasPermission(player.getName(), perm); } BukkitPlayer wrapPlayer(Player player) {