Changed placeholders to register 1 tick after server startup.

This commit is contained in:
darbyjack 2019-05-08 15:04:46 -05:00
parent fc1a2af011
commit 9a2fb89e43
No known key found for this signature in database
GPG Key ID: 392E68B2FE0ED3E5
2 changed files with 9 additions and 12 deletions

View File

@ -6,7 +6,7 @@
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.10.1</version>
<version>2.10.1-DEV-${BUILD_NUMBER}</version>
<name>PlaceholderAPI</name>
<description>An awesome placeholder provider!</description>
<url>http://extendedclip.com</url>

View File

@ -137,18 +137,15 @@ public class PlaceholderAPIPlugin extends JavaPlugin {
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...");
//fetch any hooks that may have registered externally onEnable first otherwise they will be lost
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
getExpansionManager().registerAllExpansions();
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
alreadyRegistered.entrySet().stream().forEach(hook -> PlaceholderAPI.registerPlaceholderHook(hook.getKey(), hook.getValue()));
}
Bukkit.getScheduler().runTaskLater(this, () -> {
getLogger().info("Placeholder expansion registration initializing...");
//fetch any hooks that may have registered externally onEnable first otherwise they will be lost
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
getExpansionManager().registerAllExpansions();
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
alreadyRegistered.forEach(PlaceholderAPI::registerPlaceholderHook);
}
}, 20*15);
}, 1);
}
if (config.checkUpdates()) {
new UpdateChecker(this).fetch();