From aceea11885133ed0dd1c371d1011ab9d1ce16b25 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Mon, 25 Feb 2013 10:46:16 +0000 Subject: Warn when adding a node where an exception already exist. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../org/anjocaido/groupmanager/GroupManager.java | 24 ++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) (limited to 'EssentialsGroupManager') 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 -- cgit v1.2.3