Class LogDispatcher
java.lang.Object
dev.ua.theroer.magicutils.logger.LogDispatcher
Handles recipient selection and thread-safe delivery for logger messages.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddeliver(Platform platform, net.kyori.adventure.text.Component component, Collection<Audience> recipients, LogTarget target) Sends the component to console and/or chat in a thread-safe way.static voiddeliver(Platform platform, net.kyori.adventure.text.Component chatComponent, net.kyori.adventure.text.Component consoleComponent, Collection<Audience> recipients, LogTarget target, ConsoleMessageMetadata consoleMetadata) Sends the component to console and/or chat in a thread-safe way.static Collection<Audience> determineRecipients(Audience audience, Collection<? extends Audience> audiences, boolean broadcast, LogTarget target, Platform platform) Resolves concrete recipients based on provided audience(s) and broadcast flag.
-
Method Details
-
determineRecipients
public static Collection<Audience> determineRecipients(Audience audience, Collection<? extends Audience> audiences, boolean broadcast, LogTarget target, Platform platform) Resolves concrete recipients based on provided audience(s) and broadcast flag.- Parameters:
audience- direct audience recipientaudiences- collection of audiences to includebroadcast- whether message should be sent to all audiencestarget- target channel (chat or console)platform- platform adapter for online audience snapshots- Returns:
- collection of audiences to deliver chat messages to
-
deliver
public static void deliver(Platform platform, net.kyori.adventure.text.Component component, Collection<Audience> recipients, LogTarget target) Sends the component to console and/or chat in a thread-safe way.- Parameters:
platform- platform adaptercomponent- message component to sendrecipients- resolved chat recipients (ignored for console-only)target- LogTarget describing where to deliver
-
deliver
public static void deliver(Platform platform, net.kyori.adventure.text.Component chatComponent, net.kyori.adventure.text.Component consoleComponent, Collection<Audience> recipients, LogTarget target, ConsoleMessageMetadata consoleMetadata) Sends the component to console and/or chat in a thread-safe way.- Parameters:
platform- platform adapterchatComponent- component for chat delivery (includes prefixes)consoleComponent- component for console delivery (no prefixes — logger name carries that)recipients- resolved chat recipients (ignored for console-only)target- LogTarget describing where to deliverconsoleMetadata- structured console metadata when available
-