mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-06 14:46:32 +02:00
Fixed an error on 'manucheckv'. If the users doesn't have the variable
it fell through causing an exception. Added checking of subgroups for Info nodes.
This commit is contained in:
@@ -60,3 +60,5 @@ v 1.5:
|
|||||||
Defined in groupmanager/globalgroups.yml.
|
Defined in groupmanager/globalgroups.yml.
|
||||||
Create groups in the yml with a g: prefix, then inherit in the worlds groups files.
|
Create groups in the yml with a g: prefix, then inherit in the worlds groups files.
|
||||||
- Added Info node support to Global Groups.
|
- Added Info node support to Global Groups.
|
||||||
|
- Fixed an error on 'manucheckv'. If the users doesn't have the variable it fell through causing an exception.
|
||||||
|
- Added checking of subgroups for Info nodes.
|
@@ -1176,11 +1176,17 @@ public class GroupManager extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
// VALIDANDO PERMISSAO
|
// VALIDANDO PERMISSAO
|
||||||
auxGroup = auxUser.getGroup();
|
auxGroup = auxUser.getGroup();
|
||||||
auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1], null);
|
auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]);
|
||||||
|
|
||||||
if (!auxUser.getVariables().hasVar(args[1])) {
|
if (!auxUser.getVariables().hasVar(args[1])) {
|
||||||
|
// Check sub groups
|
||||||
|
if (!auxUser.isSubGroupsEmpty() && auxGroup2 == null)
|
||||||
|
for (Group subGroup : auxUser.subGroupListCopy()) {
|
||||||
|
auxGroup2 = permissionHandler.nextGroupWithVariable(subGroup, args[1]);
|
||||||
|
}
|
||||||
if (auxGroup2 == null) {
|
if (auxGroup2 == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "The user doesn't have access to that variable!");
|
sender.sendMessage(ChatColor.RED + "The user doesn't have access to that variable!");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// PARECE OK
|
// PARECE OK
|
||||||
|
@@ -438,7 +438,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the variable value of the user, in INFO node. If not found, it
|
* Returns the variable value of the user, in INFO node. If not found, it
|
||||||
* will search for his Group variables. It will harvest the inheritance.
|
* will search for his Group variables. It will harvest the inheritance
|
||||||
|
* and subgroups.
|
||||||
*
|
*
|
||||||
* @param user
|
* @param user
|
||||||
* @param variable
|
* @param variable
|
||||||
@@ -459,7 +460,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
}
|
}
|
||||||
Group result = nextGroupWithVariable(start, variable);
|
Group result = nextGroupWithVariable(start, variable);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return "";
|
// Check sub groups
|
||||||
|
if (!auser.isSubGroupsEmpty())
|
||||||
|
for (Group subGroup : auser.subGroupListCopy()) {
|
||||||
|
result = nextGroupWithVariable(subGroup, variable);
|
||||||
|
// Found value?
|
||||||
|
if (result != null) continue;
|
||||||
|
}
|
||||||
|
if (result == null) return "";
|
||||||
}
|
}
|
||||||
return result.getVariables().getVarString(variable);
|
return result.getVariables().getVarString(variable);
|
||||||
// return getUserPermissionString(user, variable);
|
// return getUserPermissionString(user, variable);
|
||||||
@@ -467,7 +475,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the variable value of the user, in INFO node. If not found, it
|
* Returns the variable value of the user, in INFO node. If not found, it
|
||||||
* will search for his Group variables. It will harvest the inheritance.
|
* will search for his Group variables. It will harvest the inheritance
|
||||||
|
* and subgroups.
|
||||||
*
|
*
|
||||||
* @param user
|
* @param user
|
||||||
* @param variable
|
* @param variable
|
||||||
@@ -488,7 +497,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
}
|
}
|
||||||
Group result = nextGroupWithVariable(start, variable);
|
Group result = nextGroupWithVariable(start, variable);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return -1;
|
// Check sub groups
|
||||||
|
if (!auser.isSubGroupsEmpty())
|
||||||
|
for (Group subGroup : auser.subGroupListCopy()) {
|
||||||
|
result = nextGroupWithVariable(subGroup, variable);
|
||||||
|
// Found value?
|
||||||
|
if (result != null) continue;
|
||||||
|
}
|
||||||
|
if (result == null) return -1;
|
||||||
}
|
}
|
||||||
return result.getVariables().getVarInteger(variable);
|
return result.getVariables().getVarInteger(variable);
|
||||||
// return getUserPermissionInteger(string, string1);
|
// return getUserPermissionInteger(string, string1);
|
||||||
@@ -496,7 +512,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the variable value of the user, in INFO node. If not found, it
|
* Returns the variable value of the user, in INFO node. If not found, it
|
||||||
* will search for his Group variables. It will harvest the inheritance.
|
* will search for his Group variables. It will harvest the inheritance
|
||||||
|
* and subgroups.
|
||||||
*
|
*
|
||||||
* @param user
|
* @param user
|
||||||
* @param variable
|
* @param variable
|
||||||
@@ -517,7 +534,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
}
|
}
|
||||||
Group result = nextGroupWithVariable(start, variable);
|
Group result = nextGroupWithVariable(start, variable);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return false;
|
// Check sub groups
|
||||||
|
if (!auser.isSubGroupsEmpty())
|
||||||
|
for (Group subGroup : auser.subGroupListCopy()) {
|
||||||
|
result = nextGroupWithVariable(subGroup, variable);
|
||||||
|
// Found value?
|
||||||
|
if (result != null) continue;
|
||||||
|
}
|
||||||
|
if (result == null) return false;
|
||||||
}
|
}
|
||||||
return result.getVariables().getVarBoolean(variable);
|
return result.getVariables().getVarBoolean(variable);
|
||||||
// return getUserPermissionBoolean(user, string1);
|
// return getUserPermissionBoolean(user, string1);
|
||||||
@@ -525,7 +549,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the variable value of the user, in INFO node. If not found, it
|
* Returns the variable value of the user, in INFO node. If not found, it
|
||||||
* will search for his Group variables. It will harvest the inheritance.
|
* will search for his Group variables. It will harvest the inheritance
|
||||||
|
* and subgroups.
|
||||||
*
|
*
|
||||||
* @param user
|
* @param user
|
||||||
* @param variable
|
* @param variable
|
||||||
@@ -546,7 +571,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
}
|
}
|
||||||
Group result = nextGroupWithVariable(start, variable);
|
Group result = nextGroupWithVariable(start, variable);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return -1.0D;
|
// Check sub groups
|
||||||
|
if (!auser.isSubGroupsEmpty())
|
||||||
|
for (Group subGroup : auser.subGroupListCopy()) {
|
||||||
|
result = nextGroupWithVariable(subGroup, variable);
|
||||||
|
// Found value?
|
||||||
|
if (result != null) continue;
|
||||||
|
}
|
||||||
|
if (result == null) return -1.0D;
|
||||||
}
|
}
|
||||||
return result.getVariables().getVarDouble(variable);
|
return result.getVariables().getVarDouble(variable);
|
||||||
// return getUserPermissionDouble(string, string1);
|
// return getUserPermissionDouble(string, string1);
|
||||||
|
Reference in New Issue
Block a user