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') 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