mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 14:04:49 +01:00
Clean diff in PlayerChunkMap
This commit is contained in:
parent
e2bbf62bf4
commit
8f2a45bf35
1 changed files with 13 additions and 20 deletions
|
@ -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<EntityPlayer> 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 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue