diff options
Diffstat (limited to 'EssentialsGroupManager')
3 files changed, 15 insertions, 4 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 371f935f9..5523f524e 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -31,4 +31,5 @@ v 1.2: (one op will not be able to alter another op's settings)
- GM will now create all relevant world data files for non mirrored worlds.
(for all worlds named in config.yml)
- - Attempt to stop GM wiping groups/users yml's on a bad shut down.
\ No newline at end of file + - Attempt to stop GM wiping groups/users yml's on a bad shut down.
+ - Added event handling to manage new world creation at runtime.
\ 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 29c688da5..5f3e9e347 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -24,6 +24,7 @@ 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.GMWorldListener; import org.anjocaido.groupmanager.utils.GMLoggerHandler; import org.anjocaido.groupmanager.utils.PermissionCheckResult; import org.anjocaido.groupmanager.utils.Tasks; @@ -32,9 +33,12 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.world.WorldListener; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; + @SuppressWarnings("unused") /** * @@ -55,6 +59,7 @@ public class GroupManager extends JavaPlugin { private GMConfiguration config; private GMLoggerHandler ch; public static BukkitPermissions BukkitPermissions; + private WorldListener WorldEvents; public static final Logger logger = Logger.getLogger(GroupManager.class.getName()); //PERMISSIONS FOR COMMAND BEING LOADED @@ -94,8 +99,12 @@ public class GroupManager extends JavaPlugin { throw new IllegalStateException("An error ocurred while loading GroupManager"); } + // Setup the world listener and bukkit permissions to handle events. + WorldEvents = new GMWorldListener(this); BukkitPermissions = new BukkitPermissions(this); - + + this.getServer().getPluginManager().registerEvent(Event.Type.WORLD_INIT, WorldEvents, Event.Priority.Lowest, this); + enableScheduler(); /* @@ -111,6 +120,8 @@ public class GroupManager extends JavaPlugin { //setLoaded(true); System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!"); } + + public static boolean isLoaded() { return isLoaded; diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index eb972c481..a5e76e464 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -22,7 +22,6 @@ import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder; import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler; import org.anjocaido.groupmanager.utils.Tasks; import org.bukkit.entity.Player; -import org.bukkit.util.config.ConfigurationNode; /** * @@ -275,7 +274,7 @@ public class WorldsHolder { } - private void setupWorldFolder(String worldName) { + public void setupWorldFolder(String worldName) { worldsFolder = new File(plugin.getDataFolder(), "worlds"); if (!worldsFolder.exists()) { worldsFolder.mkdirs(); |