summaryrefslogtreecommitdiffstats
path: root/EssentialsGroupManager
diff options
context:
space:
mode:
authorElgarL <ElgarL@palmergames.com>2013-03-28 05:59:35 -0700
committerElgarL <ElgarL@palmergames.com>2013-03-28 05:59:35 -0700
commite15a8c50d68d3feaf129777736501e18b60b3276 (patch)
treed3519a54f566abcc9e0f155127e5c399b3155286 /EssentialsGroupManager
parentf5ed4dd6cd3b1df834d8b7bdaf3b143ee5a3fe24 (diff)
parent973e918d3adbdf04776e117ab640b3ae5abe4afd (diff)
downloadEssentials-e15a8c50d68d3feaf129777736501e18b60b3276.tar
Essentials-e15a8c50d68d3feaf129777736501e18b60b3276.tar.gz
Essentials-e15a8c50d68d3feaf129777736501e18b60b3276.tar.lz
Essentials-e15a8c50d68d3feaf129777736501e18b60b3276.tar.xz
Essentials-e15a8c50d68d3feaf129777736501e18b60b3276.zip
Merge pull request #371 from necrodoom/patch-72
add new commands and others
Diffstat (limited to 'EssentialsGroupManager')
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java137
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java2
-rw-r--r--EssentialsGroupManager/src/plugin.yml15
3 files changed, 124 insertions, 30 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 6e75b3a8a..e27389d7a 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 (auxString : auxUser.getPermissionList()) {
+ permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString);
+ 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: '" + auxString + "'.");
+ }
+ else
+ {
+ auxUser.removePermission(auxString);
+ }
+ }
+ 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 (auxString : auxGroup.getPermissionList()) {
+ permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString);
+ 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: '" + auxString + "'.");
+ }
+ else
+ {
+ auxGroup.removePermission(auxString);
+ }
+ }
+ 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 = auxString.substring(0, auxString.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