Paper/patches/server/0607-Allow-using-signs-inside-spawn-protection.patch

34 lines
2.6 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Anton Lindroth <ntoonio@gmail.com>
Date: Wed, 15 Apr 2020 01:54:02 +0200
Subject: [PATCH] Allow using signs inside spawn protection
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
2022-03-11 21:13:46 +01:00
index cdcb877e374bcd2dd944c754bfc91e23ef6986ae..3ea410faba8412fa5aa1c1b6bcdd3aeddc982f59 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
2022-03-11 21:13:46 +01:00
@@ -784,4 +784,9 @@ public class PaperWorldConfig {
2021-11-29 12:55:13 +01:00
delayChunkUnloadsBy *= 20;
}
2021-06-11 14:02:28 +02:00
}
+
+ public boolean allowUsingSignsInsideSpawnProtection = false;
+ private void allowUsingSignsInsideSpawnProtection() {
+ allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection);
+ }
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c58a01989e1aa9999534fbf4b718244778dd9497..efee98799e5196c9f1adf73a0f4ff0590ed96b5f 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1756,7 +1756,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
2022-03-01 06:43:03 +01:00
int i = this.player.level.getMaxBuildHeight();
2021-06-11 14:02:28 +02:00
2022-03-01 06:43:03 +01:00
if (blockposition.getY() < i) {
- if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - sign check
this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);