From 9a2fb89e431fd90f2a5b6a46ed4983db71356e99 Mon Sep 17 00:00:00 2001 From: darbyjack Date: Wed, 8 May 2019 15:04:46 -0500 Subject: [PATCH] Changed placeholders to register 1 tick after server startup. --- pom.xml | 2 +- .../placeholderapi/PlaceholderAPIPlugin.java | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index becc849..8b3ce52 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.clip placeholderapi - 2.10.1 + 2.10.1-DEV-${BUILD_NUMBER} PlaceholderAPI An awesome placeholder provider! http://extendedclip.com diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java index 4f5d69e..1f1573c 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java @@ -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 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 alreadyRegistered = PlaceholderAPI.getPlaceholders(); + getExpansionManager().registerAllExpansions(); + if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) { + alreadyRegistered.forEach(PlaceholderAPI::registerPlaceholderHook); } - }, 20*15); + }, 1); } if (config.checkUpdates()) { new UpdateChecker(this).fetch();