13
0
geforkt von Mirrors/Paper

Fix incorrectly loading chunks on a cancelled interact event

A players previous block break location is held onto permanently, and if
an interact event is cancelled, the client sends a stop breaking block packet
This then tries to update client about that old location.

This old location might then be in a now unloaded chunk, and it caused it to load.

We now also clear reference to it once abort destroy block is ran to stop trying
to send updates about the old block anyways.
Dieser Commit ist enthalten in:
Aikar 2020-04-12 23:56:29 -04:00
Ursprung bdcc31caad
Commit 59453f6675
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE
2 geänderte Dateien mit 44 neuen und 24 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,11 @@
From 3d0505501e290200e593976d9619ba105ce59ae8 Mon Sep 17 00:00:00 2001
From 5cc6e94e8ff0ce6d1921fde051ff102140c7b0f3 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 bde60377ee..b21fca9e5c 100644
index bde60377e..b21fca9e5 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1272,6 +1272,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -20,6 +20,26 @@ index bde60377ee..b21fca9e5c 100644
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 e2e5c17c2..17b7eddac 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 {
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;
- if (!Objects.equals(this.g, blockposition)) {
+ if (!Objects.equals(this.g, blockposition) && !BlockPosition.ZERO.equals(this.g)) { // Paper
PlayerInteractManager.LOGGER.debug("Mismatch in destroy block pos: " + this.g + " " + blockposition); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled
- this.world.a(this.player.getId(), this.g, -1);
- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.g, this.world.getType(this.g), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying"));
+ IBlockData type = this.world.getTypeIfLoaded(this.g); // Paper - don't load unloaded chunks for stale records here
+ if (type != null) this.world.a(this.player.getId(), this.g, -1); // Paper
+ if (type != null) this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.g, type, packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying")); // Paper
+ this.g = BlockPosition.ZERO; // Paper
}
this.world.a(this.player.getId(), blockposition, -1);
--
2.25.1

Datei anzeigen

@ -1,11 +1,11 @@
From 833bdad19f788c3c40f284e503720e1e81243374 Mon Sep 17 00:00:00 2001
From 9057ed657effb5ccf49fd5d7452f496c2062d61a Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com>
Date: Mon, 20 Aug 2018 03:03:58 +0200
Subject: [PATCH] Anti-Xray
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 4867615215..df24e3297b 100644
index 486761521..df24e3297 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -1,7 +1,11 @@
@ -66,7 +66,7 @@ index 4867615215..df24e3297b 100644
}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java
new file mode 100644
index 0000000000..f7e376ce6a
index 000000000..f7e376ce6
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockController.java
@@ -0,0 +1,46 @@
@ -118,7 +118,7 @@ index 0000000000..f7e376ce6a
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
new file mode 100644
index 0000000000..23626bef3a
index 000000000..23626bef3
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
@@ -0,0 +1,782 @@
@ -906,7 +906,7 @@ index 0000000000..23626bef3a
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java
new file mode 100644
index 0000000000..a68bace353
index 000000000..a68bace35
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfo.java
@@ -0,0 +1,81 @@
@ -993,7 +993,7 @@ index 0000000000..a68bace353
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java
new file mode 100644
index 0000000000..067dfb2f14
index 000000000..067dfb2f1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketInfoAntiXray.java
@@ -0,0 +1,31 @@
@ -1030,7 +1030,7 @@ index 0000000000..067dfb2f14
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java
new file mode 100644
index 0000000000..cc586827aa
index 000000000..cc586827a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java
@@ -0,0 +1,56 @@
@ -1092,7 +1092,7 @@ index 0000000000..cc586827aa
+}
diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java
new file mode 100644
index 0000000000..37093419cf
index 000000000..37093419c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java
@@ -0,0 +1,84 @@
@ -1181,7 +1181,7 @@ index 0000000000..37093419cf
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 1709f9b842..b6ba0cb79e 100644
index 1709f9b84..b6ba0cb79 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -320,7 +320,7 @@ public class Chunk implements IChunkAccess {
@ -1194,7 +1194,7 @@ index 1709f9b842..b6ba0cb79e 100644
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 961228e9df..a950ad801d 100644
index 47e074a12..8816c90e2 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -57,7 +57,7 @@ public class ChunkRegionLoader {
@ -1216,7 +1216,7 @@ index 961228e9df..a950ad801d 100644
protochunk.a(biomestorage);
object = protochunk;
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
index 0d5deee365..4526527aca 100644
index 0d5deee36..4526527ac 100644
--- a/src/main/java/net/minecraft/server/ChunkSection.java
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
@@ -6,21 +6,31 @@ public class ChunkSection {
@ -1255,7 +1255,7 @@ index 0d5deee365..4526527aca 100644
public IBlockData getType(int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java
index 2c1d1b1a55..44aed67274 100644
index 2c1d1b1a5..44aed6727 100644
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
@@ -3,6 +3,7 @@ package net.minecraft.server;
@ -1377,7 +1377,7 @@ index 2c1d1b1a55..44aed67274 100644
if (this.h == this.b) {
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index e156804f7a..96a785af27 100644
index e156804f7..96a785af2 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -42,7 +42,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
@ -1440,7 +1440,7 @@ index e156804f7a..96a785af27 100644
public void a() {
this.o();
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
index 47710067a6..ef7ade797b 100644
index 47710067a..ef7ade797 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java
@@ -1,5 +1,6 @@
@ -1533,7 +1533,7 @@ index 47710067a6..ef7ade797b 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 027a6b0fd2..50135446f7 100644
index 027a6b0fd..50135446f 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -220,6 +220,11 @@ public class PlayerChunk {
@ -1558,7 +1558,7 @@ index 027a6b0fd2..50135446f7 100644
this.a(new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, chunk), false);
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 5ac370720c..b4c9d544fe 100644
index 5ac370720..b4c9d544f 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -603,7 +603,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@ -1580,10 +1580,10 @@ index 5ac370720c..b4c9d544fe 100644
}
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index e2e5c17c24..ce4340a476 100644
index 17b7eddac..ce66090b8 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -264,6 +264,8 @@ public class PlayerInteractManager {
@@ -266,6 +266,8 @@ public class PlayerInteractManager {
}
}
@ -1593,7 +1593,7 @@ index e2e5c17c24..ce4340a476 100644
public void a(BlockPosition blockposition, PacketPlayInBlockDig.EnumPlayerDigType packetplayinblockdig_enumplayerdigtype, String s) {
diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java
index 39339fa275..f376e21068 100644
index 39339fa27..f376e2106 100644
--- a/src/main/java/net/minecraft/server/ProtoChunk.java
+++ b/src/main/java/net/minecraft/server/ProtoChunk.java
@@ -45,16 +45,28 @@ public class ProtoChunk implements IChunkAccess {
@ -1636,7 +1636,7 @@ index 39339fa275..f376e21068 100644
return this.j[i];
diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java
index f82db93f88..1d1b267f32 100644
index f82db93f8..1d1b267f3 100644
--- a/src/main/java/net/minecraft/server/TicketType.java
+++ b/src/main/java/net/minecraft/server/TicketType.java
@@ -21,6 +21,7 @@ public class TicketType<T> {
@ -1648,7 +1648,7 @@ index f82db93f88..1d1b267f32 100644
public static <T> TicketType<T> a(String s, Comparator<T> comparator) {
return new TicketType<>(s, comparator, 0L);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 8cf3c10274..0bde171743 100644
index 8cf3c1027..0bde17174 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2,6 +2,8 @@ package net.minecraft.server;
@ -1685,7 +1685,7 @@ index 8cf3c10274..0bde171743 100644
if (iblockdata1 == null) {
// CraftBukkit start - remove blockstate if failed (or the same)
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
index 8191e7c348..969d548de2 100644
index 8191e7c34..969d548de 100644
--- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
@@ -21,9 +21,11 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {