mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-26 01:51:42 +01:00
Merge remote-tracking branch 'origin/groupmanager' into 2.9
This commit is contained in:
commit
e291633ac8
@ -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
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -19,10 +19,12 @@ public enum GroupManagerPermissions {
|
||||
mangdel,
|
||||
manuaddp,
|
||||
manudelp,
|
||||
manuclearp,
|
||||
manulistp,
|
||||
manucheckp,
|
||||
mangaddp,
|
||||
mangdelp,
|
||||
mangclearp,
|
||||
manglistp,
|
||||
mangcheckp,
|
||||
mangaddi,
|
||||
|
@ -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
|
||||
default: false
|
||||
|
Loading…
Reference in New Issue
Block a user