From a741f35139272292c96090743697f64f8a6105e4 Mon Sep 17 00:00:00 2001 From: extendedclip Date: Sun, 5 May 2019 10:38:42 -0400 Subject: [PATCH] Check if server supports ServerLoadEvent and if so register the listener, if not delay registration of placeholders for 15 seconds. --- .../me/clip/placeholderapi/PlaceholderAPIPlugin.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java index bcd163e..258ca3b 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java @@ -132,6 +132,18 @@ public class PlaceholderAPIPlugin extends JavaPlugin { setupOptions(); getCommand("placeholderapi").setExecutor(new PlaceholderAPICommands(this)); new PlaceholderListener(this); + try { + Class.forName("org.bukkit.event.server.ServerLoadEvent"); + new ServerLoadEventListener(this); + } catch (ExceptionInInitializerError | ClassNotFoundException exception) { + Bukkit.getScheduler().runTaskLater(this, new Runnable() { + @Override + public void run() { + getLogger().info("Placeholder expansion registration initializing..."); + getExpansionManager().registerAllExpansions(); + } + }, 20*15); + } if (config.checkUpdates()) { new UpdateChecker(this).fetch(); }