Class PlaceholderManager

java.lang.Object
dev.magicmq.pyspigot.bukkit.manager.placeholder.PlaceholderManager

public class PlaceholderManager extends Object
Manager to interface with PlaceholderAPI. Primarily used by scripts to register and unregister placeholder expansions.

Do not call this manager if PlaceholderAPI is not loaded and enabled on the server! It will not work.

  • Method Details

    • registerPlaceholder

      public ScriptPlaceholder registerPlaceholder(PyFunction placeholderFunction)
      Register a new script placeholder expansion.

      If you want to register a relational placeholder expansion, see registerPlaceholder(PyFunction, PyFunction)

      Note: This should be called from scripts only!

      Parameters:
      placeholderFunction - The function that should be called when the placeholder is used
      Returns:
      A ScriptPlaceholder representing the placeholder expansion that was registered
    • registerPlaceholder

      public ScriptPlaceholder registerPlaceholder(PyFunction placeholderFunction, PyFunction relPlaceholderFunction)
      Register a new script placeholder expansion, including relational placeholders.

      Note: This should be called from scripts only!

      Parameters:
      placeholderFunction - The function that should be called when the placeholder is used
      relPlaceholderFunction - The function that should be called when the relational placeholder
      Returns:
      A ScriptPlaceholder representing the placeholder expansion that was registered
    • registerPlaceholder

      public ScriptPlaceholder registerPlaceholder(PyFunction placeholderFunction, String author, String version)
      Register a new script placeholder expansion.

      If you want to register a relational placeholder expansion, see registerPlaceholder(PyFunction, PyFunction, String, String)

      Note: This should be called from scripts only!

      Parameters:
      placeholderFunction - The function that should be called when the placeholder is used
      author - The author of the placeholder
      version - The version of the placeholder
      Returns:
      A ScriptPlaceholder representing the placeholder expansion that was registered
    • registerPlaceholder

      public ScriptPlaceholder registerPlaceholder(PyFunction placeholderFunction, PyFunction relPlaceholderFunction, String author, String version)
      Register a new script placeholder expansion, including relational placeholders.

      Note: This should be called from scripts only!

      Parameters:
      placeholderFunction - The function that should be called when the placeholder is used
      relPlaceholderFunction - The function that should be called when the relational placeholder
      author - The author of the placeholder
      version - The version of the placeholder
      Returns:
      A ScriptPlaceholder representing the placeholder expansion that was registered
    • unregisterPlaceholder

      public void unregisterPlaceholder(ScriptPlaceholder placeholder)
      Unregister a script placeholder expansion.

      Note: This should be called from scripts only!

      Parameters:
      placeholder - The placeholder expansion to unregister
    • unregisterPlaceholder

      public void unregisterPlaceholder(dev.magicmq.pyspigot.manager.script.Script script)
      Unregister a script's placeholder expansion.

      Similar to unregisterPlaceholder(ScriptPlaceholder), except this method can be called from outside a script to unregister a script's placeholder expansion (for example when the script is unloaded and stopped).

      Parameters:
      script - The script whose placeholder should be unregistered
    • getPlaceholder

      public ScriptPlaceholder getPlaceholder(dev.magicmq.pyspigot.manager.script.Script script)
      Get a script's placeholder expansion.
      Parameters:
      script - The script to get the placeholder expansion from
      Returns:
      The script's placeholder expansion, or null if the script does not have a placeholder expansion registered
    • get

      public static PlaceholderManager get()
      Get the singleton instance of this PlaceholderManager.
      Returns:
      The instance