mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-09-06 05:17:05 +02:00
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:
@@ -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();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user