aboutsummaryrefslogtreecommitdiff
path: root/spark-common/src/main/java/me/lucko/spark/common/command
diff options
context:
space:
mode:
authorManuel Kasten <kasten.m@gmx.de>2022-01-21 21:09:46 +0100
committerGitHub <noreply@github.com>2022-01-21 20:09:46 +0000
commitfe9b39b500ee2633db18ea14774daf01e2946824 (patch)
tree6748fa808f9ee0690be8e78b7bb8c79ac7708599 /spark-common/src/main/java/me/lucko/spark/common/command
parentbd0827f199e12a6b31e92e12fb33c549e2788ef8 (diff)
downloadspark-fe9b39b500ee2633db18ea14774daf01e2946824.tar.gz
spark-fe9b39b500ee2633db18ea14774daf01e2946824.tar.bz2
spark-fe9b39b500ee2633db18ea14774daf01e2946824.zip
Add disableResponseBroadcast config option (#158)
Diffstat (limited to 'spark-common/src/main/java/me/lucko/spark/common/command')
-rw-r--r--spark-common/src/main/java/me/lucko/spark/common/command/CommandResponseHandler.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/command/CommandResponseHandler.java b/spark-common/src/main/java/me/lucko/spark/common/command/CommandResponseHandler.java
index a9e2229..d1481bd 100644
--- a/spark-common/src/main/java/me/lucko/spark/common/command/CommandResponseHandler.java
+++ b/spark-common/src/main/java/me/lucko/spark/common/command/CommandResponseHandler.java
@@ -88,12 +88,20 @@ public class CommandResponseHandler {
}
public void broadcast(Component message) {
- allSenders(sender -> sender.sendMessage(message));
+ if (this.platform.shouldBroadcastResponse()) {
+ allSenders(sender -> sender.sendMessage(message));
+ } else {
+ reply(message);
+ }
}
public void broadcast(Iterable<Component> message) {
- Component joinedMsg = Component.join(JoinConfiguration.separator(Component.newline()), message);
- allSenders(sender -> sender.sendMessage(joinedMsg));
+ if (this.platform.shouldBroadcastResponse()) {
+ Component joinedMsg = Component.join(JoinConfiguration.separator(Component.newline()), message);
+ allSenders(sender -> sender.sendMessage(joinedMsg));
+ } else {
+ reply(message);
+ }
}
public void replyPrefixed(Component message) {