Skip to content

Commit

Permalink
Added some javadoc in PlaceholdersManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Poslovitch committed Nov 2, 2018
1 parent 1571d8d commit dcd8a4e
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;
import world.bentobox.bentobox.hooks.PlaceholderAPIHook;

/**
* Manages placeholder integration.
*
* @author Poslovitch
*/
public class PlaceholdersManager {

private BentoBox plugin;
Expand All @@ -13,6 +18,11 @@ public PlaceholdersManager(BentoBox plugin) {
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 -> {
Expand All @@ -21,6 +31,11 @@ public void registerPlaceholder(String placeholder, PlaceholderReplacer replacer
});
}

/**
* 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);
Expand Down

0 comments on commit dcd8a4e

Please sign in to comment.