Merge branch 'master' into release

This commit is contained in:
KHobbits 2012-01-26 00:31:05 +00:00
commit 16bde87982
7 changed files with 39 additions and 17 deletions

View File

@ -61,7 +61,7 @@ import org.yaml.snakeyaml.error.YAMLException;
public class Essentials extends JavaPlugin implements IEssentials 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 static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings; private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this); private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);

View File

@ -118,4 +118,8 @@ v 1.9:
- addSubGroup now returns a boolean for success/failure. - addSubGroup now returns a boolean for success/failure.
- '/manuaddsub' now correctly reports if it was able to add the sub group. - '/manuaddsub' now correctly reports if it was able to add the sub group.
- Allow negation to the * permission node when populating superperms. - Allow negation to the * permission node when populating superperms.
- Fix trying to modify an unmodifiable collection breaking superperms. - 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.

View File

@ -66,10 +66,12 @@ public class GMConfiguration {
public Map<String, Object> getMirrorsMap() { public Map<String, Object> getMirrorsMap() {
// Try to fetch the old mirror path first // Try to fetch the old mirror path first
if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) {
return (Map<String, Object>) GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false); return (Map<String, Object>) GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false);
else } else if (GMconfig.isConfigurationSection("settings.mirrors")){
return (Map<String, Object>) GMconfig.getConfigurationSection("settings.mirrors").getValues(false); return (Map<String, Object>) GMconfig.getConfigurationSection("settings.mirrors").getValues(false);
}
return null;
} }

View File

@ -122,6 +122,15 @@ public class User extends DataUnit implements Cloneable {
* the group to set * the group to set
*/ */
public void setGroup(Group group) { 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())) { if (!this.getDataSource().groupExists(group.getName())) {
getDataSource().addGroup(group); getDataSource().addGroup(group);
} }
@ -129,7 +138,7 @@ public class User extends DataUnit implements Cloneable {
String oldGroup = this.group; String oldGroup = this.group;
this.group = group.getName(); this.group = group.getName();
flagAsChanged(); flagAsChanged();
if (GroupManager.isLoaded()) { if (GroupManager.isLoaded() && (updatePerms)) {
if (!GroupManager.BukkitPermissions.isPlayer_join()) if (!GroupManager.BukkitPermissions.isPlayer_join())
GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer()); GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer());
@ -152,21 +161,27 @@ public class User extends DataUnit implements Cloneable {
if (this.group.equalsIgnoreCase(subGroup.getName())) { if (this.group.equalsIgnoreCase(subGroup.getName())) {
return false; 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())) { if (!this.getDataSource().groupExists(subGroup.getName())) {
getDataSource().addGroup(subGroup); 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()); //subGroup = getDataSource().getGroup(subGroup.getName());
//removeSubGroup(subGroup); //removeSubGroup(subGroup);
//subGroups.add(subGroup.getName()); //subGroups.add(subGroup.getName());
return false;
} }
public int subGroupsSize() { public int subGroupsSize() {

View File

@ -245,7 +245,7 @@ public class WorldDataHolder {
return null; return null;
} }
User newUser = new User(this, userName); User newUser = new User(this, userName);
newUser.setGroup(groups.getDefaultGroup()); newUser.setGroup(groups.getDefaultGroup(), false);
addUser(newUser); addUser(newUser);
setUsersChanged(true); setUsersChanged(true);
return newUser; return newUser;

View File

@ -116,7 +116,8 @@ public class WorldsHolder {
public void mirrorSetUp() { public void mirrorSetUp() {
mirrorsGroup.clear(); mirrorsGroup.clear();
mirrorsUser.clear(); mirrorsUser.clear();
Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap(); Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap();
if (mirrorsMap != null) { if (mirrorsMap != null) {
for (String source : mirrorsMap.keySet()) { for (String source : mirrorsMap.keySet()) {
// Make sure all non mirrored worlds have a set of data files. // Make sure all non mirrored worlds have a set of data files.

View File

@ -397,7 +397,7 @@ public class BukkitPermissions {
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world 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()); updatePermissions(event.getPlayer(), event.getTo().getWorld().getName());
} }
} }