Register expansions in the ServerLoadEvent which is called after the server startup process is complete.

Fixes #103
This commit is contained in:
extendedclip 2019-05-04 19:56:59 -04:00
parent 8f600aec25
commit 16d0a4f690
2 changed files with 7 additions and 2 deletions

View File

@ -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();
}

View File

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