Added some javadoc in PlaceholdersManager

This commit is contained in:
Florian CUNY 2018-11-02 15:44:36 +01:00
parent 1571d8d033
commit dcd8a4ea28

View File

@ -5,6 +5,11 @@ import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;
import world.bentobox.bentobox.hooks.PlaceholderAPIHook;
/**
* Manages placeholder integration.
*
* @author Poslovitch
*/
public class PlaceholdersManager {
private BentoBox plugin;
@ -13,6 +18,11 @@ public class PlaceholdersManager {
this.plugin = plugin;
}
/**
* Registers the placeholder on the behalf on BentoBox.
* @param placeholder the placeholder to register. It will be appended with {@code "bentobox_"} by the placeholder plugin.
* @param replacer the expression that will return a {@code String} when executed, which will replace the placeholder.
*/
public void registerPlaceholder(String placeholder, PlaceholderReplacer replacer) {
// Register it in PlaceholderAPI
plugin.getHooks().getHook("PlaceholderAPI").ifPresent(hook -> {
@ -21,6 +31,11 @@ public class PlaceholdersManager {
});
}
/**
* Registers the placeholder on the behalf of the specified addon.
* @param placeholder the placeholder to register. It will be appended with the addon's name by the placeholder plugin.
* @param replacer the expression that will return a {@code String} when executed, which will replace the placeholder.
*/
public void registerPlaceholder(Addon addon, String placeholder, PlaceholderReplacer replacer) {
if (addon == null) {
registerPlaceholder(placeholder, replacer);