diff options
author | ElgarL <ElgarL@palmergames.com> | 2011-11-20 02:27:25 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2011-11-20 02:27:25 +0000 |
commit | 000d060ea690ba14b665e01e9097e3885d796820 (patch) | |
tree | 73f20ad9fa67ec06c6d08fa4bf4ce533b8be121a | |
parent | 317b0833ef66ac1e97c72e9bbea706eddf549f5d (diff) | |
download | Essentials-000d060ea690ba14b665e01e9097e3885d796820.tar Essentials-000d060ea690ba14b665e01e9097e3885d796820.tar.gz Essentials-000d060ea690ba14b665e01e9097e3885d796820.tar.lz Essentials-000d060ea690ba14b665e01e9097e3885d796820.tar.xz Essentials-000d060ea690ba14b665e01e9097e3885d796820.zip |
better groups match checking for globalgroups
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java index 8ae272328..924da3616 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java @@ -39,10 +39,19 @@ public abstract class DataUnit { public boolean equals(Object o) { if (o instanceof DataUnit) { DataUnit go = (DataUnit) o; - if (this.getName().equalsIgnoreCase(go.getName()) - && ((this.dataSource == null && go.getDataSource() == null) - || (this.dataSource.getName().equalsIgnoreCase(go.getDataSource().getName())))) { - return true; + if (this.getName().equalsIgnoreCase(go.getName())) { + // Global Group match. + if (this.dataSource == null && go.getDataSource() == null) + return true; + // This is a global group, the object to test isn't. + if (this.dataSource == null && go.getDataSource() != null) + return false; + // This is not a global group, but the object to test is. + if (this.dataSource != null && go.getDataSource() == null) + return false; + // Match on group name and world name. + if (this.dataSource.getName().equalsIgnoreCase(go.getDataSource().getName())) + return true; } } return false; |