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> <groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId> <artifactId>placeholderapi</artifactId>
<version>2.10.1</version> <version>2.10.1-DEV-${BUILD_NUMBER}</version>
<name>PlaceholderAPI</name> <name>PlaceholderAPI</name>
<description>An awesome placeholder provider!</description> <description>An awesome placeholder provider!</description>
<url>http://extendedclip.com</url> <url>http://extendedclip.com</url>

View File

@ -137,18 +137,15 @@ public class PlaceholderAPIPlugin extends JavaPlugin {
Class.forName("org.bukkit.event.server.ServerLoadEvent"); Class.forName("org.bukkit.event.server.ServerLoadEvent");
new ServerLoadEventListener(this); new ServerLoadEventListener(this);
} catch (ExceptionInInitializerError | ClassNotFoundException exception) { } catch (ExceptionInInitializerError | ClassNotFoundException exception) {
Bukkit.getScheduler().runTaskLater(this, new Runnable() { Bukkit.getScheduler().runTaskLater(this, () -> {
@Override
public void run() {
getLogger().info("Placeholder expansion registration initializing..."); getLogger().info("Placeholder expansion registration initializing...");
//fetch any hooks that may have registered externally onEnable first otherwise they will be lost //fetch any hooks that may have registered externally onEnable first otherwise they will be lost
final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders(); final Map<String, PlaceholderHook> alreadyRegistered = PlaceholderAPI.getPlaceholders();
getExpansionManager().registerAllExpansions(); getExpansionManager().registerAllExpansions();
if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) { if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) {
alreadyRegistered.entrySet().stream().forEach(hook -> PlaceholderAPI.registerPlaceholderHook(hook.getKey(), hook.getValue())); alreadyRegistered.forEach(PlaceholderAPI::registerPlaceholderHook);
} }
} }, 1);
}, 20*15);
} }
if (config.checkUpdates()) { if (config.checkUpdates()) {
new UpdateChecker(this).fetch(); new UpdateChecker(this).fetch();