diff options
author | snowleo <schneeleo@gmail.com> | 2012-02-21 17:34:45 +0100 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2012-02-21 17:34:45 +0100 |
commit | 7c270b0b5a2aae21348223c23272e39c87eb7312 (patch) | |
tree | f1f5757137c41b847c9a337a1c9062834638dff2 /EssentialsGroupManager | |
parent | 406295a5488f8b105325b7c8c918f257f484d911 (diff) | |
parent | b70ac290332cdf94798c1ec02e29accfbbe41f25 (diff) | |
download | Essentials-7c270b0b5a2aae21348223c23272e39c87eb7312.tar Essentials-7c270b0b5a2aae21348223c23272e39c87eb7312.tar.gz Essentials-7c270b0b5a2aae21348223c23272e39c87eb7312.tar.lz Essentials-7c270b0b5a2aae21348223c23272e39c87eb7312.tar.xz Essentials-7c270b0b5a2aae21348223c23272e39c87eb7312.zip |
Merge branch 'refs/heads/groupmanager'
Diffstat (limited to 'EssentialsGroupManager')
3 files changed, 32 insertions, 57 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index b79d56d07..31d40413f 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -138,4 +138,7 @@ 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, 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 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) { diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index 1409f774d..0b6148900 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -37,10 +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.player.PlayerTeleportEvent;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.permissions.Permission;
@@ -346,6 +343,12 @@ public class BukkitPermissions { this.updatePermissions(player, null);
}
+ /**
+ * Player events tracked to cause Superperms updates
+ *
+ * @author ElgarL
+ *
+ */
protected class PlayerEvents implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
@@ -361,30 +364,11 @@ 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());
}
@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 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())
return;
|