Paper/patches/server/0608-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-06-03 06:26:56 +02:00
index 09e8305cee635c1fb0b490de531eee79d9b15137..cea095aae3f9ba4ed8be88282d48925ad667f0d9 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
@@ -837,4 +837,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
2022-06-03 06:26:56 +02:00
index 4dc7697f5a6e14663211ebb1cbf1cd16a7436a7e..400c1bd9964a640a35146c7a80fae08de08be963 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);