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
ConstructorDescriptionTownyPlaceholderExpansion
(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. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Because this is a internal class, this check is not needed and we can simply returntrue
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) This is the method called when a placeholder with our identifier is found and needs a value.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 reloadedMethods 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
-
Constructor Details
-
TownyPlaceholderExpansion
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 classme.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 returntrue
- Overrides:
canRegister
in classme.clip.placeholderapi.expansion.PlaceholderExpansion
- Returns:
- Always true since it's an internal class.
-
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 classme.clip.placeholderapi.expansion.PlaceholderExpansion
- Returns:
- The name of the author as a 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 classme.clip.placeholderapi.expansion.PlaceholderExpansion
- Returns:
- The identifier in
%<identifier>_<value>%
as 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 classme.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 interfaceme.clip.placeholderapi.expansion.Relational
-
onRequest
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 classme.clip.placeholderapi.PlaceholderHook
- Parameters:
player
- A OfflinePlayer.identifier
- A String containing the identifier/value.- Returns:
- possibly-null String of the requested identifier.
-
onPlaceholderRequest
- Overrides:
onPlaceholderRequest
in classme.clip.placeholderapi.PlaceholderHook
-