Klasse MessageService

java.lang.Object
de.delinkedde.areashopreborn.message.MessageService

public final class MessageService extends Object
Loads configurable MiniMessage templates and safely inserts untrusted values.

User, region, and exception text is always passed through an unparsed placeholder. This prevents names containing MiniMessage syntax from injecting colors, click events, or hover content into plugin messages.

  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    MessageService(org.bukkit.plugin.java.JavaPlugin plugin)
    Creates and immediately loads the message file.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    net.kyori.adventure.text.Component
    bare(String key, String fallback, Map<String,?> placeholders)
    Renders an unprefixed configurable template for inventory titles and item metadata.
    net.kyori.adventure.text.Component
    error(Throwable throwable)
    Renders the common error envelope after unwrapping asynchronous wrapper exceptions.
    List<net.kyori.adventure.text.Component>
    list(String listKey, List<String> fallbackLines, String templateKey, String templateFallback)
    Renders a configurable list through a shared template and an unparsed line value.
    net.kyori.adventure.text.Component
    message(String key, String fallback, Map<String,?> placeholders)
    Renders a configurable prefixed template with safely escaped dynamic placeholders.
    void
    Reloads messages.yml from disk without modifying customized values.
    net.kyori.adventure.text.Component
    staticMessage(String key, String fallback)
    Renders a configured static message with the common prefix.
    net.kyori.adventure.text.Component
    success(String value)
    Renders the common success envelope.
    net.kyori.adventure.text.Component
    success(String key, String fallback, Map<String,?> placeholders)
    Renders a keyed message inside the configured success envelope.
    text(String key, String fallback, Map<String,?> placeholders)
    Resolves a configured plain-text fragment for safe composition into another message.

    Von Klasse geerbte Methoden java.lang.Object

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

    • MessageService

      public MessageService(org.bukkit.plugin.java.JavaPlugin plugin)
      Creates and immediately loads the message file.
      Parameter:
      plugin - owning plugin
  • Methodendetails

    • reload

      public void reload()
      Reloads messages.yml from disk without modifying customized values.
    • success

      public net.kyori.adventure.text.Component success(String value)
      Renders the common success envelope.
      Parameter:
      value - plain dynamic message text
      Gibt zurück:
      rendered Adventure component
    • error

      public net.kyori.adventure.text.Component error(Throwable throwable)
      Renders the common error envelope after unwrapping asynchronous wrapper exceptions.
      Parameter:
      throwable - reported failure
      Gibt zurück:
      rendered Adventure component
    • staticMessage

      public net.kyori.adventure.text.Component staticMessage(String key, String fallback)
      Renders a configured static message with the common prefix.
      Parameter:
      key - YAML path below the root
      fallback - MiniMessage fallback used when the path is absent
      Gibt zurück:
      rendered Adventure component
    • message

      public net.kyori.adventure.text.Component message(String key, String fallback, Map<String,?> placeholders)
      Renders a configurable prefixed template with safely escaped dynamic placeholders.

      Placeholder map keys must use lowercase letters, digits, underscores, or hyphens. Values are inserted through MiniMessage's unparsed resolver and can therefore never inject markup.

      Parameter:
      key - YAML message path
      fallback - MiniMessage fallback used when the key is absent
      placeholders - plain dynamic placeholder values without angle brackets
      Gibt zurück:
      rendered Adventure component
    • bare

      public net.kyori.adventure.text.Component bare(String key, String fallback, Map<String,?> placeholders)
      Renders an unprefixed configurable template for inventory titles and item metadata.
      Parameter:
      key - YAML message path
      fallback - MiniMessage fallback used when the key is absent
      placeholders - plain dynamic placeholder values without angle brackets
      Gibt zurück:
      rendered Adventure component without the chat prefix
    • text

      public String text(String key, String fallback, Map<String,?> placeholders)
      Resolves a configured plain-text fragment for safe composition into another message.

      Only placeholders present in the supplied map are replaced. Values are inserted in one pass and are therefore never interpreted as additional placeholders or MiniMessage markup.

      Parameter:
      key - YAML message path
      fallback - fallback text used when the key is absent
      placeholders - plain replacement values
      Gibt zurück:
      resolved plain-text fragment
    • list

      public List<net.kyori.adventure.text.Component> list(String listKey, List<String> fallbackLines, String templateKey, String templateFallback)
      Renders a configurable list through a shared template and an unparsed line value.
      Parameter:
      listKey - YAML list path
      fallbackLines - fallback lines used for a missing or empty list
      templateKey - YAML path of the per-line MiniMessage template
      templateFallback - fallback per-line template
      Gibt zurück:
      immutable rendered components
    • success

      public net.kyori.adventure.text.Component success(String key, String fallback, Map<String,?> placeholders)
      Renders a keyed message inside the configured success envelope.
      Parameter:
      key - YAML message path
      fallback - plain or MiniMessage fallback
      placeholders - safely escaped dynamic values
      Gibt zurück:
      rendered success component