1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-17 18:47:40 +01:00

Don't broadcast messages to command blocks

Previously the broadcast method would update the last output
in command blocks, and if called asynchronously, would throw
an error
This commit is contained in:
Jake Potrebic 2022-06-16 14:22:56 -07:00
parent 1f68916ac9
commit 5cf40e45af
2 changed files with 10 additions and 2 deletions
paper-server
patches/sources/net/minecraft/world/level
src/main/java/org/bukkit/craftbukkit

View file

@ -20,7 +20,15 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Executing command block");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Command to be executed");
@@ -200,7 +204,7 @@
@@ -174,6 +178,7 @@
@Override
public void sendSystemMessage(Component message) {
if (this.trackOutput) {
+ org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper - Don't broadcast messages to command blocks
SimpleDateFormat simpledateformat = BaseCommandBlock.TIME_FORMAT;
Date date = new Date();
@@ -200,7 +205,7 @@
}
public InteractionResult usedBy(Player player) {

View file

@ -1928,7 +1928,7 @@ public final class CraftServer implements Server {
// Paper end
Set<CommandSender> recipients = new HashSet<>();
for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {
if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
if (permissible instanceof CommandSender && !(permissible instanceof org.bukkit.command.BlockCommandSender) && permissible.hasPermission(permission)) { // Paper - Don't broadcast messages to command blocks
recipients.add((CommandSender) permissible);
}
}