diff options
author | ElgarL <ElgarL@palmergames.com> | 2013-02-25 10:46:16 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2013-02-25 10:46:16 +0000 |
commit | 9f13653be676e2346abed5c58ff1aaeb861a51f8 (patch) | |
tree | dffb2a9ba2746386ae2da2bf7cddac54dfe261c4 | |
parent | 5f5a9adf318826c0d943c7c20f8da7a76b4ec212 (diff) | |
download | Essentials-9f13653be676e2346abed5c58ff1aaeb861a51f8.tar Essentials-9f13653be676e2346abed5c58ff1aaeb861a51f8.tar.gz Essentials-9f13653be676e2346abed5c58ff1aaeb861a51f8.tar.lz Essentials-9f13653be676e2346abed5c58ff1aaeb861a51f8.tar.xz Essentials-9f13653be676e2346abed5c58ff1aaeb861a51f8.zip |
Warn when adding a node where an exception already exist.
-rw-r--r-- | EssentialsGroupManager/src/Changelog.txt | 3 | ||||
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java | 24 |
2 files changed, 18 insertions, 9 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 6226484d7..75d506396 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -216,4 +216,5 @@ v 2.0: - Catch the error when using an out of date config for 'allow_commandblocks' So it doesn't kill the whole config.
- '/manselect' will no longer list duplicate worlds.
- Added a new mirroring option in the config of 'all_unnamed_worlds'. This will cause all new or unnamed worlds to use this mirroring.
- - Don't allow adding a node with '/manuaddp' and '/mangaddp' which is already negated.
\ No newline at end of file + - Don't allow adding a node with '/manuaddp' and '/mangaddp' which is already negated.
+ - Warn when adding a node where an exception already exist.
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index bf9e49300..74d39ecae 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -750,7 +750,7 @@ public class GroupManager extends JavaPlugin { if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The user already has direct access to that permission."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); - return false; + return true; } } else if (auxString.startsWith("-")) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { @@ -758,19 +758,23 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); return true; } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { - sender.sendMessage(ChatColor.RED + "The user already has a matching node "); + sender.sendMessage(ChatColor.RED + "The user already has a matching node."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); return true; } } else { - if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND)) { + if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { + // Warn only while still allowing you to add the node. + sender.sendMessage(ChatColor.RED + "The user already has an exception for this node."); + sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); + } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND)) { sender.sendMessage(ChatColor.RED + "The user already has direct access to that permission."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); return true; } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { - sender.sendMessage(ChatColor.RED + "The user already has a matching Negated node "); + // Warn only while still allowing you to add the node. + sender.sendMessage(ChatColor.RED + "The user already has a matching Negated node."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); - return true; } } // Seems OK @@ -1015,14 +1019,18 @@ public class GroupManager extends JavaPlugin { return true; } } else { - if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND)) { + if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { + // Warn only while still allowing you to add the node. + sender.sendMessage(ChatColor.RED + "The group already has an exception for this node."); + sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); + } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND)) { sender.sendMessage(ChatColor.RED + "The group already has direct access to that permission."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); return true; } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { - sender.sendMessage(ChatColor.RED + "The group already has a matching Negated node "); + // Warn only while still allowing you to add the node. + sender.sendMessage(ChatColor.RED + "The group already has a matching Negated node."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); - return true; } } // Seems OK |