Warn when adding a node where an exception already exist.

This commit is contained in:
ElgarL 2013-02-25 10:46:16 +00:00
parent 5f5a9adf31
commit 9f13653be6
2 changed files with 18 additions and 9 deletions

View File

@ -217,3 +217,4 @@ v 2.0:
- '/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.
- Warn when adding a node where an exception already exist.

View File

@ -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