From 86a1fe862f3968a5a26f764b51c3255385b852e6 Mon Sep 17 00:00:00 2001 From: extendedclip Date: Wed, 13 Jun 2018 12:50:01 -0400 Subject: [PATCH] New method supporting offlinePlayer renamed to onRequest --- .../me/clip/placeholderapi/PlaceholderAPI.java | 2 +- .../me/clip/placeholderapi/PlaceholderHook.java | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java b/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java index e4cbdbe..cea175b 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderAPI.java @@ -232,7 +232,7 @@ public class PlaceholderAPI { String identifier = format.substring(0, index).toLowerCase(); String params = format.substring(index + 1); if (hooks.containsKey(identifier)) { - String value = hooks.get(identifier).onPlaceholderRequest(player, params); + String value = hooks.get(identifier).onRequest(player, params); if (value != null) { text = text.replaceAll(Pattern.quote(m.group()), Matcher.quoteReplacement(value)); } diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderHook.java b/src/main/java/me/clip/placeholderapi/PlaceholderHook.java index 161898e..854dbfc 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderHook.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderHook.java @@ -26,22 +26,24 @@ import org.bukkit.entity.Player; public abstract class PlaceholderHook { /** - * called when a placeholder is requested from this hook + * called when a placeholder value is requested from this hook * @param p {@link OfflinePlayer} to request the placeholder value for, null if not needed for a player * @param params String passed to the hook to determine what value to return * @return value for the requested player and params */ - public String onPlaceholderRequest(OfflinePlayer p, String params) { + public String onRequest(OfflinePlayer p, String params) { if (p != null && p.isOnline()) { return onPlaceholderRequest((Player) p, params); } return onPlaceholderRequest(null, params); } - /** - * @deprecated As of versions greater than 2.8.7, use {@link #onPlaceholderRequest(OfflinePlayer p, String params)} - */ - @Deprecated + /** + * called when a placeholder is requested from this hook + * @param p {@link Player} to request the placeholder value for, null if not needed for a player + * @param params String passed to the hook to determine what value to return + * @return value for the requested player and params + */ public String onPlaceholderRequest(Player p, String params) { return null; }