2023-07-01 20:21:13 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2024-02-13 21:52:00 +00:00
|
|
|
From: Allink <arclicious@vivaldi.net>
|
2024-01-24 01:05:59 +00:00
|
|
|
Date: Tue, 23 Jan 2024 19:04:22 -0600
|
2023-07-01 20:21:13 +00:00
|
|
|
Subject: [PATCH] Fix ClickEvents on Signs bypassing permissions
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2024-02-18 18:44:06 +00:00
|
|
|
index 927c7ea03560be0c86884cec70ee8e408e66cb07..c4bb1739ddcfd473ef788f97afa1019e24da8561 100644
|
2023-07-01 20:21:13 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
|
|
|
@@ -8,8 +8,10 @@ import java.util.Objects;
|
|
|
|
import java.util.UUID;
|
|
|
|
import java.util.function.UnaryOperator;
|
|
|
|
import javax.annotation.Nullable;
|
2024-01-24 01:05:59 +00:00
|
|
|
+import me.totalfreedom.scissors.ScissorsConfig;
|
2023-07-01 20:21:13 +00:00
|
|
|
import net.minecraft.commands.CommandSource;
|
|
|
|
import net.minecraft.commands.CommandSourceStack;
|
2024-01-24 01:05:59 +00:00
|
|
|
+import net.minecraft.commands.Commands;
|
2023-07-01 20:21:13 +00:00
|
|
|
import net.minecraft.core.BlockPos;
|
|
|
|
import net.minecraft.nbt.CompoundTag;
|
|
|
|
import net.minecraft.nbt.NbtOps;
|
|
|
|
@@ -19,6 +21,7 @@ import net.minecraft.network.chat.Component;
|
|
|
|
import net.minecraft.network.chat.ComponentUtils;
|
|
|
|
import net.minecraft.network.chat.Style;
|
|
|
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
2024-01-24 01:05:59 +00:00
|
|
|
+import net.minecraft.server.MinecraftServer;
|
2023-07-01 20:21:13 +00:00
|
|
|
import net.minecraft.server.level.ServerLevel;
|
|
|
|
import net.minecraft.server.level.ServerPlayer;
|
|
|
|
import net.minecraft.server.network.FilteredText;
|
2024-01-24 01:05:59 +00:00
|
|
|
@@ -32,6 +35,8 @@ import net.minecraft.world.level.block.SignBlock;
|
2023-07-01 20:21:13 +00:00
|
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
|
|
import net.minecraft.world.phys.Vec2;
|
|
|
|
import net.minecraft.world.phys.Vec3;
|
2024-01-24 01:05:59 +00:00
|
|
|
+import org.bukkit.craftbukkit.CraftServer;
|
|
|
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
2023-07-01 20:21:13 +00:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.bukkit.block.sign.Side;
|
|
|
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
2023-12-11 01:20:31 +00:00
|
|
|
@@ -289,6 +294,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
2023-07-01 20:21:13 +00:00
|
|
|
}
|
|
|
|
player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
|
2024-01-24 01:05:59 +00:00
|
|
|
// Paper end - Fix commands from signs not firing command events
|
2023-07-01 20:21:13 +00:00
|
|
|
+ // Scissors start - Add optional permissions to command signs
|
|
|
|
+ final MinecraftServer vanillaServer = player.getServer();
|
|
|
|
+ final CraftServer craftServer = vanillaServer.server;
|
|
|
|
+ final CraftHumanEntity craftPlayer = player.getBukkitEntity();
|
|
|
|
+ final Commands commands = vanillaServer.getCommands();
|
|
|
|
+
|
|
|
|
+ if (ScissorsConfig.commandSignsBypassPermissions)
|
|
|
|
+ {
|
|
|
|
+ commands.performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ craftServer.dispatchCommand(craftPlayer, command.substring(1));
|
|
|
|
+ }
|
|
|
|
+ // Scissors end
|
|
|
|
flag1 = true;
|
|
|
|
}
|
|
|
|
}
|