diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-06-22 17:46:12 +0100 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-06-22 18:27:51 +0100 |
commit | d647e2098eb48c51fff9d200be1d71b94b2ade6b (patch) | |
tree | 19c6f5714accd8e9f3a8a831b26c1af6338e0a2a /src/main/java/org | |
parent | ff67eda4c4d1018dd956010918645cecd35c2854 (diff) | |
download | craftbukkit-d647e2098eb48c51fff9d200be1d71b94b2ade6b.tar craftbukkit-d647e2098eb48c51fff9d200be1d71b94b2ade6b.tar.gz craftbukkit-d647e2098eb48c51fff9d200be1d71b94b2ade6b.tar.lz craftbukkit-d647e2098eb48c51fff9d200be1d71b94b2ade6b.tar.xz craftbukkit-d647e2098eb48c51fff9d200be1d71b94b2ade6b.zip |
Implemented startup plugin loading
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftServer.java | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 1da14352..a7cc8e4c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -58,6 +58,7 @@ import org.bukkit.craftbukkit.command.ServerCommandListener; import org.bukkit.scheduler.BukkitWorker; import org.bukkit.craftbukkit.scheduler.CraftScheduler; import org.bukkit.event.world.WorldInitEvent; +import org.bukkit.plugin.PluginLoadOrder; import org.bukkit.util.config.Configuration; import org.bukkit.util.config.ConfigurationNode; @@ -87,6 +88,8 @@ public final class CraftServer implements Server { configuration.load(); loadConfigDefaults(); configuration.save(); + loadPlugins(); + enablePlugins(PluginLoadOrder.STARTUP); } private void loadConfigDefaults() { @@ -110,20 +113,13 @@ public final class CraftServer implements Server { File pluginFolder = (File) console.options.valueOf("plugins"); if (pluginFolder.exists()) { - try { - Plugin[] plugins = pluginManager.loadPlugins(pluginFolder); - for (Plugin plugin : plugins) { - try { - plugin.onLoad(); - } catch (Throwable ex) { - Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " initializing " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); - } + Plugin[] plugins = pluginManager.loadPlugins(pluginFolder); + for (Plugin plugin : plugins) { + try { + plugin.onLoad(); + } catch (Throwable ex) { + Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " initializing " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); } - for (Plugin plugin : plugins) { - loadPlugin(plugin); - } - } catch (Throwable ex) { - Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " (Is it up to date?)", ex); } } else { pluginFolder.mkdir(); @@ -132,6 +128,15 @@ public final class CraftServer implements Server { commandMap.registerServerAliases(); } + public void enablePlugins(PluginLoadOrder type) { + Plugin[] plugins = pluginManager.getPlugins(); + for (Plugin plugin : plugins) { + if ((!plugin.isEnabled()) && (plugin.getDescription().getLoad() == type)) { + loadPlugin(plugin); + } + } + } + public void disablePlugins() { pluginManager.disablePlugins(); } @@ -349,6 +354,8 @@ public final class CraftServer implements Server { )); } loadPlugins(); + enablePlugins(PluginLoadOrder.STARTUP); + enablePlugins(PluginLoadOrder.POSTWORLD); } @Override |