From 4a5c431163098bd64cfe227eeaf2bb12906c6840 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Tue, 14 Feb 2012 13:01:39 +0000 Subject: Depreciate PlayerTeleportEvent as it's all handled in PlayerChangedWorldEvent. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../anjocaido/groupmanager/permissions/BukkitPermissions.java | 10 +--------- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index b79d56d07..fc64363d1 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -138,4 +138,5 @@ v 1.9: - Prevent getAllPlayersPermissions() processing a group more than once. Improves performance when using complex inheritance structures. - Fix world mirroring so it correctly creates data files and data sources for partially mirrored worlds. - Fixed world mirroring so it returns the correct data for the requested world. - - Change Service registration to register WorldsHolder instead of AnjoPermissionsHandler. This is the correct entry point for all data. \ No newline at end of file + - Change Service registration to register WorldsHolder instead of AnjoPermissionsHandler. This is the correct entry point for all data. + - Depreciate PlayerTeleportEvent as it's all handled in PlayerChangedWorldEvent. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index 1409f774d..053adc9ed 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -40,7 +40,6 @@ import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.permissions.Permission; @@ -361,7 +360,7 @@ public class BukkitPermissions { } @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerChangeWorld(PlayerChangedWorldEvent event) { // will portal into another world + public void onPlayerChangeWorld(PlayerChangedWorldEvent event) { // has changed worlds updatePermissions(event.getPlayer(), event.getPlayer().getWorld().getName()); } @@ -377,13 +376,6 @@ public class BukkitPermissions { updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName()); } - @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerTeleport(PlayerTeleportEvent event) { // can be teleported into another world - 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()); - } - } - @EventHandler(priority = EventPriority.LOWEST) public void onPlayerQuit(PlayerQuitEvent event) { if (!GroupManager.isLoaded()) -- cgit v1.2.3 From 59679e04232e59a65655d34b7ac47afd4d1651ac Mon Sep 17 00:00:00 2001 From: ElgarL Date: Wed, 15 Feb 2012 06:15:31 +0000 Subject: Depreciate PlayerTeleportEvent, PlayerRespawnEvent and PlayerPortalEvent as it's all handled in PlayerChangedWorldEvent. This also means we no longer update permissions before we change worlds. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../groupmanager/permissions/BukkitPermissions.java | 20 ++++++-------------- 2 files changed, 8 insertions(+), 15 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index fc64363d1..4cfc241c4 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -139,4 +139,5 @@ v 1.9: - Fix world mirroring so it correctly creates data files and data sources for partially mirrored worlds. - Fixed world mirroring so it returns the correct data for the requested world. - Change Service registration to register WorldsHolder instead of AnjoPermissionsHandler. This is the correct entry point for all data. - - Depreciate PlayerTeleportEvent as it's all handled in PlayerChangedWorldEvent. \ No newline at end of file + - Depreciate PlayerTeleportEvent, PlayerRespawnEvent and PlayerPortalEvent as it's all handled in PlayerChangedWorldEvent. + This also means we no longer update permissions before we change worlds. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index 053adc9ed..ba4a22f12 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -37,9 +37,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; -import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.permissions.Permission; @@ -345,6 +343,12 @@ public class BukkitPermissions { this.updatePermissions(player, null); } + /** + * Player events tracked to cause Superperms updates + * + * @author Steve + * + */ protected class PlayerEvents implements Listener { @EventHandler(priority = EventPriority.LOWEST) @@ -364,18 +368,6 @@ public class BukkitPermissions { updatePermissions(event.getPlayer(), event.getPlayer().getWorld().getName()); } - @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerPortal(PlayerPortalEvent event) { // will portal into another world - if ((event.getTo() != null) && (!event.getFrom().getWorld().equals(event.getTo().getWorld()))) { // only if world actually changed - updatePermissions(event.getPlayer(), event.getTo().getWorld().getName()); - } - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onPlayerRespawn(PlayerRespawnEvent event) { // can be respawned in another world - updatePermissions(event.getPlayer(), event.getRespawnLocation().getWorld().getName()); - } - @EventHandler(priority = EventPriority.LOWEST) public void onPlayerQuit(PlayerQuitEvent event) { if (!GroupManager.isLoaded()) -- cgit v1.2.3 From 3fc6bb4e4ff070713b1f48fb70e57c3d97c73490 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Wed, 15 Feb 2012 06:16:33 +0000 Subject: comment name change --- .../src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index ba4a22f12..0b6148900 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -346,7 +346,7 @@ public class BukkitPermissions { /** * Player events tracked to cause Superperms updates * - * @author Steve + * @author ElgarL * */ protected class PlayerEvents implements Listener { -- cgit v1.2.3 From 3d1c0fd1578f0ee72cc7f65500f49f30f379ac54 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Sat, 18 Feb 2012 09:05:28 +0000 Subject: A command of '/manload' with no world arguments now performs a full reload of GM. --- EssentialsGroupManager/src/Changelog.txt | 3 +- .../org/anjocaido/groupmanager/GroupManager.java | 54 +++++++++------------- 2 files changed, 23 insertions(+), 34 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 4cfc241c4..31d40413f 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -140,4 +140,5 @@ v 1.9: - Fixed world mirroring so it returns the correct data for the requested world. - Change Service registration to register WorldsHolder instead of AnjoPermissionsHandler. This is the correct entry point for all data. - Depreciate PlayerTeleportEvent, PlayerRespawnEvent and PlayerPortalEvent as it's all handled in PlayerChangedWorldEvent. - This also means we no longer update permissions before we change worlds. \ No newline at end of file + This also means we no longer update permissions before we change worlds. + - A command of '/manload' with no world arguments now performs a full reload of GM. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index b87d1de8c..d8d151200 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -25,7 +25,10 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder; +import org.anjocaido.groupmanager.events.GMSystemEvent; import org.anjocaido.groupmanager.events.GMWorldListener; +import org.anjocaido.groupmanager.events.GroupManagerEventHandler; +import org.anjocaido.groupmanager.events.GMGroupEvent.Action; import org.anjocaido.groupmanager.utils.GMLoggerHandler; import org.anjocaido.groupmanager.utils.PermissionCheckResult; import org.anjocaido.groupmanager.utils.Tasks; @@ -1492,7 +1495,9 @@ public class GroupManager extends JavaPlugin { return true; case manload: - // THIS CASE DONT NEED SENDER + /** + * Attempt to reload a specific world + */ if (args.length > 0) { auxString = ""; for (int i = 0; i < args.length; i++) { @@ -1502,51 +1507,34 @@ public class GroupManager extends JavaPlugin { } } - isLoaded = false; // Disable Bukkit Perms update + isLoaded = false; // Disable Bukkit Perms update and event triggers globalGroups.load(); worldsHolder.loadWorld(auxString); - sender.sendMessage("The request to world '" + auxString + "' was sent."); + sender.sendMessage("The request to reload world '" + auxString + "' was attempted."); isLoaded = true; BukkitPermissions.updateAllPlayers(); - return true; - } - // VALIDANDO ESTADO DO SENDER - if (dataHolder == null || permissionHandler == null) { - if (!setDefaultWorldHandler(sender)) - return true; - } - // WORKING - config.load(); - globalGroups.load(); - worldsHolder.mirrorSetUp(); - - isLoaded = false; - - if (args.length > 0) { - auxString = ""; - for (int i = 0; i < args.length; i++) { - auxString += args[i]; - if ((i + 1) < args.length) { - auxString += " "; - } - } - worldsHolder.loadWorld(auxString); - sender.sendMessage("The request to world '" + auxString + "' was sent."); } else { - worldsHolder.reloadAll(); - sender.sendMessage(ChatColor.YELLOW + " All worlds were reloaded."); + + /** + * Reload all settings and data as no world was specified. + */ + onDisable(); + onEnable(); } - - isLoaded = true; - - BukkitPermissions.updateAllPlayers(); + + /** + * Fire an event as none will have been triggered in the reload. + */ + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); return true; + case listgroups: // VALIDANDO ESTADO DO SENDER if (dataHolder == null || permissionHandler == null) { -- cgit v1.2.3 From f46948249e881688ead76add5478716bd410780e Mon Sep 17 00:00:00 2001 From: snowleo Date: Tue, 21 Feb 2012 17:33:46 +0100 Subject: Updated Essentials to work with R5 --- .../src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java | 2 +- .../src/org/anjocaido/groupmanager/events/GMGroupEvent.java | 4 ++-- .../src/org/anjocaido/groupmanager/events/GMSystemEvent.java | 2 +- .../src/org/anjocaido/groupmanager/events/GMUserEvent.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index 8115b1a75..e766b6c78 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -856,7 +856,7 @@ public class WorldDataHolder { PluginManager pm = server.getPluginManager(); Plugin[] plugins = pm.getPlugins(); for (int i = 0; i < plugins.length; i++) { - plugins[i].getConfiguration().load(); + //plugins[i].getConfiguration().load(); try { plugins[i].getClass().getMethod("setupPermissions").invoke(plugins[i]); } catch (Exception ex) { diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java index fdb740646..f109cf4f7 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java @@ -37,7 +37,7 @@ public class GMGroupEvent extends Event { protected Action action; public GMGroupEvent(Group group, Action action) { - super(action.toString()); + super(); this.group = group; this.action = action; @@ -45,7 +45,7 @@ public class GMGroupEvent extends Event { } public GMGroupEvent(String groupName, Action action) { - super(action.toString()); + super(); this.groupName = groupName; this.action = action; diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java index 1ff605d5c..6f4c0ea08 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java @@ -32,7 +32,7 @@ public class GMSystemEvent extends Event { protected Action action; public GMSystemEvent(Action action) { - super(action.toString()); + super(); this.action = action; } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java index d40a7d63e..543580f41 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java @@ -37,7 +37,7 @@ public class GMUserEvent extends Event { protected Action action; public GMUserEvent(User user, Action action) { - super(action.toString()); + super(); this.user = user; this.action = action; @@ -45,7 +45,7 @@ public class GMUserEvent extends Event { } public GMUserEvent(String userName, Action action) { - super(action.toString()); + super(); this.userName = userName; this.action = action; -- cgit v1.2.3 From c0df77153958bb3cbd3f07c5be305027440a773e Mon Sep 17 00:00:00 2001 From: ElgarL Date: Tue, 21 Feb 2012 18:38:08 +0000 Subject: Update for Bukkit R5 compatability. Removed some unused variables. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../src/org/anjocaido/groupmanager/events/GMGroupEvent.java | 1 - .../src/org/anjocaido/groupmanager/events/GMSystemEvent.java | 1 - .../src/org/anjocaido/groupmanager/events/GMUserEvent.java | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 31d40413f..0566ef676 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -141,4 +141,5 @@ v 1.9: - Change Service registration to register WorldsHolder instead of AnjoPermissionsHandler. This is the correct entry point for all data. - Depreciate PlayerTeleportEvent, PlayerRespawnEvent and PlayerPortalEvent as it's all handled in PlayerChangedWorldEvent. This also means we no longer update permissions before we change worlds. - - A command of '/manload' with no world arguments now performs a full reload of GM. \ No newline at end of file + - A command of '/manload' with no world arguments now performs a full reload of GM. + - Update for Bukkit R5 compatability. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java index f109cf4f7..fc9b8433b 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java @@ -16,7 +16,6 @@ public class GMGroupEvent extends Event { /** * */ - private static final long serialVersionUID = -5294917600434510451L; private static final HandlerList handlers = new HandlerList(); @Override diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java index 6f4c0ea08..210960876 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java @@ -15,7 +15,6 @@ public class GMSystemEvent extends Event { /** * */ - private static final long serialVersionUID = -8786811924448821548L; private static final HandlerList handlers = new HandlerList(); @Override diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java index 543580f41..206de8c86 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java @@ -16,7 +16,6 @@ public class GMUserEvent extends Event { /** * */ - private static final long serialVersionUID = -5294917600434510451L; private static final HandlerList handlers = new HandlerList(); @Override -- cgit v1.2.3 From 9c68cbae727f84a7b4dfb2594c458c3353a739d3 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Tue, 21 Feb 2012 18:40:54 +0000 Subject: Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- EssentialsGroupManager/src/config.yml | 4 ---- .../src/org/anjocaido/groupmanager/GMConfiguration.java | 3 --- 3 files changed, 2 insertions(+), 8 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 0566ef676..cb14c4e6e 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -142,4 +142,5 @@ v 1.9: - Depreciate PlayerTeleportEvent, PlayerRespawnEvent and PlayerPortalEvent as it's all handled in PlayerChangedWorldEvent. This also means we no longer update permissions before we change worlds. - A command of '/manload' with no world arguments now performs a full reload of GM. - - Update for Bukkit R5 compatability. \ No newline at end of file + - Update for Bukkit R5 compatability. + - Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes. \ No newline at end of file diff --git a/EssentialsGroupManager/src/config.yml b/EssentialsGroupManager/src/config.yml index 13b59d343..cc90bea6f 100644 --- a/EssentialsGroupManager/src/config.yml +++ b/EssentialsGroupManager/src/config.yml @@ -4,10 +4,6 @@ settings: # The user will be able to promote players to the same group or even above. opOverrides: true - # If enabled any bukkit permissiosn which default to true will be left enabled. - # If the player is op any permissions set to Op will follow suit. - bukkit_perms_override: true - # Default setting for 'mantoglevalidate' # true will cause GroupManager to attempt name matching by default. validate_toggle: true diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java index d830696e7..98ff075dd 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java @@ -57,9 +57,6 @@ public class GMConfiguration { public boolean isOpOverride() { return GMconfig.getBoolean("settings.config.opOverrides", true); } - public boolean isBukkitPermsOverride() { - return GMconfig.getBoolean("settings.config.bukkit_perms_override", false); - } public boolean isToggleValidate() { return GMconfig.getBoolean("settings.config.validate_toggle", true); } -- cgit v1.2.3 From fa49fc91d2454b2da193ed2b757356b2496d504c Mon Sep 17 00:00:00 2001 From: ElgarL Date: Sat, 25 Feb 2012 09:22:54 +0000 Subject: Prevent adding inheritances to globalgroups. These are permissions collections, not player groups. --- EssentialsGroupManager/src/Changelog.txt | 3 +- .../org/anjocaido/groupmanager/GroupManager.java | 10 +++ .../src/org/anjocaido/groupmanager/data/Group.java | 73 +++++++++++++--------- 3 files changed, 56 insertions(+), 30 deletions(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index cb14c4e6e..bb5cbf550 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -143,4 +143,5 @@ v 1.9: This also means we no longer update permissions before we change worlds. - A command of '/manload' with no world arguments now performs a full reload of GM. - Update for Bukkit R5 compatability. - - Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes. \ No newline at end of file + - Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes. + - Prevent adding inheritances to globalgroups. These are permissions collections, not player groups. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index d8d151200..3c39c24d7 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -1019,6 +1019,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group 2 does not exists!"); return false; } + if (auxGroup.isGlobal()) { + sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance."); + return false; + } + // VALIDANDO PERMISSAO if (permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " already inherits " + auxGroup2.getName() + " (might not be directly)"); @@ -1052,6 +1057,11 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group 2 does not exists!"); return false; } + if (auxGroup.isGlobal()) { + sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance."); + return false; + } + // VALIDANDO PERMISSAO if (!permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherits " + auxGroup2.getName() + "."); diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java index 5a39600b6..396240ec6 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java @@ -48,6 +48,15 @@ public class Group extends DataUnit implements Cloneable { public Group(String name) { super(name); } + + /** + * Is this a GlobalGroup + * + * @return + */ + public boolean isGlobal() { + return (getDataSource() == null); + } /** * Clone this group @@ -57,7 +66,7 @@ public class Group extends DataUnit implements Cloneable { public Group clone() { Group clone; - if (getDataSource() == null) { + if (isGlobal()) { clone = new Group(this.getName()); } else { clone = new Group(getDataSource(), this.getName()); @@ -85,7 +94,7 @@ public class Group extends DataUnit implements Cloneable { Group clone = dataSource.createGroup(this.getName()); // Don't add inheritance for GlobalGroups - if (getDataSource() != null) { + if (!isGlobal()) { clone.inherits = new ArrayList(this.getInherits()); } for (String perm : this.getPermissionList()) { @@ -110,26 +119,30 @@ public class Group extends DataUnit implements Cloneable { * @param inherit the inherits to set */ public void addInherits(Group inherit) { - if (!this.getDataSource().groupExists(inherit.getName())) { - getDataSource().addGroup(inherit); - } - if (!inherits.contains(inherit.getName().toLowerCase())) { - inherits.add(inherit.getName().toLowerCase()); - } - flagAsChanged(); - if (GroupManager.isLoaded()) { - GroupManager.BukkitPermissions.updateAllPlayers(); - GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED); - } + if (!isGlobal()) { + if (!this.getDataSource().groupExists(inherit.getName())) { + getDataSource().addGroup(inherit); + } + if (!inherits.contains(inherit.getName().toLowerCase())) { + inherits.add(inherit.getName().toLowerCase()); + } + flagAsChanged(); + if (GroupManager.isLoaded()) { + GroupManager.BukkitPermissions.updateAllPlayers(); + GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED); + } + } } public boolean removeInherits(String inherit) { - if (this.inherits.contains(inherit.toLowerCase())) { - this.inherits.remove(inherit.toLowerCase()); - flagAsChanged(); - GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED); - return true; - } + if (!isGlobal()) { + if (this.inherits.contains(inherit.toLowerCase())) { + this.inherits.remove(inherit.toLowerCase()); + flagAsChanged(); + GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED); + return true; + } + } return false; } @@ -145,15 +158,17 @@ public class Group extends DataUnit implements Cloneable { * @param varList */ public void setVariables(Map varList) { - GroupVariables temp = new GroupVariables(this, varList); - variables.clearVars(); - for (String key : temp.getVarKeyList()) { - variables.addVar(key, temp.getVarObject(key)); - } - flagAsChanged(); - if (GroupManager.isLoaded()) { - GroupManager.BukkitPermissions.updateAllPlayers(); - GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED); - } + if (!isGlobal()) { + GroupVariables temp = new GroupVariables(this, varList); + variables.clearVars(); + for (String key : temp.getVarKeyList()) { + variables.addVar(key, temp.getVarObject(key)); + } + flagAsChanged(); + if (GroupManager.isLoaded()) { + GroupManager.BukkitPermissions.updateAllPlayers(); + GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED); + } + } } } -- cgit v1.2.3 From 50bd5869bf18421918c6ef9f5ffe0fa46ccfb894 Mon Sep 17 00:00:00 2001 From: ElgarL Date: Sat, 25 Feb 2012 09:29:54 +0000 Subject: Prevent promoting players to, and demoting to GlobalGroups. --- EssentialsGroupManager/src/Changelog.txt | 3 ++- .../org/anjocaido/groupmanager/GroupManager.java | 28 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'EssentialsGroupManager/src') diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index bb5cbf550..1159607ed 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -144,4 +144,5 @@ v 1.9: - A command of '/manload' with no world arguments now performs a full reload of GM. - Update for Bukkit R5 compatability. - Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes. - - Prevent adding inheritances to globalgroups. These are permissions collections, not player groups. \ No newline at end of file + - Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups. + - Prevent promoting players to, and demoting to GlobalGroups. \ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index 3c39c24d7..b0d46ca1a 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -398,6 +398,10 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group not found!"); return false; } + if (auxGroup.isGlobal()) { + sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); + return false; + } // VALIDANDO PERMISSAO if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { @@ -1232,6 +1236,10 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group does not exists!"); return false; } + if (auxGroup.isGlobal()) { + sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); + return false; + } // VALIDANDO PERMISSAO // PARECE OK auxString = ""; @@ -1261,6 +1269,10 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group does not exists!"); return false; } + if (auxGroup.isGlobal()) { + sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); + return false; + } // VALIDANDO PERMISSAO if (!auxGroup.getVariables().hasVar(args[1])) { sender.sendMessage(ChatColor.RED + "The group doesn't have directly that variable!"); @@ -1286,6 +1298,10 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group does not exists!"); return false; } + if (auxGroup.isGlobal()) { + sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); + return false; + } // VALIDANDO PERMISSAO // PARECE OK auxString = ""; @@ -1323,6 +1339,10 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group does not exists!"); return false; } + if (auxGroup.isGlobal()) { + sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); + return false; + } // VALIDANDO PERMISSAO auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1], null); if (auxGroup2 == null) { @@ -1588,6 +1608,10 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group not found!"); return false; } + if (auxGroup.isGlobal()) { + sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); + return false; + } // VALIDANDO PERMISSAO if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); @@ -1644,6 +1668,10 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group not found!"); return false; } + if (auxGroup.isGlobal()) { + sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); + return false; + } // VALIDANDO PERMISSAO if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); -- cgit v1.2.3