mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
New method supporting offlinePlayer renamed to onRequest
This commit is contained in:
parent
eba181d04d
commit
86a1fe862f
@ -232,7 +232,7 @@ public class PlaceholderAPI {
|
|||||||
String identifier = format.substring(0, index).toLowerCase();
|
String identifier = format.substring(0, index).toLowerCase();
|
||||||
String params = format.substring(index + 1);
|
String params = format.substring(index + 1);
|
||||||
if (hooks.containsKey(identifier)) {
|
if (hooks.containsKey(identifier)) {
|
||||||
String value = hooks.get(identifier).onPlaceholderRequest(player, params);
|
String value = hooks.get(identifier).onRequest(player, params);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
text = text.replaceAll(Pattern.quote(m.group()), Matcher.quoteReplacement(value));
|
text = text.replaceAll(Pattern.quote(m.group()), Matcher.quoteReplacement(value));
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,12 @@ import org.bukkit.entity.Player;
|
|||||||
public abstract class PlaceholderHook {
|
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 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
|
* @param params String passed to the hook to determine what value to return
|
||||||
* @return value for the requested player and params
|
* @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()) {
|
if (p != null && p.isOnline()) {
|
||||||
return onPlaceholderRequest((Player) p, params);
|
return onPlaceholderRequest((Player) p, params);
|
||||||
}
|
}
|
||||||
@ -39,9 +39,11 @@ public abstract class PlaceholderHook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated As of versions greater than 2.8.7, use {@link #onPlaceholderRequest(OfflinePlayer p, String params)}
|
* 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
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public String onPlaceholderRequest(Player p, String params) {
|
public String onPlaceholderRequest(Player p, String params) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user