2024-12-11 22:26:55 +01:00
|
|
|
--- a/net/minecraft/world/level/BaseCommandBlock.java
|
|
|
|
+++ b/net/minecraft/world/level/BaseCommandBlock.java
|
2024-12-15 00:42:27 +01:00
|
|
|
@@ -32,6 +_,11 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
private String command = "";
|
2024-04-23 17:15:00 +02:00
|
|
|
@Nullable
|
2024-12-11 22:26:55 +01:00
|
|
|
private Component customName;
|
2018-07-15 02:00:00 +02:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ @Override
|
2024-12-11 22:26:55 +01:00
|
|
|
+ public abstract org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper);
|
2018-07-15 02:00:00 +02:00
|
|
|
+ // CraftBukkit end
|
2024-12-15 00:42:27 +01:00
|
|
|
+
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2024-12-15 00:42:27 +01:00
|
|
|
public int getSuccessCount() {
|
|
|
|
return this.successCount;
|
|
|
|
@@ -126,7 +_,7 @@
|
|
|
|
this.successCount++;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
- server.getCommands().performPrefixedCommand(commandSourceStack, this.command);
|
2024-12-15 16:11:42 +01:00
|
|
|
+ server.getCommands().dispatchServerCommand(commandSourceStack, this.command); // CraftBukkit
|
2024-12-15 00:42:27 +01:00
|
|
|
} catch (Throwable var6) {
|
|
|
|
CrashReport crashReport = CrashReport.forThrowable(var6, "Executing command block");
|
|
|
|
CrashReportCategory crashReportCategory = crashReport.addCategory("Command to be executed");
|
|
|
|
@@ -162,6 +_,7 @@
|
2022-06-16 23:22:56 +02:00
|
|
|
@Override
|
2024-12-15 00:42:27 +01:00
|
|
|
public void sendSystemMessage(Component component) {
|
2022-06-16 23:22:56 +02:00
|
|
|
if (this.trackOutput) {
|
|
|
|
+ org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper - Don't broadcast messages to command blocks
|
2024-12-15 00:42:27 +01:00
|
|
|
this.lastOutput = Component.literal("[" + TIME_FORMAT.format(new Date()) + "] ").append(component);
|
|
|
|
this.onUpdated();
|
|
|
|
}
|
|
|
|
@@ -184,7 +_,7 @@
|
2020-05-16 10:05:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public InteractionResult usedBy(Player player) {
|
|
|
|
- if (!player.canUseGameMasterBlocks()) {
|
|
|
|
+ if (!player.canUseGameMasterBlocks() && (!player.isCreative() || !player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
|
|
|
|
return InteractionResult.PASS;
|
|
|
|
} else {
|
|
|
|
if (player.getCommandSenderWorld().isClientSide) {
|