diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 7e413f9cf..e1c8c28b9 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -61,7 +61,7 @@ import org.yaml.snakeyaml.error.YAMLException; public class Essentials extends JavaPlugin implements IEssentials { - public static final int BUKKIT_VERSION = 1791; + public static final int BUKKIT_VERSION = 1818; private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient ISettings settings; private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 5307c43dc..5155d6181 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -118,4 +118,8 @@ v 1.9: - addSubGroup now returns a boolean for success/failure. - '/manuaddsub' now correctly reports if it was able to add the sub group. - Allow negation to the * permission node when populating superperms. - - Fix trying to modify an unmodifiable collection breaking superperms. \ No newline at end of file + - Fix trying to modify an unmodifiable collection breaking superperms. + - Fixed subgroups (I broke earlier). + - Check for a null player object in the PlayerTeleportEvent. + - Trap errors in fetching the mirrors map. + - Fixed an infinite loop error when using '/manudel' on a logged in player. It caused setDefaultGroup to trigger a bukkit update when no GM User existed yet. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java index 591afe3fa..d830696e7 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java @@ -66,10 +66,12 @@ public class GMConfiguration { public Map getMirrorsMap() { // Try to fetch the old mirror path first - if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) + if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) { return (Map) GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false); - else + } else if (GMconfig.isConfigurationSection("settings.mirrors")){ return (Map) GMconfig.getConfigurationSection("settings.mirrors").getValues(false); + } + return null; } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java index 6e9b7ad21..980b0846c 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -122,6 +122,15 @@ public class User extends DataUnit implements Cloneable { * the group to set */ public void setGroup(Group group) { + setGroup(group, true); + } + + /** + * @param group the group to set + * @param updatePerms if we are to trigger a superperms update. + * + */ + public void setGroup(Group group, Boolean updatePerms) { if (!this.getDataSource().groupExists(group.getName())) { getDataSource().addGroup(group); } @@ -129,7 +138,7 @@ public class User extends DataUnit implements Cloneable { String oldGroup = this.group; this.group = group.getName(); flagAsChanged(); - if (GroupManager.isLoaded()) { + if (GroupManager.isLoaded() && (updatePerms)) { if (!GroupManager.BukkitPermissions.isPlayer_join()) GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer()); @@ -152,21 +161,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() { diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index c9c1d2b64..3cbfbd50b 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -245,7 +245,7 @@ public class WorldDataHolder { return null; } User newUser = new User(this, userName); - newUser.setGroup(groups.getDefaultGroup()); + newUser.setGroup(groups.getDefaultGroup(), false); addUser(newUser); setUsersChanged(true); return newUser; diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index 320fe3e26..686a5495d 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -116,7 +116,8 @@ public class WorldsHolder { public void mirrorSetUp() { mirrorsGroup.clear(); mirrorsUser.clear(); - Map mirrorsMap = plugin.getGMConfig().getMirrorsMap(); + Map mirrorsMap = plugin.getGMConfig().getMirrorsMap(); + if (mirrorsMap != null) { for (String source : mirrorsMap.keySet()) { // Make sure all non mirrored worlds have a set of data files. diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index 481779c3c..3ab2dbbeb 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -397,7 +397,7 @@ public class BukkitPermissions { @EventHandler(priority = EventPriority.LOWEST) public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world - if ((event.getTo() != null) && (!event.getFrom().getWorld().equals(event.getTo().getWorld()))) { // only if world actually changed + if ((event.getTo() != null) && (event.getPlayer() != null) && (!event.getFrom().getWorld().equals(event.getTo().getWorld()))) { // only if world actually changed updatePermissions(event.getPlayer(), event.getTo().getWorld().getName()); } }