mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-09 16:17:37 +02:00
Prevent getAllPlayersPermissions() processing a group more than once.
Improves performance when using complex inheritance structures.
This commit is contained in:
@@ -135,3 +135,4 @@ v 1.9:
|
|||||||
- Track the 'onPlayerChangeWorld' event as some teleports seem to not be triggering a world move.
|
- Track the 'onPlayerChangeWorld' event as some teleports seem to not be triggering a world move.
|
||||||
- Catch all errors in badly formatted groups.
|
- Catch all errors in badly formatted groups.
|
||||||
- Fix a bug with getWorldData return the main world data for all mirrors, instead of the worlds parent data.
|
- Fix a bug with getWorldData return the main world data for all mirrors, instead of the worlds parent data.
|
||||||
|
- Prevent getAllPlayersPermissions() processing a group more than once. Improves performance when using complex inheritance structures.
|
@@ -121,8 +121,14 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
// Add the players own permissions.
|
// Add the players own permissions.
|
||||||
playerPermArray.addAll(populatePerms(ph.getUser(userName).getPermissionList(), includeChildren));
|
playerPermArray.addAll(populatePerms(ph.getUser(userName).getPermissionList(), includeChildren));
|
||||||
|
|
||||||
|
ArrayList<String> alreadyProcessed = new ArrayList<String>();
|
||||||
|
|
||||||
// fetch all group permissions
|
// fetch all group permissions
|
||||||
for (String group : getGroups(userName)) {
|
for (String group : getGroups(userName)) {
|
||||||
|
// Don't process a group more than once.
|
||||||
|
if (!alreadyProcessed.contains(group)) {
|
||||||
|
alreadyProcessed.add(group);
|
||||||
|
|
||||||
Set<String> groupPermArray = new HashSet<String>();
|
Set<String> groupPermArray = new HashSet<String>();
|
||||||
|
|
||||||
if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) {
|
if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) {
|
||||||
@@ -143,6 +149,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface {
|
|||||||
|| (negated && !playerPermArray.contains(perm.substring(1))))
|
|| (negated && !playerPermArray.contains(perm.substring(1))))
|
||||||
playerPermArray.add(perm);
|
playerPermArray.add(perm);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Collections.sort(playerPermArray, StringPermissionComparator.getInstance());
|
// Collections.sort(playerPermArray, StringPermissionComparator.getInstance());
|
||||||
|
Reference in New Issue
Block a user