From 16d0a4f690702abec81b1cf1201d1e820b95517e Mon Sep 17 00:00:00 2001 From: extendedclip Date: Sat, 4 May 2019 19:56:59 -0400 Subject: [PATCH] Register expansions in the ServerLoadEvent which is called after the server startup process is complete. Fixes #103 --- .../java/me/clip/placeholderapi/PlaceholderAPIPlugin.java | 2 -- .../java/me/clip/placeholderapi/PlaceholderListener.java | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java index 834c616..07aaf25 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java @@ -132,8 +132,6 @@ public class PlaceholderAPIPlugin extends JavaPlugin { setupOptions(); getCommand("placeholderapi").setExecutor(new PlaceholderAPICommands(this)); new PlaceholderListener(this); - getLogger().info("Placeholder expansion registration initializing..."); - expansionManager.registerAllExpansions(); if (config.checkUpdates()) { new UpdateChecker(this).fetch(); } diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderListener.java b/src/main/java/me/clip/placeholderapi/PlaceholderListener.java index f4b6505..1edcde8 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderListener.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderListener.java @@ -39,6 +39,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginEnableEvent; +import org.bukkit.event.server.ServerLoadEvent; public class PlaceholderListener implements Listener { @@ -50,6 +51,12 @@ public class PlaceholderListener implements Listener { Bukkit.getPluginManager().registerEvents(this, instance); } + @EventHandler + public void onServerLoad(ServerLoadEvent e) { + plugin.getLogger().info("Placeholder expansion registration initializing..."); + plugin.getExpansionManager().registerAllExpansions(); + } + @EventHandler public void onExpansionUnregister(ExpansionUnregisterEvent event) {