Package me.yleoft.zAPI.placeholders
Class PlaceholderDefinition
java.lang.Object
me.yleoft.zAPI.placeholders.PlaceholderDefinition
Represents a single placeholder entry for MiniPlaceholders registration.
This defines a key that will be registered as a MiniPlaceholders tag,
along with how many colon-separated arguments it expects and what
type of placeholder it is.
Example definitions and their resulting usage:
("version", 0, GLOBAL)→<zhomes_version>(no audience needed)("home", 1, AUDIENCE)→<zhomes_home:1>(uses viewing player)("home_world", 1, AUDIENCE)→<zhomes_home_world:1>("home", 1, PLAYER_TARGETED)→<zhomes_home:Steve:1>(targets "Steve")("has_home", 1, PLAYER_TARGETED)→<zhomes_has_home:Steve:base>
For PlaceholderType.PLAYER_TARGETED, the parameterCount does not
include the player-name argument — that is prepended automatically. So if you define
("home", 1, PLAYER_TARGETED), usage is <zhomes_home:Steve:1> (player + 1 param).
-
Constructor Summary
ConstructorsConstructorDescriptionPlaceholderDefinition(@NotNull String key) Creates a placeholder definition with no parameters (defaults toPlaceholderType.AUDIENCE).PlaceholderDefinition(@NotNull String key, int parameterCount) Creates a placeholder definition (defaults toPlaceholderType.AUDIENCE).PlaceholderDefinition(@NotNull String key, int parameterCount, @NotNull PlaceholderType type) Creates a placeholder definition with an explicit type. -
Method Summary
Modifier and TypeMethodDescription@NotNull StringgetKey()Gets the placeholder key.intGets the number of parameters this placeholder expects.@NotNull PlaceholderTypegetType()Gets the placeholder type.booleanWhether this placeholder has parameters.
-
Constructor Details
-
PlaceholderDefinition
public PlaceholderDefinition(@NotNull @NotNull String key, int parameterCount, @NotNull @NotNull PlaceholderType type) Creates a placeholder definition with an explicit type.- Parameters:
key- The placeholder key (e.g., "home_name", "home_world")parameterCount- The number of colon-separated arguments this placeholder expects (excluding the player-name arg for PLAYER_TARGETED)type- The placeholder type
-
PlaceholderDefinition
Creates a placeholder definition (defaults toPlaceholderType.AUDIENCE).- Parameters:
key- The placeholder keyparameterCount- The number of colon-separated arguments this placeholder expects
-
PlaceholderDefinition
Creates a placeholder definition with no parameters (defaults toPlaceholderType.AUDIENCE).- Parameters:
key- The placeholder key
-
-
Method Details
-
getKey
Gets the placeholder key.- Returns:
- The key (e.g., "home_world")
-
getParameterCount
public int getParameterCount()Gets the number of parameters this placeholder expects. ForPlaceholderType.PLAYER_TARGETED, this does NOT include the player name.- Returns:
- The parameter count
-
getType
Gets the placeholder type.- Returns:
- The
PlaceholderType
-
hasParameters
public boolean hasParameters()Whether this placeholder has parameters.- Returns:
- true if it has at least one parameter
-