Paper/patches/unapplied/server/0636-Allow-using-signs-inside-spawn-protection.patch
2021-11-30 19:26:33 +01:00

35 lines
2.7 KiB
Diff

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
index dfd4aac7a6e184a79bfdf15d9b5a92dbcb06fadd..080b5d5d78e5f65c4367f07abcf1c47356354365 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -818,5 +818,10 @@ public class PaperWorldConfig {
fixWitherTargetingBug = getBoolean("fix-wither-targeting-bug", false);
log("Withers properly target players: " + fixWitherTargetingBug);
}
+
+ 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 6de62cbd8475d04c765d532731336638225525bc..2d459cf7899461fbacaa22b0b2d68a73578bc95f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1723,7 +1723,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int i = this.player.level.getMaxBuildHeight();
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((net.minecraft.world.entity.player.Player) 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((net.minecraft.world.entity.player.Player) this.player, blockposition) || (worldserver.paperConfig.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper
// CraftBukkit start - Check if we can actually do something over this large a distance
// Paper - move check up
this.player.stopUsingItem(); // SPIGOT-4706