2022-06-17 00:03:02 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Thu, 16 Jun 2022 14:22:56 -0700
|
|
|
|
Subject: [PATCH] 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
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
2024-10-23 23:12:09 +02:00
|
|
|
index a0e59b236dff1f861a0e987764a77ee203504412..5cb39f95bd2d45b6c18554605f01d2ebf6473428 100644
|
2022-06-17 00:03:02 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
|
2024-04-30 00:16:07 +02:00
|
|
|
@@ -178,6 +178,7 @@ public abstract class BaseCommandBlock implements CommandSource {
|
2022-06-17 00:03:02 +02:00
|
|
|
@Override
|
|
|
|
public void sendSystemMessage(Component message) {
|
|
|
|
if (this.trackOutput) {
|
2024-01-18 15:56:25 +01:00
|
|
|
+ org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper - Don't broadcast messages to command blocks
|
2022-06-17 00:03:02 +02:00
|
|
|
SimpleDateFormat simpledateformat = BaseCommandBlock.TIME_FORMAT;
|
|
|
|
Date date = new Date();
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
Rework async chunk api implementation
Firstly, the old methods all routed to the CompletableFuture method.
However, the CF method could not guarantee that if the caller
was off-main that the future would be "completed" on-main. Since
the callback methods used the CF one, this meant that the callback
methods did not guarantee that the callbacks were to be called on
the main thread.
Now, all methods route to getChunkAtAsync(x, z, gen, urgent, cb)
so that the methods with the callback are guaranteed to invoke
the callback on the main thread. The CF behavior remains unchanged;
it may still appear to complete on main if invoked off-main.
Secondly, remove the scheduleOnMain invocation in the async
chunk completion. This unnecessarily delays the callback
by 1 tick.
Thirdly, add getChunksAtAsync(minX, minZ, maxX, maxZ, ...) which
will load chunks within an area. This method is provided as a helper
as keeping all chunks loaded within an area can be complicated to
implement for plugins (due to the lacking ticket API), and is
already implemented internally anyways.
Fourthly, remove the ticket addition that occured with getChunkAt
and getChunkAtAsync. The ticket addition may delay the unloading
of the chunk unnecessarily. It also fixes a very rare timing bug
where the future/callback would be completed after the chunk
unloads.
2024-11-19 07:34:32 +01:00
|
|
|
index 557eb1a75a3115c3215315deae56a42d665693df..e890f87c66e95e7d4f130c4c659c6662b4f4bd94 100644
|
2022-06-17 00:03:02 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2024-10-27 18:11:15 +01:00
|
|
|
@@ -1928,7 +1928,7 @@ public final class CraftServer implements Server {
|
2022-06-17 00:03:02 +02:00
|
|
|
// Paper end
|
|
|
|
Set<CommandSender> recipients = new HashSet<>();
|
|
|
|
for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {
|
|
|
|
- if (permissible instanceof CommandSender && permissible.hasPermission(permission)) {
|
2024-01-18 15:56:25 +01:00
|
|
|
+ if (permissible instanceof CommandSender && !(permissible instanceof org.bukkit.command.BlockCommandSender) && permissible.hasPermission(permission)) { // Paper - Don't broadcast messages to command blocks
|
2022-06-17 00:03:02 +02:00
|
|
|
recipients.add((CommandSender) permissible);
|
|
|
|
}
|
|
|
|
}
|