diff options
author | ElgarL <ElgarL@palmergames.com> | 2011-10-01 17:06:14 +0100 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2011-10-01 17:06:14 +0100 |
commit | d2c02569d06657d9d67159df6e45c6a11154e668 (patch) | |
tree | 28c38986556e23ecf897af7d5859296ea6379c0b /EssentialsGroupManager/src/org | |
parent | 1f6daa7424d836a1f1b1c7a76ac10611b5bde349 (diff) | |
download | Essentials-d2c02569d06657d9d67159df6e45c6a11154e668.tar Essentials-d2c02569d06657d9d67159df6e45c6a11154e668.tar.gz Essentials-d2c02569d06657d9d67159df6e45c6a11154e668.tar.lz Essentials-d2c02569d06657d9d67159df6e45c6a11154e668.tar.xz Essentials-d2c02569d06657d9d67159df6e45c6a11154e668.zip |
Added event handling to manage new world creation at runtime.
Diffstat (limited to 'EssentialsGroupManager/src/org')
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java | 13 | ||||
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java | 3 |
2 files changed, 13 insertions, 3 deletions
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(); |