Package dev.demeng.pluginbase
Interface DynamicPlaceholders
- All Known Implementing Classes:
Placeholders
public interface DynamicPlaceholders
An easy way to provides methods for setting placeholders in lists and item stacks, simply by
defining how to set the placeholders in a string.
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull StringSets the placeholders in the string.Sets the placeholders in a string list.default @NotNull org.bukkit.inventory.ItemStackreplace(@Nullable org.bukkit.inventory.ItemStack stack) Sets the placeholders in an item stack.@NotNull StringsetPlaceholders(@NotNull String str) Sets the placeholders in the string.Gets the function for setting the placeholders.default @NotNull UnaryOperator<String>Gets the unary operator for setting the placeholders.
-
Method Details
-
setPlaceholders
Sets the placeholders in the string.- Parameters:
str- The string to replace- Returns:
- The replaced string
-
replace
Sets the placeholders in the string.- Parameters:
str- The string to replace- Returns:
- The replaced string, or an empty string if the provided string is null
-
replace
Sets the placeholders in a string list.- Parameters:
list- The list to replace- Returns:
- The replaced list, or an empty list if the provided list is null
-
replace
@NotNull default @NotNull org.bukkit.inventory.ItemStack replace(@Nullable @Nullable org.bukkit.inventory.ItemStack stack) Sets the placeholders in an item stack. The placeholders will only be applied to the display name and lore.- Parameters:
stack- The item stack to replace- Returns:
- The replaced item stack, or air if the provided stack is null
-
toFunction
Gets the function for setting the placeholders.- Returns:
- The replacing function
-
toOperator
Gets the unary operator for setting the placeholders.- Returns:
- The replacing operator
-