Class LogDispatcher

java.lang.Object
dev.ua.theroer.magicutils.logger.LogDispatcher

public final class LogDispatcher extends Object
Handles recipient selection and thread-safe delivery for logger messages.
  • 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 recipient
      audiences - collection of audiences to include
      broadcast - whether message should be sent to all audiences
      target - 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 adapter
      component - message component to send
      recipients - 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 adapter
      chatComponent - 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 deliver
      consoleMetadata - structured console metadata when available