From ee9f0d513fc8d79a49175f72210f70a454d30218 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 22 May 2020 18:57:48 -0400 Subject: [PATCH] Fix another case of breaking blocks causing sync chunk loads --- ...t-allow-digging-into-unloaded-chunks.patch | 30 +++++++++++++++++-- Spigot-Server-Patches/0384-Anti-Xray.patch | 4 +-- ...26-Add-permission-for-command-blocks.patch | 4 +-- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Spigot-Server-Patches/0325-Don-t-allow-digging-into-unloaded-chunks.patch b/Spigot-Server-Patches/0325-Don-t-allow-digging-into-unloaded-chunks.patch index 4a6cbfec3..2173e54d9 100644 --- a/Spigot-Server-Patches/0325-Don-t-allow-digging-into-unloaded-chunks.patch +++ b/Spigot-Server-Patches/0325-Don-t-allow-digging-into-unloaded-chunks.patch @@ -21,10 +21,36 @@ index fe25754521d5cf7059130f14acaf61a6646c5360..ab94132590e3743e45ca345c3e30b811 return; default: diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index e2e5c17c24c8f5e9807ca879b1025d13cb195226..17b7eddac4fadfd1cc3027fe6fbcd2bd5611fb84 100644 +index e2e5c17c24c8f5e9807ca879b1025d13cb195226..ed3f3362b640746649455f8dd2255ac2da03df7c 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -253,10 +253,12 @@ public class PlayerInteractManager { +@@ -69,8 +69,8 @@ public class PlayerInteractManager { + IBlockData iblockdata; + + if (this.i) { +- iblockdata = this.world.getType(this.j); +- if (iblockdata.isAir()) { ++ iblockdata = this.world.getTypeIfLoaded(this.j); // Paper ++ if (iblockdata == null || iblockdata.isAir()) { // Paper + this.i = false; + } else { + float f = this.a(iblockdata, this.j, this.k); +@@ -81,7 +81,13 @@ public class PlayerInteractManager { + } + } + } else if (this.e) { +- iblockdata = this.world.getType(this.g); ++ // Paper start - don't want to do same logic as above, return instead ++ iblockdata = this.world.getTypeIfLoaded(this.g); ++ if (iblockdata == null) { ++ this.e = false; ++ return; ++ } ++ // Paper end + if (iblockdata.isAir()) { + this.world.a(this.player.getId(), this.g, -1); + this.l = -1; +@@ -253,10 +259,12 @@ public class PlayerInteractManager { this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, "stopped destroying")); } else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) { this.e = false; diff --git a/Spigot-Server-Patches/0384-Anti-Xray.patch b/Spigot-Server-Patches/0384-Anti-Xray.patch index 3af401613..5521cf2ec 100644 --- a/Spigot-Server-Patches/0384-Anti-Xray.patch +++ b/Spigot-Server-Patches/0384-Anti-Xray.patch @@ -1325,10 +1325,10 @@ index 9171785ad54a26e95dea8b30509c1e49a5d9b22d..94b0c54d9d4d77b724087be55ffe6ce4 } diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 17b7eddac4fadfd1cc3027fe6fbcd2bd5611fb84..ce66090b8dcd846db4507b99e3ef1a2d6104d19b 100644 +index ed3f3362b640746649455f8dd2255ac2da03df7c..f11ef84df85c1e7ada9c62247b7882f19ae32089 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -266,6 +266,8 @@ public class PlayerInteractManager { +@@ -272,6 +272,8 @@ public class PlayerInteractManager { } } diff --git a/Spigot-Server-Patches/0526-Add-permission-for-command-blocks.patch b/Spigot-Server-Patches/0526-Add-permission-for-command-blocks.patch index 56a705d7e..08ca98479 100644 --- a/Spigot-Server-Patches/0526-Add-permission-for-command-blocks.patch +++ b/Spigot-Server-Patches/0526-Add-permission-for-command-blocks.patch @@ -53,10 +53,10 @@ index f692276617d9c24ded5e887090e00642b0d63eba..b25b3b48165e5fef4db99c2838de21d4 } else { CommandBlockListenerAbstract commandblocklistenerabstract = packetplayinsetcommandminecart.a(this.player.world); diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index ce66090b8dcd846db4507b99e3ef1a2d6104d19b..b1c05304cc4c97ea0df0ea11d8d59c095288ba96 100644 +index f11ef84df85c1e7ada9c62247b7882f19ae32089..6df8434612d4afe411b2c435f4c847b9183570f8 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -344,7 +344,7 @@ public class PlayerInteractManager { +@@ -350,7 +350,7 @@ public class PlayerInteractManager { TileEntity tileentity = this.world.getTileEntity(blockposition); Block block = iblockdata.getBlock();