Klasse MessageService
java.lang.Object
de.delinkedde.areashopreborn.message.MessageService
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
KonstruktorenKonstruktorBeschreibungMessageService(org.bukkit.plugin.java.JavaPlugin plugin) Creates and immediately loads the message file. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungnet.kyori.adventure.text.ComponentRenders an unprefixed configurable template for inventory titles and item metadata.net.kyori.adventure.text.ComponentRenders the common error envelope after unwrapping asynchronous wrapper exceptions.List<net.kyori.adventure.text.Component> Renders a configurable list through a shared template and an unparsedlinevalue.net.kyori.adventure.text.ComponentRenders a configurable prefixed template with safely escaped dynamic placeholders.voidreload()Reloadsmessages.ymlfrom disk without modifying customized values.net.kyori.adventure.text.ComponentstaticMessage(String key, String fallback) Renders a configured static message with the common prefix.net.kyori.adventure.text.ComponentRenders the common success envelope.net.kyori.adventure.text.ComponentRenders a keyed message inside the configured success envelope.Resolves a configured plain-text fragment for safe composition into another message.
-
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()Reloadsmessages.ymlfrom disk without modifying customized values. -
success
Renders the common success envelope.- Parameter:
value- plain dynamic message text- Gibt zurück:
- rendered Adventure component
-
error
Renders the common error envelope after unwrapping asynchronous wrapper exceptions.- Parameter:
throwable- reported failure- Gibt zurück:
- rendered Adventure component
-
staticMessage
Renders a configured static message with the common prefix.- Parameter:
key- YAML path below the rootfallback- 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 pathfallback- MiniMessage fallback used when the key is absentplaceholders- 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 pathfallback- MiniMessage fallback used when the key is absentplaceholders- plain dynamic placeholder values without angle brackets- Gibt zurück:
- rendered Adventure component without the chat prefix
-
text
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 pathfallback- fallback text used when the key is absentplaceholders- 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 unparsedlinevalue.- Parameter:
listKey- YAML list pathfallbackLines- fallback lines used for a missing or empty listtemplateKey- YAML path of the per-line MiniMessage templatetemplateFallback- 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 pathfallback- plain or MiniMessage fallbackplaceholders- safely escaped dynamic values- Gibt zurück:
- rendered success component
-