Class EventMetadata.Builder

java.lang.Object
net.flectone.pulse.model.event.EventMetadata.Builder
Enclosing interface:
EventMetadata

public static final class EventMetadata.Builder extends Object
Collects the metadata pieces. Receiver filters stack, so each call narrows the audience further.
  • Method Details

    • messageContext

      public EventMetadata.Builder messageContext(Function<FPlayer, MessageContext> messageContext)
      Sets how the message context is built for each receiver. Required.
      Parameters:
      messageContext - builds the context for a given receiver
      Returns:
      this builder
    • filter

      public EventMetadata.Builder filter(FPlayer fReceiver)
      Narrows delivery to a single player.
      Parameters:
      fReceiver - the only receiver
      Returns:
      this builder
    • filter

      public EventMetadata.Builder filter(Collection<FPlayer> fReceivers)
      Narrows delivery to the given players.
      Parameters:
      fReceivers - the receivers
      Returns:
      this builder
    • filter

      public EventMetadata.Builder filter(Predicate<FPlayer> filter)
      Narrows delivery further. The new condition is combined with the existing one.
      Parameters:
      filter - the extra condition a receiver must satisfy
      Returns:
      this builder
    • destination

      public EventMetadata.Builder destination(Destination destination)
      Sets where the message is drawn. Defaults to chat.
      Parameters:
      destination - the destination
      Returns:
      this builder
    • range

      public EventMetadata.Builder range(@NonNull Range.Type type)
      Sets the range to one of the named scopes.
      Parameters:
      type - the scope
      Returns:
      this builder
    • range

      public EventMetadata.Builder range(@NonNull Range range)
      Sets the range. Defaults to the sender only.
      Parameters:
      range - the range
      Returns:
      this builder
    • sound

      Sets the sound played with the message and the permission needed to hear it.
      Parameters:
      sound - the sound and its permission
      Returns:
      this builder
    • proxy

      Sends the message across the proxy, writing the given extra payload.
      Parameters:
      proxy - writes the extra payload
      Returns:
      this builder
    • proxy

      public EventMetadata.Builder proxy()
      Sends the message across the proxy with no extra payload.
      Returns:
      this builder
    • integration

      public EventMetadata.Builder integration(Supplier<IntegrationMessageFormat> integration)
      Mirrors the message to the chat integrations using the supplied format.
      Parameters:
      integration - supplies the format
      Returns:
      this builder
    • integration

      public EventMetadata.Builder integration()
      Mirrors the message to the chat integrations using the default format.
      Returns:
      this builder
    • build

      public EventMetadataImpl build()
      Builds the metadata.
      Returns:
      the built metadata
      Throws:
      NullPointerException - if no message context was set