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 Type
    Method
    Description
    default @NotNull String
    replace(@Nullable String str)
    Sets the placeholders in the string.
    default @NotNull List<String>
    replace(@Nullable List<String> list)
    Sets the placeholders in a string list.
    default @NotNull org.bukkit.inventory.ItemStack
    replace(@Nullable org.bukkit.inventory.ItemStack stack)
    Sets the placeholders in an item stack.
    @NotNull String
    setPlaceholders(@NotNull String str)
    Sets the placeholders in the string.
    default @NotNull Function<String,String>
    Gets the function for setting the placeholders.
    default @NotNull UnaryOperator<String>
    Gets the unary operator for setting the placeholders.
  • Method Details

    • setPlaceholders

      @NotNull @NotNull String setPlaceholders(@NotNull @NotNull String str)
      Sets the placeholders in the string.
      Parameters:
      str - The string to replace
      Returns:
      The replaced string
    • replace

      @NotNull default @NotNull String replace(@Nullable @Nullable String str)
      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

      @NotNull default @NotNull List<String> replace(@Nullable @Nullable List<String> list)
      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

      @NotNull default @NotNull Function<String,String> toFunction()
      Gets the function for setting the placeholders.
      Returns:
      The replacing function
    • toOperator

      @NotNull default @NotNull UnaryOperator<String> toOperator()
      Gets the unary operator for setting the placeholders.
      Returns:
      The replacing operator