mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-20 09:36:19 +01:00
Merge remote branch 'remotes/origin/groupmanager'
This commit is contained in:
commit
69209eeb2f
@ -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.
|
||||
- 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.
|
@ -66,10 +66,12 @@ public class GMConfiguration {
|
||||
|
||||
public Map<String, Object> 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<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 null;
|
||||
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
|
@ -116,7 +116,8 @@ public class WorldsHolder {
|
||||
public void mirrorSetUp() {
|
||||
mirrorsGroup.clear();
|
||||
mirrorsUser.clear();
|
||||
Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap();
|
||||
Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap();
|
||||
|
||||
if (mirrorsMap != null) {
|
||||
for (String source : mirrorsMap.keySet()) {
|
||||
// Make sure all non mirrored worlds have a set of data files.
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user