Interface MessageDispatcher


public interface MessageDispatcher
Dispatcher responsible for routing and sending messages to players. Handles message formatting, filtering, and event dispatching through the messaging pipeline.
Since:
1.8.2
  • Method Details

    • dispatch

      Set<FPlayer> dispatch(@NonNull ModuleLocalization module, @NonNull EventMetadata eventMetadata)
      Builds the message, works out who receives it and sends it.
      Parameters:
      module - the module the message came from
      eventMetadata - how it should be delivered
      Returns:
      the players it reached
    • dispatch

      Set<FPlayer> dispatch(@NonNull ModuleName moduleName, @NonNull EventMetadata eventMetadata)
      Dispatches a message event to eligible receivers determined by the module name and event metadata. Automatically resolves the receiver list using createReceivers(ModuleName, EventMetadata).
      Parameters:
      moduleName - The module name used for localization and receiver filtering
      eventMetadata - Metadata containing event information and filtering criteria
      Returns:
      The set of players who received the message
    • dispatch

      Set<FPlayer> dispatch(@NonNull ModuleName moduleName, @NonNull EventMetadata eventMetadata, @NonNull Set<FPlayer> receivers)
      Dispatches a message event to the specified set of receivers asynchronously. Each receiver receives an individually created message event for personalized message processing. Dispatching is skipped if the receiver set is empty.
      Parameters:
      moduleName - The module name used for message localization
      eventMetadata - Metadata containing event information for message creation
      receivers - The pre-filtered set of players to receive the message
      Returns:
      The set of players who received the message (same as input receivers)
    • dispatch

      MessageSendEvent dispatch(MessageSendEvent messageSendEvent)
      Directly dispatches a pre-built message send event through the event system.
      Parameters:
      messageSendEvent - The message send event to dispatch
      Returns:
      The dispatched message send event
    • createReceivers

      Set<FPlayer> createReceivers(ModuleName moduleName, EventMetadata eventMetadata)
      Creates and populates the receiver list for the message event based on filtering criteria. Applies player filters, range filters, and module settings checks to determine eligible receivers.
      Parameters:
      moduleName - The module name containing localization and settings to check for each receiver
      eventMetadata - Metadata containing event information and filtering criteria
      Returns:
      A set of eligible players to receive the message, or an empty set if the event is for proxy and cancelled
    • createMessageEvent

      MessageSendEvent createMessageEvent(FPlayer fReceiver, ModuleName moduleName, EventMetadata eventMetadata)
      Creates a complete message send event for a specific receiver. Builds formatted message components including main message, format wrapper, and destination subtext.
      Parameters:
      fReceiver - The player receiving the message
      moduleName - The name identifier for the module
      eventMetadata - Metadata containing event information and message content
      Returns:
      A fully constructed MessageSendEvent ready for dispatch