Record Class Messages

java.lang.Object
java.lang.Record
dev.despical.mazeengine.config.Messages

public record Messages(Map<String,String> values) extends Record
Loads and renders the plugin's configured MiniMessage templates.

Loading checks message value types, validates MiniMessage syntax, requires the essential keys, and fills additional keys from bundled defaults. The published template map is copied so later YAML edits do not alter the active messages until a successful reload.

Rendering substitutes plain arguments as unparsed placeholders and accepts explicit Adventure components for rich actions. Named colors are normalized to the shared palette, and panel-capable messages delegate contextual button selection and layout to MessagePanels.

  • Constructor Details

    • Messages

      public Messages(Map<String,String> values)
      Creates an instance of a Messages record class.
      Parameters:
      values - the value for the values record component
  • Method Details

    • load

      public static Messages load(Path file) throws Exception
      Throws:
      Exception
    • format

      public net.kyori.adventure.text.Component format(String key, String... args)
    • rich

      public net.kyori.adventure.text.Component rich(String key, Map<String, net.kyori.adventure.text.Component> components, String... args)
    • button

      public net.kyori.adventure.text.Component button(String labelKey, String command, String hoverKey, String color, String... args)
    • sendRich

      public void sendRich(org.bukkit.command.CommandSender sender, String key, Map<String, net.kyori.adventure.text.Component> components, String... args)
    • send

      public void send(org.bukkit.command.CommandSender sender, String key, String... args)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • values

      public Map<String,String> values()
      Returns the value of the values record component.
      Returns:
      the value of the values record component