Class ScriptPlaceholder

java.lang.Object
me.clip.placeholderapi.PlaceholderHook
me.clip.placeholderapi.expansion.PlaceholderExpansion
dev.magicmq.pyspigot.bukkit.manager.placeholder.ScriptPlaceholder
All Implemented Interfaces:
me.clip.placeholderapi.expansion.Relational

public class ScriptPlaceholder extends me.clip.placeholderapi.expansion.PlaceholderExpansion implements me.clip.placeholderapi.expansion.Relational
A class that represents a script placeholder expansion.

A ScriptPlaceholder can have multiple individual placeholders. For example, a script with the name "test.py" could have "%script:test_placeholder1%" and "%script:test_placeholder2%". It will be up to the script to handle each individual placeholder.

See Also:
  • PlaceholderExpansion
  • Nested Class Summary

    Nested classes/interfaces inherited from class me.clip.placeholderapi.expansion.PlaceholderExpansion

    me.clip.placeholderapi.expansion.PlaceholderExpansion.Type
  • Field Summary

    Fields inherited from class me.clip.placeholderapi.expansion.PlaceholderExpansion

    expansionType
  • Constructor Summary

    Constructors
    Constructor
    Description
    ScriptPlaceholder(dev.magicmq.pyspigot.manager.script.Script script, PyFunction function, PyFunction relFunction, String author, String version)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the author of this ScriptPlaceholder.
    Get the identifier of this ScriptPlaceholder.
    dev.magicmq.pyspigot.manager.script.Script
    Get the script associated with this ScriptPlaceholder.
    Get the version of this ScriptPlaceholder.
    onPlaceholderRequest(Player playerOne, Player playerTwo, String identifier)
    Called internally when the ScriptPlaceholder is used in a relational fashion.
    onRequest(OfflinePlayer player, String params)
    Called internally when the ScriptPlaceholder is used.
    boolean
    Indicates that the ScriptPlaceholder should persist when PlaceholderAPI is reloaded.

    Methods inherited from class me.clip.placeholderapi.expansion.PlaceholderExpansion

    canRegister, configurationContains, equals, get, getBoolean, getConfigSection, getConfigSection, getDescription, getDouble, getExpansionType, getInt, getLink, getLong, getName, getPlaceholderAPI, getPlaceholders, getPlugin, getRequiredPlugin, getString, getStringList, info, isRegistered, log, log, register, setExpansionType, severe, severe, toString, unregister, warning

    Methods inherited from class me.clip.placeholderapi.PlaceholderHook

    onPlaceholderRequest

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ScriptPlaceholder

      public ScriptPlaceholder(dev.magicmq.pyspigot.manager.script.Script script, PyFunction function, PyFunction relFunction, String author, String version)
      Parameters:
      script - The script associated with this ScriptPlaceholder
      function - The function to call when the placeholder is used
      relFunction - The function to call when the relational placeholder is used
      author - The author of this ScriptPlaceholder
      version - The version of this ScriptPlaceholder
  • Method Details

    • getScript

      public dev.magicmq.pyspigot.manager.script.Script getScript()
      Get the script associated with this ScriptPlaceholder.
      Returns:
      The script associated with this ScriptPlaceholder
    • getAuthor

      public String getAuthor()
      Get the author of this ScriptPlaceholder.
      Specified by:
      getAuthor in class me.clip.placeholderapi.expansion.PlaceholderExpansion
      Returns:
      The author of this ScriptPlaceholder
    • getVersion

      public String getVersion()
      Get the version of this ScriptPlaceholder.
      Specified by:
      getVersion in class me.clip.placeholderapi.expansion.PlaceholderExpansion
      Returns:
      The version of this ScriptPlaceholder
    • getIdentifier

      public String getIdentifier()
      Get the identifier of this ScriptPlaceholder.

      This is used to identify the script's placeholder. It will be in the format "script:name", where "name" is the name of the script (without the file extension, .py). For example, for a script named "test.py", the placeholder identifier will be "script:test".

      Specified by:
      getIdentifier in class me.clip.placeholderapi.expansion.PlaceholderExpansion
      Returns:
      The identifier of this ScriptPlaceholder
    • persist

      public boolean persist()
      Indicates that the ScriptPlaceholder should persist when PlaceholderAPI is reloaded.
      Overrides:
      persist in class me.clip.placeholderapi.expansion.PlaceholderExpansion
      Returns:
      True
    • onRequest

      public String onRequest(OfflinePlayer player, String params)
      Called internally when the ScriptPlaceholder is used.
      Overrides:
      onRequest in class me.clip.placeholderapi.PlaceholderHook
      Parameters:
      player - The OfflinePlayer associated with the placeholder, or null if there is none
      params - The specific placeholder that was used (the ScriptPlaceholder expansion can have multiple individual placeholders. Scripts will handle each specific placeholder on their own)
      Returns:
      The replaced text
    • onPlaceholderRequest

      public String onPlaceholderRequest(Player playerOne, Player playerTwo, String identifier)
      Called internally when the ScriptPlaceholder is used in a relational fashion.
      Specified by:
      onPlaceholderRequest in interface me.clip.placeholderapi.expansion.Relational
      Parameters:
      playerOne - The first Player used for the placeholder.
      playerTwo - The second Player used for the placeholder.
      identifier - The specific placeholder that was used, right after the relational aspect.
      Returns:
      The replaced text