Paper/Spigot-Server-Patches/0338-Don-t-allow-digging-into-unloaded-chunks.patch

26 lines
1.2 KiB
Diff
Raw Normal View History

2019-07-20 12:01:24 +08:00
From df1b6feb04b62e6ff414815fdc5746fec3bd584f Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 11 Nov 2018 21:01:09 +0000
Subject: [PATCH] Don't allow digging into unloaded chunks
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 9eb6982508..45c2777552 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1259,6 +1259,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK:
+ // Paper start - Don't allow digging in unloaded chunks
+ if (this.player.world.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
+ return;
+ }
+ // Paper end - Don't allow digging in unloaded chunks
this.player.playerInteractManager.a(blockposition, packetplayinblockdig_enumplayerdigtype, packetplayinblockdig.c(), this.minecraftServer.getMaxBuildHeight());
return;
default:
--
2.22.0