public interface BaseMessage<R,M>
限定符和类型 | 方法和说明 |
---|---|
void |
apply(R receiver,
M message)
向接收者发送消息的根方法。
|
default void |
broadcast(@NotNull java.util.Map<java.lang.String,java.lang.Object> placeholders)
广播此消息(包括后台)
|
default void |
broadcast(java.lang.Object... values)
广播此消息(包括后台)
|
@Unmodifiable @NotNull java.lang.Iterable<R> |
getAllReceivers()
得到所有的接收者
|
@NotNull java.lang.String[] |
getParams()
得到消息中的通过
MessageValueBuilder.params(String...) 已定变量名(按定义顺序) |
M |
parse(R receiver,
@NotNull java.util.Map<java.lang.String,java.lang.Object> placeholders)
为某位接收者解析此消息。
|
default M |
parse(R receiver,
java.lang.Object... values)
为某位接收者解析此消息。
|
default @NotNull PreparedMessage<R,M> |
prepare(java.lang.Object... values)
填入变量值,返回一个准备好待发送的消息。
|
default void |
send(R receiver,
@NotNull java.util.Map<java.lang.String,java.lang.Object> placeholders)
向某位接收者发送消息
|
default void |
send(R receiver,
java.lang.Object... values)
向某位接收者发送消息
|
default void |
sendToAll(@NotNull java.util.Map<java.lang.String,java.lang.Object> placeholders)
广播此消息(包括后台)
|
default void |
sendToAll(java.lang.Object... values)
广播此消息(包括后台)
|
default void |
sendToEach(@NotNull java.util.function.Function<R,java.lang.Object[]> eachValues)
向全部接收者(包括后台)发送不同参数的消息
|
default void |
sendToEach(@Nullable java.util.function.Predicate<R> limiter,
@NotNull java.util.function.Function<R,java.lang.Object[]> eachValues)
向特定接收者发送不同参数的消息
|
@NotNull @Unmodifiable @NotNull java.lang.Iterable<R> getAllReceivers()
@NotNull @NotNull java.lang.String[] getParams()
MessageValueBuilder.params(String...)
已定变量名(按定义顺序)@ApiStatus.OverrideOnly void apply(@NotNull R receiver, @NotNull M message)
receiver
- 接收者message
- 消息内容@NotNull default @NotNull PreparedMessage<R,M> prepare(@NotNull java.lang.Object... values)
values
- 变量值@Nullable M parse(@Nullable R receiver, @NotNull @NotNull java.util.Map<java.lang.String,java.lang.Object> placeholders)
receiver
- 接收者placeholders
- 消息中的变量与对应参数@Nullable default M parse(@Nullable R receiver, @Nullable java.lang.Object... values)
receiver
- 接收者values
- 已定变量的对应参数default void send(@Nullable R receiver, @Nullable java.lang.Object... values)
receiver
- 消息的接收者values
- 已定变量的对应参数default void send(@Nullable R receiver, @NotNull @NotNull java.util.Map<java.lang.String,java.lang.Object> placeholders)
receiver
- 消息的接收者placeholders
- 消息中的变量与对应参数default void sendToEach(@NotNull @NotNull java.util.function.Function<R,java.lang.Object[]> eachValues)
eachValues
- 每位接收者将收到已定变量的对应参数(按定义顺序)default void sendToEach(@Nullable @Nullable java.util.function.Predicate<R> limiter, @NotNull @NotNull java.util.function.Function<R,java.lang.Object[]> eachValues)
limiter
- 接收者限定器,为空则不限定接收者。eachValues
- 每位接收者将收到已定变量的对应参数(按定义顺序)default void sendToAll(@Nullable java.lang.Object... values)
values
- 已定变量的对应参数(按定义顺序)default void sendToAll(@NotNull @NotNull java.util.Map<java.lang.String,java.lang.Object> placeholders)
placeholders
- 消息中的变量与对应参数default void broadcast(@Nullable java.lang.Object... values)
values
- 已定变量的对应参数(按定义顺序)default void broadcast(@NotNull @NotNull java.util.Map<java.lang.String,java.lang.Object> placeholders)
placeholders
- 消息中的变量与对应参数Copyright © 2024. All rights reserved.