geforkt von Mirrors/Paper
654b792caf
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes:a339310c
#755: Fix NPE when calling getInventory() for virtual EnderChests2577f9bf
Increase outdated build delay1dabfdc8
#754: Fix pre-1.16 serialized SkullMeta being broken on 1.16+, losing textures
69 Zeilen
4.3 KiB
Diff
69 Zeilen
4.3 KiB
Diff
From 0000000000000000000000000000000000000000 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 1ec968d871d00e6589c8572eabda9d0fb8f8f226..4861666aa091554dea8aa6f8563547eceb26041e 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -1292,6 +1292,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:
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
index 0aa9b3a0d2aec8072fe32e43ed16946f22b29fab..b129d650c940d5b98f7dd04542c293e3f3045569 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
@@ -80,8 +80,8 @@ public class PlayerInteractManager {
|
|
IBlockData iblockdata;
|
|
|
|
if (this.j) {
|
|
- iblockdata = this.world.getType(this.k);
|
|
- if (iblockdata.isAir()) {
|
|
+ iblockdata = this.world.getTypeIfLoaded(this.k); // Paper
|
|
+ if (iblockdata == null || iblockdata.isAir()) { // Paper
|
|
this.j = false;
|
|
} else {
|
|
float f = this.a(iblockdata, this.k, this.l);
|
|
@@ -92,7 +92,13 @@ public class PlayerInteractManager {
|
|
}
|
|
}
|
|
} else if (this.f) {
|
|
- iblockdata = this.world.getType(this.h);
|
|
+ // Paper start - don't want to do same logic as above, return instead
|
|
+ iblockdata = this.world.getTypeIfLoaded(this.h);
|
|
+ if (iblockdata == null) {
|
|
+ this.f = false;
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
if (iblockdata.isAir()) {
|
|
this.world.a(this.player.getId(), this.h, -1);
|
|
this.m = -1;
|
|
@@ -256,10 +262,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.f = false;
|
|
- if (!Objects.equals(this.h, blockposition)) {
|
|
+ if (!Objects.equals(this.h, blockposition) && !BlockPosition.ZERO.equals(this.h)) {
|
|
PlayerInteractManager.LOGGER.debug("Mismatch in destroy block pos: " + this.h + " " + blockposition); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled
|
|
- this.world.a(this.player.getId(), this.h, -1);
|
|
- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.h, this.world.getType(this.h), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying"));
|
|
+ IBlockData type = this.world.getTypeIfLoaded(this.h); // Paper - don't load unloaded chunks for stale records here
|
|
+ if (type != null) this.world.a(this.player.getId(), this.h, -1); // Paper
|
|
+ if (type != null) this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.h, type, packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying")); // Paper
|
|
+ this.h = BlockPosition.ZERO; // Paper
|
|
}
|
|
|
|
this.world.a(this.player.getId(), blockposition, -1);
|