Klasse Messages

java.lang.Object
de.delinkedde.mobarenareborn.config.Messages

public final class Messages extends Object
Renders user-facing chat messages from the configuration.

Message strings are read from the messages.* section of config.yml and parsed as Adventure MiniMessage. Values are read lazily on every call, so a configuration reload performed through ConfigManager.reload() takes effect immediately without any cache invalidation.

  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    Messages(@NotNull ConfigManager config)
    Creates a message renderer backed by the given configuration manager.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    net.kyori.adventure.text.Component
    line(@NotNull String key, @NotNull String def, @NotNull String... replacements)
    Returns a prefixed, parsed message resolved via text(String, String, String...).
    @NotNull net.kyori.adventure.text.Component
    message(@NotNull String key)
    Returns a prefixed message component for the given key.
    @NotNull net.kyori.adventure.text.Component
    Returns the configured message prefix as a component.
    @NotNull net.kyori.adventure.text.Component
    raw(@NotNull String key)
    Returns a parsed message component for the given key, without the prefix.
    @NotNull String
    text(@NotNull String key, @NotNull String def, @NotNull String... replacements)
    Resolves a message string: the configured value under messages.<key> when present, otherwise the given default.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Konstruktordetails

    • Messages

      public Messages(@NotNull @NotNull ConfigManager config)
      Creates a message renderer backed by the given configuration manager.
      Parameter:
      config - the configuration manager to read message strings from
  • Methodendetails

    • prefix

      @NotNull public @NotNull net.kyori.adventure.text.Component prefix()
      Returns the configured message prefix as a component.
      Gibt zurück:
      the parsed prefix component
    • message

      @NotNull public @NotNull net.kyori.adventure.text.Component message(@NotNull @NotNull String key)
      Returns a prefixed message component for the given key.
      Parameter:
      key - the message key relative to the messages section, for example "reloaded"
      Gibt zurück:
      the prefix followed by the parsed message; a visible placeholder is returned when the key is missing
    • text

      @NotNull public @NotNull String text(@NotNull @NotNull String key, @NotNull @NotNull String def, @NotNull @NotNull String... replacements)
      Resolves a message string: the configured value under messages.<key> when present, otherwise the given default. Placeholder pairs are applied afterwards ("<player>", name, "<count>", "3").
      Parameter:
      key - the message key relative to the messages section
      def - the built-in default (MiniMessage)
      replacements - placeholder/value pairs applied to the resolved string
      Gibt zurück:
      the resolved MiniMessage string
    • line

      @NotNull public net.kyori.adventure.text.Component line(@NotNull @NotNull String key, @NotNull @NotNull String def, @NotNull @NotNull String... replacements)
      Returns a prefixed, parsed message resolved via text(String, String, String...).
      Parameter:
      key - the message key relative to the messages section
      def - the built-in default (MiniMessage)
      replacements - placeholder/value pairs
      Gibt zurück:
      the prefix followed by the parsed message
    • raw

      @NotNull public @NotNull net.kyori.adventure.text.Component raw(@NotNull @NotNull String key)
      Returns a parsed message component for the given key, without the prefix.
      Parameter:
      key - the message key relative to the messages section
      Gibt zurück:
      the parsed message; a visible placeholder is returned when the key is missing