From 8f2a45bf35d7afa7305eb6f9778f0ecd1974c346 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 26 Apr 2019 13:01:07 +1000 Subject: [PATCH] Clean diff in PlayerChunkMap --- nms-patches/PlayerChunkMap.patch | 33 +++++++++++++------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/nms-patches/PlayerChunkMap.patch b/nms-patches/PlayerChunkMap.patch index 49e3c5ced1..06c2f89bcf 100644 --- a/nms-patches/PlayerChunkMap.patch +++ b/nms-patches/PlayerChunkMap.patch @@ -44,7 +44,7 @@ } }); -@@ -280,13 +293,34 @@ +@@ -280,13 +293,27 @@ for (int i = 0; longiterator.hasNext() && (booleansupplier.getAsBoolean() || i < 200 || this.unloadQueue.size() > 2000); longiterator.remove()) { long j = longiterator.nextLong(); @@ -54,14 +54,7 @@ if (playerchunk != null) { + // CraftBukkit start + ChunkUnloadEvent event = null; -+ IChunkAccess access = null; -+ try { -+ access = playerchunk.getChunkSave().get(5, TimeUnit.SECONDS); -+ } catch (ExecutionException ex) { -+ throw new CompletionException(ex); -+ } catch (InterruptedException | TimeoutException ex) { -+ System.err.println("Failed to save chunk " + playerchunk + " " + playerchunk.getChunkSave()); -+ } ++ IChunkAccess access = playerchunk.getChunk(); + + if (access instanceof Chunk) { + event = new ChunkUnloadEvent(((Chunk) access).bukkitChunk, access.isNeedsSaving()); @@ -81,7 +74,7 @@ } } } -@@ -294,17 +328,23 @@ +@@ -294,17 +321,23 @@ gameprofilerfiller.exit(); } @@ -108,7 +101,7 @@ if (this.h.remove(i) && ichunkaccess instanceof Chunk) { Chunk chunk = (Chunk) ichunkaccess; -@@ -394,7 +434,7 @@ +@@ -394,7 +427,7 @@ return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); }, (runnable) -> { @@ -117,7 +110,7 @@ }); } } -@@ -454,7 +494,10 @@ +@@ -454,7 +487,10 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -129,7 +122,7 @@ if (list == null) { list = Lists.newArrayList(new Entity[] { entity}); } else { -@@ -476,7 +519,7 @@ +@@ -476,7 +512,7 @@ long i = playerchunk.h().pair(); playerchunk.getClass(); @@ -138,7 +131,7 @@ }); } -@@ -493,7 +536,7 @@ +@@ -493,7 +529,7 @@ return Either.left(chunk); }); }, (runnable) -> { @@ -147,7 +140,7 @@ }); completablefuture1.thenAcceptAsync((either) -> { -@@ -507,7 +550,7 @@ +@@ -507,7 +543,7 @@ return Either.left(chunk); }); }, (runnable) -> { @@ -156,7 +149,7 @@ }); return completablefuture1; } -@@ -517,8 +560,14 @@ +@@ -517,8 +553,14 @@ } public void saveChunk(IChunkAccess ichunkaccess) { @@ -172,7 +165,7 @@ try { this.world.checkSession(); } catch (ExceptionWorldConflict exceptionworldconflict) { -@@ -569,9 +618,10 @@ +@@ -569,9 +611,10 @@ ChunkCoordIntPair chunkcoordintpair = playerchunk.h(); Packet[] apacket = new Packet[2]; @@ -184,7 +177,7 @@ boolean flag1 = i1 <= this.A; this.sendChunk(entityplayer, chunkcoordintpair, apacket, flag, flag1); -@@ -626,7 +676,7 @@ +@@ -626,7 +669,7 @@ private NBTTagCompound f(ChunkCoordIntPair chunkcoordintpair) throws IOException { NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); @@ -193,7 +186,7 @@ } boolean d(ChunkCoordIntPair chunkcoordintpair) { -@@ -946,7 +996,7 @@ +@@ -946,7 +989,7 @@ public final Set trackedPlayers = Sets.newHashSet(); public EntityTracker(Entity entity, int i, int j, boolean flag) { @@ -202,7 +195,7 @@ this.tracker = entity; this.trackingDistance = i; this.e = SectionPosition.a(entity); -@@ -1015,6 +1065,17 @@ +@@ -1015,6 +1058,17 @@ } }