From 927f942236a57ded9b9113f401e6234ea970c6ae Mon Sep 17 00:00:00 2001 From: darbyjack Date: Mon, 6 May 2019 09:05:19 -0500 Subject: [PATCH 1/2] Print out console warnings for the plugins still using EzPlaceholderHook --- .../placeholderapi/PlaceholderAPIPlugin.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java index 48fd4e4..20262a8 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java @@ -30,6 +30,7 @@ import me.clip.placeholderapi.expansion.ExpansionManager; import me.clip.placeholderapi.expansion.PlaceholderExpansion; import me.clip.placeholderapi.expansion.Version; import me.clip.placeholderapi.expansion.cloud.ExpansionCloudManager; +import me.clip.placeholderapi.external.EZPlaceholderHook; import me.clip.placeholderapi.updatechecker.UpdateChecker; import me.clip.placeholderapi.util.TimeUtil; import org.bstats.bukkit.Metrics; @@ -158,6 +159,7 @@ public class PlaceholderAPIPlugin extends JavaPlugin { enableCloud(); } setupMetrics(); + getServer().getScheduler().runTaskLater(this, this::checkHook, 20 * 30); } @Override @@ -186,6 +188,22 @@ public class PlaceholderAPIPlugin extends JavaPlugin { + " &aplaceholder hooks successfully registered!")); } + private void checkHook() { + Map loaded = PlaceholderAPI.getPlaceholders(); + loaded.values().forEach(h -> { + if (h instanceof EZPlaceholderHook) { + String author; + try { + author = Bukkit.getPluginManager().getPlugin(((EZPlaceholderHook) h).getPluginName()).getDescription().getAuthors().toString(); + } catch (Exception ex) { + author = "the author of the hook's plugin"; + } + getLogger().warning(((EZPlaceholderHook) h).getPluginName() + " is currently using a deprecated method to hook into PlaceholderAPI. This will be disabled after the next update. " + + "Please consult {author} and urge them to update it ASAP.".replace("{author}", author)); + } + }); + } + private void setupOptions() { booleanTrue = config.booleanTrue(); if (booleanTrue == null) { From 9b317c221078f1f1a7caff9fd0b1d5c9f2648a5e Mon Sep 17 00:00:00 2001 From: Mitchell Cook Date: Tue, 7 May 2019 06:21:15 +1000 Subject: [PATCH 2/2] Someone forgot how to use lambdas properly (#111) --- .../java/me/clip/placeholderapi/PlaceholderAPIPlugin.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java index 20262a8..4f5d69e 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java @@ -145,9 +145,7 @@ public class PlaceholderAPIPlugin extends JavaPlugin { final Map alreadyRegistered = PlaceholderAPI.getPlaceholders(); getExpansionManager().registerAllExpansions(); if (alreadyRegistered != null && !alreadyRegistered.isEmpty()) { - alreadyRegistered.entrySet().stream().forEach(hook -> { - PlaceholderAPI.registerPlaceholderHook(hook.getKey(), hook.getValue()); - }); + alreadyRegistered.entrySet().stream().forEach(hook -> PlaceholderAPI.registerPlaceholderHook(hook.getKey(), hook.getValue())); } } }, 20*15);