diff options
author | U-SFX\wardcg <wardcg@A01515.sfx.local> | 2013-04-23 01:02:31 +1000 |
---|---|---|
committer | U-SFX\wardcg <wardcg@A01515.sfx.local> | 2013-04-23 01:02:31 +1000 |
commit | 27853b78f890609446c30581db0aaa0c61014a60 (patch) | |
tree | 73428c459cc3c7c57ab26ed3e52f21d566fe2bc2 | |
parent | bb9c62e4def528c24be992e6e2b0314ad22639eb (diff) | |
parent | 3dba6faccc2b7370db7d6abcc8343587394c342e (diff) | |
download | Essentials-27853b78f890609446c30581db0aaa0c61014a60.tar Essentials-27853b78f890609446c30581db0aaa0c61014a60.tar.gz Essentials-27853b78f890609446c30581db0aaa0c61014a60.tar.lz Essentials-27853b78f890609446c30581db0aaa0c61014a60.tar.xz Essentials-27853b78f890609446c30581db0aaa0c61014a60.zip |
Merge remote-tracking branch 'origin/groupmanager' into 2.9
4 files changed, 129 insertions, 35 deletions
diff --git a/EssentialsGroupManager/src/config.yml b/EssentialsGroupManager/src/config.yml index b73671e18..44cfd6242 100644 --- a/EssentialsGroupManager/src/config.yml +++ b/EssentialsGroupManager/src/config.yml @@ -7,20 +7,20 @@ settings: # Default setting for 'mantogglevalidate' # true will cause GroupManager to attempt name matching by default. validate_toggle: true - # ********************************************************************************************************************************** - # *** NOTE: Having this feature enabled, improper use of commandblocks will lead to undesireable permission changes, be alarmed! *** - # ********************************************************************************************************************************** + # ************************************************************************************************************************************************************ + # *** NOTE: Having this feature enabled can allow improper use of Command Blocks which may lead to undesireable permission changes. You have been warned! *** + # ************************************************************************************************************************************************************ allow_commandblocks: false data: save: - # How often GroupManager will save it's data back to groups and users.yml + # How often GroupManager will save it's data back to groups.yml and users.yml minutes: 10 # Number of hours to retain backups (plugins/GroupManager/backup) hours: 24 logging: - # level of detail GroupManager will use when logging. + # Level of detail GroupManager will use when logging. # Acceptable entries are - ALL,CONFIG,FINE,FINER,FINEST,INFO,OFF,SEVERE,WARNING level: INFO diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index 6e75b3a8a..c43c97b01 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -515,7 +515,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[1] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return false; } if (auxGroup.isGlobal()) { @@ -605,7 +605,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[1] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } // Validating permission @@ -643,7 +643,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[1] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } @@ -675,7 +675,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup != null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group already exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group already exist!"); return true; } // Seems OK @@ -848,6 +848,50 @@ public class GroupManager extends JavaPlugin { BukkitPermissions.updatePermissions(targetPlayer); return true; + + case manuclearp: + // Validating state of sender + if (dataHolder == null || permissionHandler == null) { + if (!setDefaultWorldHandler(sender)) + return true; + } + // Validating arguments + if (args.length != 1) { + sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuclearp <player>)"); + return true; + } + + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { + return false; + } + + if (match != null) { + auxUser = dataHolder.getUser(match.get(0)); + } else { + auxUser = dataHolder.getUser(args[0]); + } + // Validating your permissions + if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { + sender.sendMessage(ChatColor.RED + "You can't modify a player with same group as you, or higher."); + return true; + } + for (String perm : auxUser.getPermissionList()) { + permissionResult = permissionHandler.checkFullUserPermission(senderUser, perm); + if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { + sender.sendMessage(ChatColor.RED + "You can't remove a permission you don't have: '" + perm + "'."); + } + else + { + auxUser.removePermission(perm); + } + } + sender.sendMessage(ChatColor.YELLOW + "You removed all permissions from player '" + auxUser.getName() + "'."); + + targetPlayer = this.getServer().getPlayer(auxUser.getName()); + if (targetPlayer != null) + BukkitPermissions.updatePermissions(targetPlayer); + + return true; case manulistp: // Validating state of sender @@ -995,7 +1039,7 @@ public class GroupManager extends JavaPlugin { auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return false; } // Validating your permissions @@ -1069,20 +1113,20 @@ public class GroupManager extends JavaPlugin { auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } // Validating your permissions permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString); - if (!isConsole && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { + if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have."); return true; } // Validating permissions of user permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, auxString); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { - sender.sendMessage(ChatColor.RED + "The group doesn't have direct access to that permission."); - return false; + sender.sendMessage(ChatColor.YELLOW + "The group doesn't have direct access to that permission."); + return true; } if (!auxGroup.hasSamePermissionNode(auxString)) { sender.sendMessage(ChatColor.RED + "This permission node doesn't match any node."); @@ -1096,6 +1140,40 @@ public class GroupManager extends JavaPlugin { BukkitPermissions.updateAllPlayers(); return true; + + case mangclearp: + // Validating state of sender + if (dataHolder == null || permissionHandler == null) { + if (!setDefaultWorldHandler(sender)) + return true; + } + // Validating arguments + if (args.length != 1) { + sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangclearp <group>)"); + return true; + } + + auxGroup = dataHolder.getGroup(args[0]); + if (auxGroup == null) { + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); + return true; + } + + for (String perm : auxGroup.getPermissionList()) { + permissionResult = permissionHandler.checkFullUserPermission(senderUser, perm); + if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { + sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have: '" + perm + "'."); + } + else + { + auxGroup.removePermission(perm); + } + } + sender.sendMessage(ChatColor.YELLOW + "You removed all permissions from group '" + auxGroup.getName() + "'."); + + BukkitPermissions.updateAllPlayers(); + + return true; case manglistp: // Validating state of sender @@ -1110,7 +1188,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } // Validating permission @@ -1166,7 +1244,7 @@ public class GroupManager extends JavaPlugin { auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } // Validating permission @@ -1201,12 +1279,12 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } auxGroup2 = dataHolder.getGroup(args[1]); if (auxGroup2 == null) { - sender.sendMessage(ChatColor.RED + "" + args[1] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { @@ -1240,12 +1318,12 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } auxGroup2 = dataHolder.getGroup(args[1]); if (auxGroup2 == null) { - sender.sendMessage(ChatColor.RED + "" + args[1] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { @@ -1435,7 +1513,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { @@ -1473,7 +1551,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { @@ -1504,7 +1582,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { @@ -1547,7 +1625,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { @@ -1812,16 +1890,21 @@ public class GroupManager extends JavaPlugin { } // WORKING auxString = ""; + String auxString2 = ""; for (Group g : dataHolder.getGroupList()) { auxString += g.getName() + ", "; } for (Group g : getGlobalGroups().getGroupList()) { - auxString += g.getName() + ", "; + auxString2 += g.getName() + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); } - sender.sendMessage(ChatColor.YELLOW + " Groups Available: " + ChatColor.WHITE + auxString); + if (auxString2.lastIndexOf(",") > 0) { + auxString2 = auxString2.substring(0, auxString2.lastIndexOf(",")); + } + sender.sendMessage(ChatColor.YELLOW + "Groups Available: " + ChatColor.WHITE + auxString); + sender.sendMessage(ChatColor.YELLOW + "GlobalGroups Available: " + ChatColor.WHITE + auxString2); return true; @@ -1846,7 +1929,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { @@ -1866,11 +1949,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return true; } - if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) { + if (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different heritage line."); return true; } - if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) { + if (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "The new group must be a higher rank."); return true; } @@ -1902,7 +1985,7 @@ public class GroupManager extends JavaPlugin { } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "" + args[0] + " Group doesnt exist!"); + sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { @@ -1922,11 +2005,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return true; } - if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) { + if (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different inheritage line."); return true; } - if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) { + if (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "The new group must be a lower rank."); return true; } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java index 020e4c6f1..19d8d5ed0 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java @@ -19,10 +19,12 @@ public enum GroupManagerPermissions { mangdel, manuaddp, manudelp, + manuclearp, manulistp, manucheckp, mangaddp, mangdelp, + mangclearp, manglistp, mangcheckp, mangaddi, diff --git a/EssentialsGroupManager/src/plugin.yml b/EssentialsGroupManager/src/plugin.yml index 3aec73096..c3443f3bd 100644 --- a/EssentialsGroupManager/src/plugin.yml +++ b/EssentialsGroupManager/src/plugin.yml @@ -33,13 +33,17 @@ commands: usage: /<command> <group> permissions: groupmanager.mangdel manuaddp: - description: Add permissions diretly to the player. + description: Add permissions directly to the player. usage: /<command> <player> <permissions> permissions: groupmanager.manuaddp manudelp: - description: Removes permissions diretly from the player. + description: Removes permissions directly from the player. usage: /<command> <player> <permissions> permissions: groupmanager.manudelp + manuclearp: + description: Removes all permissions of a player. + usage: /<command> <player> + permissions: groupmanager.manuclearp manulistp: description: List all permissionss from a player. usage: /<command> <player> @@ -56,6 +60,10 @@ commands: description: Removes permissions from a group. usage: /<command> <group> <permissions> permissions: groupmanager.mangdelp + mangclearp: + description: Removes all permissions of a group. + usage: /<command> <group> <permissions> + permissions: groupmanager.mangdelp manglistp: description: Lists all permissionss from a group. usage: /<command> <group> @@ -133,6 +141,7 @@ commands: usage: /<command> [world] permissions: groupmanager.manload listgroups: + aliases: [manlistg] description: List the groups available. usage: /<command> permissions: groupmanager.listgroups @@ -172,4 +181,4 @@ commands: Permissions: groupmanager.op: description: User is treated as an op when using the GroupManager commands. - default: false
\ No newline at end of file + default: false |