diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/ISettings.java | 4 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Settings.java | 20 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/User.java | 14 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java | 34 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java | 3 | ||||
-rw-r--r-- | Essentials/src/config.yml | 12 | ||||
-rw-r--r-- | Essentials/src/plugin.yml | 5 |
7 files changed, 21 insertions, 71 deletions
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 434de7ba6..d8c421fde 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -92,10 +92,6 @@ public interface ISettings extends IConf boolean isCommandOverridden(String name); - boolean isCommandRestricted(IEssentialsCommand cmd); - - boolean isCommandRestricted(String label); - boolean isDebug(); boolean isEcoDisabled(); diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 90310cedb..3530e3de2 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -147,26 +147,6 @@ public class Settings implements ISettings } @Override - public boolean isCommandRestricted(IEssentialsCommand cmd) - { - return isCommandRestricted(cmd.getName()); - } - - @Override - public boolean isCommandRestricted(String label) - { - for (String c : config.getStringList("restricted-commands")) - { - if (!c.equalsIgnoreCase(label)) - { - continue; - } - return true; - } - return config.getBoolean("restrict-" + label.toLowerCase(Locale.ENGLISH), false); - } - - @Override public boolean isPlayerCommand(String label) { for (String c : config.getStringList("player-commands")) diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index dbd56df12..01284d4b8 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -63,20 +63,22 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser @Override public boolean isAuthorized(final String node) { + final boolean result = isAuthorizedCheck(node); if (ess.getSettings().isDebug()) { - ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " has " + node); + ess.getLogger().log(Level.INFO, "checking if " + base.getName() + " has " + node + " - " + result); } + return result; + } + + private boolean isAuthorizedCheck(final String node) + { + if (base instanceof OfflinePlayer) { return false; } - if (isOp()) - { - return true; - } - if (isJailed()) { return false; diff --git a/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java index fad479444..f51ce4518 100644 --- a/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/ConfigPermissionsHandler.java @@ -6,7 +6,7 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -public class ConfigPermissionsHandler implements IPermissionsHandler +public class ConfigPermissionsHandler extends SuperpermsHandler { private final transient IEssentials ess; @@ -16,46 +16,16 @@ public class ConfigPermissionsHandler implements IPermissionsHandler } @Override - public String getGroup(final Player base) - { - return null; - } - - @Override - public List<String> getGroups(final Player base) - { - return null; - } - - @Override public boolean canBuild(final Player base, final String group) { return true; } @Override - public boolean inGroup(final Player base, final String group) - { - return false; - } - - @Override public boolean hasPermission(final Player base, final String node) { final String[] cmds = node.split("\\.", 2); - return !ess.getSettings().isCommandRestricted(cmds[cmds.length - 1]) - && ess.getSettings().isPlayerCommand(cmds[cmds.length - 1]); + return ess.getSettings().isPlayerCommand(cmds[cmds.length - 1]) || super.hasPermission(base, node); } - @Override - public String getPrefix(final Player base) - { - return null; - } - - @Override - public String getSuffix(final Player base) - { - return null; - } } diff --git a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java index e1bf13d10..ab2332528 100644 --- a/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java +++ b/Essentials/src/com/earth2me/essentials/perm/PermissionsHandler.java @@ -200,7 +200,8 @@ public class PermissionsHandler implements IPermissionsHandler { if (!(handler instanceof ConfigPermissionsHandler)) { - LOGGER.log(Level.INFO, "Essentials: Using config based permissions. Enable superperms in config."); + LOGGER.log(Level.INFO, "Essentials: Using config file enhanced permissions."); + LOGGER.log(Level.INFO, "Permissions listed in as player-commands will be given to all users."); handler = new ConfigPermissionsHandler(plugin); } } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 65a0773fd..de8559fee 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -96,10 +96,10 @@ overridden-commands: disabled-commands: # - nick -# Restricted commands have been removed. -# Now we have a whitelist, all commands not on this list are only available to ops. -# These will have NO EFFECT if you have Permissions installed! -# They are here only if you want something simpler than Permissions. +# If you do not wish to use a permission system, you can define a list of 'player perms' below. +# This list has no effect if your using a supported permissions system. +# If your using an unsupported permissions system simply delete this section. +# Whitelist the commands and permissions you wish to give players by default (everything else is op only). # These are the permissions without the "essentials." part. player-commands: - afk @@ -260,10 +260,6 @@ debug: false # Turn off god mode when people exit remove-god-on-disconnect: false -# Use the permission system of bukkit -# This only works if no other permission plugins are installed -use-bukkit-permissions: false - # Auto-AFK # After this timeout in seconds, the user will be set as afk. # Set to -1 for no timeout. diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index ce1e8d787..cb4e501e2 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -450,3 +450,8 @@ commands: description: Calculates the worth of items in hand or as specified. usage: /<command> [item] [amount] aliases: [eworth,price,eprice] + +permissions: + essentials.*: + default: op + description: Give op's everything by default
\ No newline at end of file |