aboutsummaryrefslogtreecommitdiffhomepage
path: root/removed/0280-Configurable-Unrestricted-Signs.patch
diff options
context:
space:
mode:
authorShane Freeder <[email protected]>2018-07-18 19:55:52 +0100
committerShane Freeder <[email protected]>2018-07-18 19:55:52 +0100
commitf3b00978d9d6ec92da6fffe75bc2c8634034cbf8 (patch)
treed75f2d6f18f5c47ad9a0cce9a63d598d0f18fc5c /removed/0280-Configurable-Unrestricted-Signs.patch
parentdd390c99fdc76621424dc15486fb66aa8dab7e26 (diff)
downloadPaper-f3b00978d9d6ec92da6fffe75bc2c8634034cbf8.tar.gz
Paper-f3b00978d9d6ec92da6fffe75bc2c8634034cbf8.zip
NOT FINISHED! 1.13 pre-7 - Holy moley, more patches!
Really, don't touch! may harm your cat!
Diffstat (limited to 'removed/0280-Configurable-Unrestricted-Signs.patch')
-rw-r--r--removed/0280-Configurable-Unrestricted-Signs.patch83
1 files changed, 83 insertions, 0 deletions
diff --git a/removed/0280-Configurable-Unrestricted-Signs.patch b/removed/0280-Configurable-Unrestricted-Signs.patch
new file mode 100644
index 0000000000..3fc4d862d8
--- /dev/null
+++ b/removed/0280-Configurable-Unrestricted-Signs.patch
@@ -0,0 +1,83 @@
+From cbe35161f2e8a59c22aca9a0d5412674d128df41 Mon Sep 17 00:00:00 2001
+From: Aikar <[email protected]>
+Date: Wed, 21 Mar 2018 19:57:10 -0400
+Subject: [PATCH] Configurable Unrestricted Signs
+
+Bukkit restricts command execution of signs to test if the sender
+has permission to run the specified command. This breaks vanilla
+maps that use signs to intentionally run as elevated permission.
+
+Bukkit provides an unrestricted advancements setting, so this setting
+compliments that one and allows for unrestricted signs.
+
+We still filter sign update packets to strip out commands at edit phase,
+however there is no sanity in ever expecting creative mode to not be
+able to create signs with any command.
+
+Creative servers should absolutely never enable this.
+Non creative servers, enable at own risk!!!
+
+diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
+index 3f2c5b2d5..67bd3bcbe 100644
+--- a/src/main/java/net/minecraft/server/TileEntitySign.java
++++ b/src/main/java/net/minecraft/server/TileEntitySign.java
+@@ -38,7 +38,7 @@ public class TileEntitySign extends TileEntity {
+ public void load(NBTTagCompound nbttagcompound) {
+ this.isEditable = false;
+ super.load(nbttagcompound);
+- ICommandListener icommandlistener = new ICommandListener() {
++ ICommandListener icommandlistener = new ISignCommandListener() { // Paper
+ public String getName() {
+ return "Sign";
+ }
+@@ -125,7 +125,7 @@ public class TileEntitySign extends TileEntity {
+ }
+
+ public boolean b(final EntityHuman entityhuman) {
+- ICommandListener icommandlistener = new ICommandListener() {
++ ICommandListener icommandlistener = new ISignCommandListener() { // Paper
+ public String getName() {
+ return entityhuman.getName();
+ }
+@@ -200,4 +200,5 @@ public class TileEntitySign extends TileEntity {
+ public CommandObjectiveExecutor f() {
+ return this.i;
+ }
++ public interface ISignCommandListener extends ICommandListener {} // Paper
+ }
+diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+index e86c16755..6095948e8 100644
+--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+@@ -175,6 +175,7 @@ public final class CraftServer implements Server {
+ private CraftIconCache icon;
+ private boolean overrideAllCommandBlockCommands = false;
+ private boolean unrestrictedAdvancements;
++ private boolean unrestrictedSignCommands; // Paper
+ private final List<CraftPlayer> playerView;
+ public int reloadCount;
+ public static Exception excessiveVelEx; // Paper - Velocity warnings
+@@ -253,6 +254,12 @@ public final class CraftServer implements Server {
+ saveCommandsConfig();
+ overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
+ unrestrictedAdvancements = commandsConfiguration.getBoolean("unrestricted-advancements");
++ // Paper start
++ unrestrictedSignCommands = commandsConfiguration.getBoolean("unrestricted-signs");
++ if (unrestrictedSignCommands) {
++ logger.warning("Warning: Commands are no longer restricted on signs. If you allow players to use Creative Mode, there may be risk of players bypassing permissions. Use this setting at your own risk!!!!");
++ }
++ // Paper end
+ pluginManager.useTimings(configuration.getBoolean("settings.plugin-profiling"));
+ monsterSpawn = configuration.getInt("spawn-limits.monsters");
+ animalSpawn = configuration.getInt("spawn-limits.animals");
+@@ -270,6 +277,7 @@ public final class CraftServer implements Server {
+ listener = ((CommandListenerWrapper) listener).base;
+ }
+
++ if (unrestrictedSignCommands && listener instanceof TileEntitySign.ISignCommandListener) return true; // Paper
+ return unrestrictedAdvancements && listener instanceof AdvancementRewards.AdvancementCommandListener;
+ }
+
+--
+2.18.0
+