Interface RangeBroadcast

All Known Implementing Classes:
DisableRangeBroadcast

public interface RangeBroadcast
Broadcast message delivery scoped to a specific set of users.

Provides a fluent API for selecting target user IDs, setting the broadcast payload (with automatic codec encoding for various data types), and executing the broadcast. Users can be added or excluded individually or in bulk before calling execute().

Since:
21.9
Author:
渔民小镇
date:
2024-06-02
  • Method Details

    • listUserId

      Set<Long> listUserId()
      Return the mutable set of user IDs that will receive this broadcast.
      Returns:
      mutable set of target user IDs
    • setData

      RangeBroadcast setData(byte[] data)
      Set the raw byte-array payload for this broadcast.
      Parameters:
      data - encoded payload bytes
      Returns:
      this instance for chaining
    • setOriginal

      void setOriginal(Object originalData)
      Store the original (pre-encoding) data object for inspection or debugging.
      Parameters:
      originalData - the original business data before encoding
    • execute

      void execute()
      Send the response message to the remote endpoint (user, player)
    • addUserId

      default RangeBroadcast addUserId(Collection<Long> userIds)
      Users receiving the broadcast
      Parameters:
      userIds - userIds
      Returns:
      this
    • addUserId

      default RangeBroadcast addUserId(long userId)
      Users receiving the broadcast
      Parameters:
      userId - userId
      Returns:
      this
    • addUserId

      default RangeBroadcast addUserId(Collection<Long> userIds, long excludeUserId)
      Add users to receive the broadcast, simultaneously excluding one user who should not receive it
      Parameters:
      userIds - User IDs to receive the broadcast
      excludeUserId - User ID to be excluded
      Returns:
      this
    • removeUserId

      default RangeBroadcast removeUserId(long excludeUserId)
      Exclude userId
      Parameters:
      excludeUserId - User ID to be excluded
      Returns:
      this
    • setData

      default RangeBroadcast setData(int data)
      Set the broadcast payload from an int value, encoding it via the configured codec.
      Parameters:
      data - the integer value to broadcast
      Returns:
      this instance for chaining
    • setData

      default RangeBroadcast setData(boolean data)
      Set the broadcast payload from a boolean value, encoding it via the configured codec.
      Parameters:
      data - the boolean value to broadcast
      Returns:
      this instance for chaining
    • setData

      default RangeBroadcast setData(long data)
      Set the broadcast payload from a long value, encoding it via the configured codec.
      Parameters:
      data - the long value to broadcast
      Returns:
      this instance for chaining
    • setData

      default RangeBroadcast setData(String data)
      Set the broadcast payload from a String value, encoding it via the configured codec.
      Parameters:
      data - the string value to broadcast (must not be null)
      Returns:
      this instance for chaining
    • setData

      default RangeBroadcast setData(Object data)
      Set the broadcast payload from a business object, encoding it via the configured codec.
      Parameters:
      data - the business data object to broadcast (must not be null)
      Returns:
      this instance for chaining
    • setData

      default RangeBroadcast setData(Collection<?> dataList)
      Set the broadcast payload from a collection of business objects, encoding it via the configured codec.
      Parameters:
      dataList - the collection of objects to broadcast
      Returns:
      this instance for chaining
    • setDataListInt

      default RangeBroadcast setDataListInt(List<Integer> dataList)
      Set the broadcast payload from a list of Integer values, encoding it via the configured codec.
      Parameters:
      dataList - the list of integer values to broadcast
      Returns:
      this instance for chaining
    • setDataListBool

      default RangeBroadcast setDataListBool(List<Boolean> dataList)
      Set the broadcast payload from a list of Boolean values, encoding it via the configured codec.
      Parameters:
      dataList - the list of boolean values to broadcast
      Returns:
      this instance for chaining
    • setDataListLong

      default RangeBroadcast setDataListLong(List<Long> dataList)
      Set the broadcast payload from a list of Long values, encoding it via the configured codec.
      Parameters:
      dataList - the list of long values to broadcast
      Returns:
      this instance for chaining
    • setDataListString

      default RangeBroadcast setDataListString(List<String> dataList)
      Set the broadcast payload from a list of String values, encoding it via the configured codec.
      Parameters:
      dataList - the list of string values to broadcast
      Returns:
      this instance for chaining