Class TownyPlaceholderExpansion

java.lang.Object
me.clip.placeholderapi.PlaceholderHook
me.clip.placeholderapi.expansion.PlaceholderExpansion
com.palmergames.bukkit.towny.hooks.TownyPlaceholderExpansion
All Implemented Interfaces:
me.clip.placeholderapi.expansion.Relational

public class TownyPlaceholderExpansion extends me.clip.placeholderapi.expansion.PlaceholderExpansion implements me.clip.placeholderapi.expansion.Relational
This class will be registered through the register-method in the plugins onEnable-method.
  • 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
    Since we register the expansion inside our own plugin, we can simply use this method here to get an instance of our plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Because this is a internal class, this check is not needed and we can simply return true
    The name of the person who created this expansion should go here.
    The placeholder identifier should go here.
    This is the version of the expansion.
    onPlaceholderRequest(org.bukkit.entity.Player player, String identifier)
     
    onPlaceholderRequest(org.bukkit.entity.Player player, org.bukkit.entity.Player player2, String identifier)
     
    onRequest(org.bukkit.OfflinePlayer player, String identifier)
    This is the method called when a placeholder with our identifier is found and needs a value.
    boolean
    Because this is an internal class, you must override this method to let PlaceholderAPI know to not unregister your expansion class when PlaceholderAPI is reloaded

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

    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 java.lang.Object

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

    • TownyPlaceholderExpansion

      public TownyPlaceholderExpansion(Towny plugin)
      Since we register the expansion inside our own plugin, we can simply use this method here to get an instance of our plugin.
      Parameters:
      plugin - The instance of our plugin.
  • Method Details

    • persist

      public boolean persist()
      Because this is an internal class, you must override this method to let PlaceholderAPI know to not unregister your expansion class when PlaceholderAPI is reloaded
      Overrides:
      persist in class me.clip.placeholderapi.expansion.PlaceholderExpansion
      Returns:
      true to persist through reloads
    • canRegister

      public boolean canRegister()
      Because this is a internal class, this check is not needed and we can simply return true
      Overrides:
      canRegister in class me.clip.placeholderapi.expansion.PlaceholderExpansion
      Returns:
      Always true since it's an internal class.
    • getAuthor

      public String getAuthor()
      The name of the person who created this expansion should go here.
      For convienience do we return the author from the plugin.yml
      Specified by:
      getAuthor in class me.clip.placeholderapi.expansion.PlaceholderExpansion
      Returns:
      The name of the author as a String.
    • getIdentifier

      public String getIdentifier()
      The placeholder identifier should go here.
      This is what tells PlaceholderAPI to call our onRequest method to obtain a value if a placeholder starts with our identifier.
      This must be unique and can not contain % or _
      Specified by:
      getIdentifier in class me.clip.placeholderapi.expansion.PlaceholderExpansion
      Returns:
      The identifier in %<identifier>_<value>% as String.
    • getVersion

      public String getVersion()
      This is the version of the expansion.
      You don't have to use numbers, since it is set as a String. For convienience do we return the version from the plugin.yml
      Specified by:
      getVersion in class me.clip.placeholderapi.expansion.PlaceholderExpansion
      Returns:
      The version as a String.
    • onPlaceholderRequest

      public String onPlaceholderRequest(org.bukkit.entity.Player player, org.bukkit.entity.Player player2, String identifier)
      Specified by:
      onPlaceholderRequest in interface me.clip.placeholderapi.expansion.Relational
    • onRequest

      public String onRequest(org.bukkit.OfflinePlayer player, String identifier)
      This is the method called when a placeholder with our identifier is found and needs a value.
      We specify the value identifier in this method.
      Since version 2.9.1 can you use OfflinePlayers in your requests.
      Overrides:
      onRequest in class me.clip.placeholderapi.PlaceholderHook
      Parameters:
      player - A OfflinePlayer.
      identifier - A String containing the identifier/value.
      Returns:
      possibly-null String of the requested identifier.
    • onPlaceholderRequest

      public String onPlaceholderRequest(org.bukkit.entity.Player player, String identifier)
      Overrides:
      onPlaceholderRequest in class me.clip.placeholderapi.PlaceholderHook