Class PlaceholderManager
Do not call this manager if PlaceholderAPI is not loaded and enabled on the server! It will not work.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PlaceholderManagerget()Get the singleton instance of this PlaceholderManager.getPlaceholder(dev.magicmq.pyspigot.manager.script.Script script) Get a script's placeholder expansion.registerPlaceholder(PyFunction placeholderFunction) Register a new script placeholder expansion.registerPlaceholder(PyFunction placeholderFunction, String author, String version) Register a new script placeholder expansion.registerPlaceholder(PyFunction placeholderFunction, PyFunction relPlaceholderFunction) Register a new script placeholder expansion, including relational placeholders.registerPlaceholder(PyFunction placeholderFunction, PyFunction relPlaceholderFunction, String author, String version) Register a new script placeholder expansion, including relational placeholders.voidunregisterPlaceholder(ScriptPlaceholder placeholder) Unregister a script placeholder expansion.voidunregisterPlaceholder(dev.magicmq.pyspigot.manager.script.Script script) Unregister a script's placeholder expansion.
-
Method Details
-
registerPlaceholder
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
ScriptPlaceholderrepresenting 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 usedrelPlaceholderFunction- The function that should be called when the relational placeholder- Returns:
- A
ScriptPlaceholderrepresenting 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 usedauthor- The author of the placeholderversion- The version of the placeholder- Returns:
- A
ScriptPlaceholderrepresenting 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 usedrelPlaceholderFunction- The function that should be called when the relational placeholderauthor- The author of the placeholderversion- The version of the placeholder- Returns:
- A
ScriptPlaceholderrepresenting the placeholder expansion that was registered
-
unregisterPlaceholder
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
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
Get the singleton instance of this PlaceholderManager.- Returns:
- The instance
-