Class ModuleMessages
java.lang.Object
com.ultikits.ultitools.text.internal.ModuleMessages
- All Implemented Interfaces:
Messages
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TextEngineprivate final Stringprivate final MessageRendererprivate final LocaleResolver -
Constructor Summary
ConstructorsConstructorDescriptionModuleMessages(String namespace, TextEngine engine, MessageRenderer renderer, LocaleResolver resolver) -
Method Summary
Modifier and TypeMethodDescriptionvoidforEachRecipient(net.kyori.adventure.audience.Audience audience, Text text, BiConsumer<? super net.kyori.adventure.audience.Audience, ? super net.kyori.adventure.text.Component> action) Expands a forwarding audience withAudience.forEachAudience(java.util.function.Consumer)and invokes the action once per leaf recipient with text rendered in that recipient's locale.booleanisDefined(MessageKey key, Locale locale) Returns whether the exact locale or its language defines the key, without fallback.ReturnsMessageKey.of(namespace(), path).Returns this instance's module namespace, orultitoolsfor the framework.net.kyori.adventure.text.ComponentRenders in the requested locale; never throws for a missing key or translation.net.kyori.adventure.text.ComponentRenders using the viewer'sresolved locale.net.kyori.adventure.text.ComponentReturns text for a shared object (entity name, text display or shared boss bar).
-
Field Details
-
namespace
-
engine
-
renderer
-
resolver
-
-
Constructor Details
-
ModuleMessages
ModuleMessages(String namespace, TextEngine engine, MessageRenderer renderer, LocaleResolver resolver)
-
-
Method Details
-
namespace
-
key
Description copied from interface:MessagesReturnsMessageKey.of(namespace(), path). -
render
-
render
public net.kyori.adventure.text.Component render(Text text, net.kyori.adventure.audience.Audience viewer) Description copied from interface:MessagesRenders using the viewer'sresolved locale. -
forEachRecipient
public void forEachRecipient(net.kyori.adventure.audience.Audience audience, Text text, BiConsumer<? super net.kyori.adventure.audience.Audience, ? super net.kyori.adventure.text.Component> action) Description copied from interface:MessagesExpands a forwarding audience withAudience.forEachAudience(java.util.function.Consumer)and invokes the action once per leaf recipient with text rendered in that recipient's locale. Never invokes the action for the forwarding audience itself. Expanding the server audience is safe from any thread: Paper iterates a copy-on-write snapshot of the online players, so a player who joins during the call may be skipped and one who quits during the call may still be passed to the action, where sending is a no-op.- Specified by:
forEachRecipientin interfaceMessages
-
isDefined
Description copied from interface:MessagesReturns whether the exact locale or its language defines the key, without fallback.
-