mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-08-26 15:32:50 +02:00
Optimize sorting to speedup permission tests.
This commit is contained in:
parent
fd1c2824ce
commit
94983c3ca7
|
@ -76,3 +76,4 @@ v 1.5:
|
|||
v 1.6:
|
||||
- Prevent Group.equals tests throwing a NullPointerException for GlobalGroups.
|
||||
- Stop throwing errors on an empty users file.
|
||||
- Optimize sorting to speedup permission tests.
|
|
@ -18,7 +18,7 @@ public abstract class DataUnit {
|
|||
|
||||
private WorldDataHolder dataSource;
|
||||
private String name;
|
||||
private boolean changed;
|
||||
private boolean changed, sorted = false;
|
||||
private ArrayList<String> permissions = new ArrayList<String>();
|
||||
|
||||
public DataUnit(WorldDataHolder dataSource, String name) {
|
||||
|
@ -91,6 +91,7 @@ public abstract class DataUnit {
|
|||
// for(StackTraceElement st: Thread.currentThread().getStackTrace()){
|
||||
// GroupManager.logger.finest(st.toString());
|
||||
// }
|
||||
sorted = false;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
@ -136,7 +137,14 @@ public abstract class DataUnit {
|
|||
return new ArrayList<String>(permissions);
|
||||
}
|
||||
|
||||
public boolean isSorted() {
|
||||
return this.sorted;
|
||||
}
|
||||
|
||||
public void sortPermissions() {
|
||||
Collections.sort(permissions, StringPermissionComparator.getInstance());
|
||||
if (!isSorted()) {
|
||||
Collections.sort(permissions, StringPermissionComparator.getInstance());
|
||||
sorted = true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user