Check if server supports ServerLoadEvent and if so register the listener, if not delay registration of placeholders for 15 seconds.

This commit is contained in:
extendedclip 2019-05-05 10:38:42 -04:00
parent 1e25f35aac
commit a741f35139

View File

@ -132,6 +132,18 @@ public class PlaceholderAPIPlugin extends JavaPlugin {
setupOptions(); setupOptions();
getCommand("placeholderapi").setExecutor(new PlaceholderAPICommands(this)); getCommand("placeholderapi").setExecutor(new PlaceholderAPICommands(this));
new PlaceholderListener(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()) { if (config.checkUpdates()) {
new UpdateChecker(this).fetch(); new UpdateChecker(this).fetch();
} }