diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java index 72d803a..d94b1b9 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderAPIPlugin.java @@ -149,8 +149,8 @@ public class PlaceholderAPIPlugin extends JavaPlugin { for (PlaceholderHook hook : p.values()) { if (hook instanceof PlaceholderExpansion) { PlaceholderExpansion ex = (PlaceholderExpansion) hook; - map.put(ex.getPlugin() == null ? ex.getIdentifier() - : ex.getPlugin(), 1); + map.put(ex.getRequiredPlugin() == null ? ex.getIdentifier() + : ex.getRequiredPlugin(), 1); } } } diff --git a/src/main/java/me/clip/placeholderapi/PlaceholderListener.java b/src/main/java/me/clip/placeholderapi/PlaceholderListener.java index 5cb8391..bcfcacd 100644 --- a/src/main/java/me/clip/placeholderapi/PlaceholderListener.java +++ b/src/main/java/me/clip/placeholderapi/PlaceholderListener.java @@ -80,7 +80,7 @@ public class PlaceholderListener implements Listener { PlaceholderExpansion e = m.getCachedExpansion(event.getPlugin().getName().toLowerCase()); if (e != null && e.canRegister()) { if (e.isRegistered() || m.registerExpansion(e)) { - m.removeCachedExpansion(e.getPlugin()); + m.removeCachedExpansion(e.getRequiredPlugin()); } } } @@ -122,11 +122,11 @@ public class PlaceholderListener implements Listener { PlaceholderExpansion ex = (PlaceholderExpansion) i; - if (ex.getPlugin() == null) { + if (ex.getRequiredPlugin() == null) { continue; } - if (ex.getPlugin().equalsIgnoreCase(n)) { + if (ex.getRequiredPlugin().equalsIgnoreCase(n)) { if (PlaceholderAPI.unregisterExpansion(ex)) { plugin.getLogger().info("Unregistered placeholder expansion: " + ex.getIdentifier()); } diff --git a/src/main/java/me/clip/placeholderapi/commands/PlaceholderAPICommands.java b/src/main/java/me/clip/placeholderapi/commands/PlaceholderAPICommands.java index 2328186..097cc91 100644 --- a/src/main/java/me/clip/placeholderapi/commands/PlaceholderAPICommands.java +++ b/src/main/java/me/clip/placeholderapi/commands/PlaceholderAPICommands.java @@ -155,16 +155,8 @@ public class PlaceholderAPICommands implements CommandExecutor { Msg.msg(s, "&7Version: &f" + ex.getVersion()); } - if (ex.getDescription() != null) { - Msg.msg(s, ex.getDescription()); - } - - if (ex.getLink() != null) { - Msg.msg(s, "&7Link: &f" + ex.getLink()); - } - - if (ex.getPlugin() != null) { - Msg.msg(s, "&7Requires plugin: &f" + ex.getPlugin()); + if (ex.getRequiredPlugin() != null) { + Msg.msg(s, "&7Requires plugin: &f" + ex.getRequiredPlugin()); } if (ex.getPlaceholders() != null) { diff --git a/src/main/java/me/clip/placeholderapi/expansion/ExpansionManager.java b/src/main/java/me/clip/placeholderapi/expansion/ExpansionManager.java index fb41003..5040d86 100644 --- a/src/main/java/me/clip/placeholderapi/expansion/ExpansionManager.java +++ b/src/main/java/me/clip/placeholderapi/expansion/ExpansionManager.java @@ -116,16 +116,13 @@ public final class ExpansionManager { } if (!c.canRegister()) { - if (c.getPlugin() != null) { - cache.put(c.getPlugin().toLowerCase(), c); + if (c.getRequiredPlugin() != null) { + cache.put(c.getRequiredPlugin().toLowerCase(), c); } return false; } if (!c.register()) { - if (c.getPlugin() != null) { - cache.put(c.getPlugin().toLowerCase(), c); - } return false; } diff --git a/src/main/java/me/clip/placeholderapi/expansion/PlaceholderExpansion.java b/src/main/java/me/clip/placeholderapi/expansion/PlaceholderExpansion.java index cd57cb6..6835cbc 100644 --- a/src/main/java/me/clip/placeholderapi/expansion/PlaceholderExpansion.java +++ b/src/main/java/me/clip/placeholderapi/expansion/PlaceholderExpansion.java @@ -33,52 +33,51 @@ public abstract class PlaceholderExpansion extends PlaceholderHook { /** * The name of this expansion - * @return identifier used for expansion if no name present + * @return {@link #getIdentifier()} by default, name of this expansion if specified */ public String getName() { return getIdentifier(); } /** - * Get the identifier that this placeholder expansion uses to be passed placeholder requests - * @return placeholder identifier that is associated with this class + * The placeholder identifier of this expanion + * @return placeholder identifier that is associated with this expansion */ public abstract String getIdentifier(); /** - * Get the plugin that this expansion hooks into. - * This will ensure the expansion is added to a cache if canRegister() returns false - * get. - * The expansion will be removed from the cache - * once a plugin loads with the name that is here and the expansion is registered - * @return placeholder identifier that is associated with this class - */ - public abstract String getPlugin(); - - /** - * Get the author of this PlaceholderExpansion + * The author of this expansion * @return name of the author for this expansion */ public abstract String getAuthor(); /** - * Get the version of this PlaceholderExpansion + * The version of this expansion * @return current version of this expansion */ public abstract String getVersion(); - public String getDescription() { return null; } + /** + * The name plugin that this expansion hooks into. + * by default will return the deprecated {@link #getPlugin()} method + * @return plugin name that this expansion requires to function + */ + public String getRequiredPlugin() { + return getPlugin(); + } - public String getLink() { return null; } - - public List getPlaceholders() { - return null; - } + /** + * The placeholders for this expansion + * @return placeholders that this expansion provides + */ + public List getPlaceholders() { + return null; + } /** * Expansions that do not use the ecloud and instead register from the dependency should set this to true * to ensure that your placeholder expansion is not unregistered when the papi reload command is used - * @return if the expansion should persist through reloads + * @return if the expansion should persist through placeholder reloads */ public boolean persist() { return false; @@ -98,7 +97,7 @@ public abstract class PlaceholderExpansion extends PlaceholderHook { * @return true if this hook meets all the requirements to register */ public boolean canRegister() { - return getPlugin() == null || Bukkit.getPluginManager().getPlugin(getPlugin()) != null; + return getRequiredPlugin() == null || Bukkit.getPluginManager().getPlugin(getRequiredPlugin()) != null; } /** @@ -153,4 +152,25 @@ public abstract class PlaceholderExpansion extends PlaceholderHook { public boolean configurationContains(String path) { return getPlaceholderAPI().getConfig().contains("expansions." + getIdentifier() + "." + path); } + + + /** + * @deprecated As of versions greater than 2.8.7, use {@link #getRequiredPlugin()} + */ + @Deprecated + public String getPlugin() { + return null; + } + + /** + * @deprecated As of versions greater than 2.8.7, use the expansion cloud to show a description + */ + @Deprecated + public String getDescription() { return null; } + + /** + * @deprecated As of versions greater than 2.8.7, use the expansion cloud to display a link + */ + @Deprecated + public String getLink() { return null; } } \ No newline at end of file