From 8e00f47527b3560f5c4db509a291a08efff3feb7 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Wed, 19 Jun 2019 15:48:48 -0700 Subject: [PATCH] Fix MC-154214 (#2195) This should resolve unloading issues. --- Spigot-Server-Patches/Fix-MC-154214.patch | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Spigot-Server-Patches/Fix-MC-154214.patch diff --git a/Spigot-Server-Patches/Fix-MC-154214.patch b/Spigot-Server-Patches/Fix-MC-154214.patch new file mode 100644 index 0000000000..01916ae4de --- /dev/null +++ b/Spigot-Server-Patches/Fix-MC-154214.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sun, 16 Jun 2019 23:30:25 -0700 +Subject: [PATCH] Fix MC-154214 + +Avoid adding player tickets when they're out of range of the closest player + +diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java +index 705ca68798..799c134e4b 100644 +--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java +@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { + } + + private void a(long i, int j, boolean flag, boolean flag1) { ++ final long chunkPosition = i; // Paper - conflict on variable change + if (flag != flag1) { + Ticket ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i), ChunkMapDistance.this.currentTick); + + if (flag1) { + ChunkMapDistance.this.m.a(ChunkTaskQueueSorter.a(() -> { // Paper - decompile fix + ChunkMapDistance.this.p.execute(() -> { ++ // Paper start - Fix MC-154214 ++ if (!this.inRange(this.getNearestDistanceFromPlayerMap().get(chunkPosition))) { ++ return; ++ } ++ // Paper end + ChunkMapDistance.this.a(i, ticket); + ChunkMapDistance.this.o.add(i); + }); +@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { + + } + ++ private final boolean inRange(int distance) { return this.c(distance); } // Paper - OBFHELPER + private boolean c(int i) { + return i <= this.e - 2; + } +@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { + + class b extends ChunkMap { + +- protected final Long2ByteMap a = new Long2ByteOpenHashMap(); ++ protected final Long2ByteMap a = new Long2ByteOpenHashMap(); protected final Long2ByteMap getNearestDistanceFromPlayerMap() { return this.a; } // Paper - OBFHELPER + protected final int b; + + protected b(int i) { +-- \ No newline at end of file