Class PlaceholderMessage

java.lang.Object
me.deecaad.core.placeholder.PlaceholderMessage

public class PlaceholderMessage extends Object
Represents a message template that can contain placeholders. This class is used to process and replace these placeholders with desired values.
  • Field Details

  • Constructor Details

    • PlaceholderMessage

      public PlaceholderMessage(@NotNull @NotNull String template)
      Constructs a new PlaceholderMessage based on the provided template string.

      Custom placeholders (placeholders not registered with a PlaceholderHandler) may be used if you add them.

      Parameters:
      template - The template string containing potential placeholders.
  • Method Details

    • getTemplate

      public String getTemplate()
      Returns the template string with all placeholders converted to lowercase.
      Returns:
      The processed template string.
    • getPresentPlaceholders

      public Set<String> getPresentPlaceholders()
      Gets an immutable set of PlaceholderHandler objects that were identified in the template.
      Returns:
      A set of identified placeholders.
    • fillMap

      public void fillMap(PlaceholderData data)
      Generates a map where the keys are the identified placeholders in the template, and the values are all set to null. The placeholders are added to the map stored in data.
      Parameters:
      data - The data to pass to the placeholder handlers.
    • replaceAndDeserialize

      public net.kyori.adventure.text.Component replaceAndDeserialize(PlaceholderData data)