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 Summary
Modifier and TypeMethodDescriptiondefault RangeBroadcastaddUserId(long userId) Users receiving the broadcastdefault RangeBroadcastaddUserId(Collection<Long> userIds) Users receiving the broadcastdefault RangeBroadcastaddUserId(Collection<Long> userIds, long excludeUserId) Add users to receive the broadcast, simultaneously excluding one user who should not receive itvoidexecute()Send the response message to the remote endpoint (user, player)Return the mutable set of user IDs that will receive this broadcast.default RangeBroadcastremoveUserId(long excludeUserId) Exclude userIddefault RangeBroadcastsetData(boolean data) Set the broadcast payload from abooleanvalue, encoding it via the configured codec.setData(byte[] data) Set the raw byte-array payload for this broadcast.default RangeBroadcastsetData(int data) Set the broadcast payload from anintvalue, encoding it via the configured codec.default RangeBroadcastsetData(long data) Set the broadcast payload from alongvalue, encoding it via the configured codec.default RangeBroadcastSet the broadcast payload from a business object, encoding it via the configured codec.default RangeBroadcastSet the broadcast payload from aStringvalue, encoding it via the configured codec.default RangeBroadcastsetData(Collection<?> dataList) Set the broadcast payload from a collection of business objects, encoding it via the configured codec.default RangeBroadcastsetDataListBool(List<Boolean> dataList) Set the broadcast payload from a list ofBooleanvalues, encoding it via the configured codec.default RangeBroadcastsetDataListInt(List<Integer> dataList) Set the broadcast payload from a list ofIntegervalues, encoding it via the configured codec.default RangeBroadcastsetDataListLong(List<Long> dataList) Set the broadcast payload from a list ofLongvalues, encoding it via the configured codec.default RangeBroadcastsetDataListString(List<String> dataList) Set the broadcast payload from a list ofStringvalues, encoding it via the configured codec.voidsetOriginal(Object originalData) Store the original (pre-encoding) data object for inspection or debugging.
-
Method Details
-
listUserId
-
setData
Set the raw byte-array payload for this broadcast.- Parameters:
data- encoded payload bytes- Returns:
- this instance for chaining
-
setOriginal
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
Users receiving the broadcast- Parameters:
userIds- userIds- Returns:
- this
-
addUserId
Users receiving the broadcast- Parameters:
userId- userId- Returns:
- this
-
addUserId
Add users to receive the broadcast, simultaneously excluding one user who should not receive it- Parameters:
userIds- User IDs to receive the broadcastexcludeUserId- User ID to be excluded- Returns:
- this
-
removeUserId
Exclude userId- Parameters:
excludeUserId- User ID to be excluded- Returns:
- this
-
setData
Set the broadcast payload from anintvalue, encoding it via the configured codec.- Parameters:
data- the integer value to broadcast- Returns:
- this instance for chaining
-
setData
Set the broadcast payload from abooleanvalue, encoding it via the configured codec.- Parameters:
data- the boolean value to broadcast- Returns:
- this instance for chaining
-
setData
Set the broadcast payload from alongvalue, encoding it via the configured codec.- Parameters:
data- the long value to broadcast- Returns:
- this instance for chaining
-
setData
Set the broadcast payload from aStringvalue, encoding it via the configured codec.- Parameters:
data- the string value to broadcast (must not be null)- Returns:
- this instance for chaining
-
setData
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
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
Set the broadcast payload from a list ofIntegervalues, encoding it via the configured codec.- Parameters:
dataList- the list of integer values to broadcast- Returns:
- this instance for chaining
-
setDataListBool
Set the broadcast payload from a list ofBooleanvalues, encoding it via the configured codec.- Parameters:
dataList- the list of boolean values to broadcast- Returns:
- this instance for chaining
-
setDataListLong
Set the broadcast payload from a list ofLongvalues, encoding it via the configured codec.- Parameters:
dataList- the list of long values to broadcast- Returns:
- this instance for chaining
-
setDataListString
Set the broadcast payload from a list ofStringvalues, encoding it via the configured codec.- Parameters:
dataList- the list of string values to broadcast- Returns:
- this instance for chaining
-