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
|
@ -75,4 +75,5 @@ v 1.5:
|
||||||
- Fixed a crash on reload due to bukkit not unloading plugins before reloading.
|
- Fixed a crash on reload due to bukkit not unloading plugins before reloading.
|
||||||
v 1.6:
|
v 1.6:
|
||||||
- Prevent Group.equals tests throwing a NullPointerException for GlobalGroups.
|
- Prevent Group.equals tests throwing a NullPointerException for GlobalGroups.
|
||||||
- Stop throwing errors on an empty users file.
|
- 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 WorldDataHolder dataSource;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean changed;
|
private boolean changed, sorted = false;
|
||||||
private ArrayList<String> permissions = new ArrayList<String>();
|
private ArrayList<String> permissions = new ArrayList<String>();
|
||||||
|
|
||||||
public DataUnit(WorldDataHolder dataSource, String name) {
|
public DataUnit(WorldDataHolder dataSource, String name) {
|
||||||
|
@ -91,6 +91,7 @@ public abstract class DataUnit {
|
||||||
// for(StackTraceElement st: Thread.currentThread().getStackTrace()){
|
// for(StackTraceElement st: Thread.currentThread().getStackTrace()){
|
||||||
// GroupManager.logger.finest(st.toString());
|
// GroupManager.logger.finest(st.toString());
|
||||||
// }
|
// }
|
||||||
|
sorted = false;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,8 +136,15 @@ public abstract class DataUnit {
|
||||||
public ArrayList<String> getPermissionList() {
|
public ArrayList<String> getPermissionList() {
|
||||||
return new ArrayList<String>(permissions);
|
return new ArrayList<String>(permissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSorted() {
|
||||||
|
return this.sorted;
|
||||||
|
}
|
||||||
|
|
||||||
public void sortPermissions() {
|
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