diff options
author | ElgarL <ElgarL@palmergames.com> | 2012-01-25 22:33:22 +0000 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2012-01-25 22:33:22 +0000 |
commit | ae2cf3d95c752b78408b58af7cce11575d210230 (patch) | |
tree | 2fdf24d770b58f4af89aab42fd0bfee35c23ab6d /EssentialsGroupManager/src/org | |
parent | e1660d47ba416d107c573d819942191a9c80bd30 (diff) | |
download | Essentials-ae2cf3d95c752b78408b58af7cce11575d210230.tar Essentials-ae2cf3d95c752b78408b58af7cce11575d210230.tar.gz Essentials-ae2cf3d95c752b78408b58af7cce11575d210230.tar.lz Essentials-ae2cf3d95c752b78408b58af7cce11575d210230.tar.xz Essentials-ae2cf3d95c752b78408b58af7cce11575d210230.zip |
Fixed subgroups (I broke earlier).
Diffstat (limited to 'EssentialsGroupManager/src/org')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java index 6e9b7ad21..7a590c412 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -152,21 +152,27 @@ public class User extends DataUnit implements Cloneable { if (this.group.equalsIgnoreCase(subGroup.getName())) { return false; } + // User already has this subgroup + if (containsSubGroup(subGroup)) + return false; + + // If the group doesn't exists add it if (!this.getDataSource().groupExists(subGroup.getName())) { getDataSource().addGroup(subGroup); - - flagAsChanged(); - if (GroupManager.isLoaded()) { - if (!GroupManager.BukkitPermissions.isPlayer_join()) - GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer()); - GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED); - } - return true; } + + subGroups.add(subGroup.getName()); + flagAsChanged(); + if (GroupManager.isLoaded()) { + if (!GroupManager.BukkitPermissions.isPlayer_join()) + GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer()); + GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED); + } + return true; + //subGroup = getDataSource().getGroup(subGroup.getName()); //removeSubGroup(subGroup); //subGroups.add(subGroup.getName()); - return false; } public int subGroupsSize() { |