Merge branch 'refs/heads/groupmanager'

This commit is contained in:
snowleo 2012-02-21 17:34:45 +01:00
commit cf7da7a83f
3 changed files with 32 additions and 57 deletions

View File

@ -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.
- 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.

View File

@ -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) {

View File

@ -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,29 +364,10 @@ 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())