From b844286f48863e5416ad6304079b5ffe90ffbadd Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 14 Jun 2022 01:51:53 -0700 Subject: [PATCH] Fix command signs patch update (#7976) --- ...ommands-from-signs-not-firing-command-events.patch | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/patches/server/0675-Fix-commands-from-signs-not-firing-command-events.patch b/patches/server/0675-Fix-commands-from-signs-not-firing-command-events.patch index c7d5ed0d5d..01d4a6921d 100644 --- a/patches/server/0675-Fix-commands-from-signs-not-firing-command-events.patch +++ b/patches/server/0675-Fix-commands-from-signs-not-firing-command-events.patch @@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..01a2bc1feec808790bb93618ce46adb9 + } +} diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -index 831db5ee21938d71e99bf9d17b92a6ca15531740..6c96c3dde4e1b1b1b6952841edb41006e73737e9 100644 +index 831db5ee21938d71e99bf9d17b92a6ca15531740..def4fdd2c7e4f925fa128692a744e5d10ae0203a 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java @@ -40,6 +40,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C @@ -69,10 +69,11 @@ index 831db5ee21938d71e99bf9d17b92a6ca15531740..6c96c3dde4e1b1b1b6952841edb41006 public SignBlockEntity(BlockPos pos, BlockState state) { super(BlockEntityType.SIGN, pos, state); -@@ -225,6 +226,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C +@@ -224,7 +225,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C + ClickEvent chatclickable = chatmodifier.getClickEvent(); if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) { - player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(player), chatclickable.getValue()); +- player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(player), chatclickable.getValue()); + // Paper start + String command = chatclickable.getValue().startsWith("/") ? chatclickable.getValue() : "/" + chatclickable.getValue(); + if (org.spigotmc.SpigotConfig.logCommands) { @@ -82,12 +83,12 @@ index 831db5ee21938d71e99bf9d17b92a6ca15531740..6c96c3dde4e1b1b1b6952841edb41006 + if (!event.callEvent()) { + return false; + } -+ player.getServer().getCommands().performCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage()); ++ player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage()); + // Paper end } } -@@ -260,8 +272,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C +@@ -260,8 +271,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C String s = player == null ? "Sign" : player.getName().getString(); Object object = player == null ? Component.literal("Sign") : player.getDisplayName();