No need to retrieve the chunk to send unload packets

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-11-19 06:06:32 +01:00
parent bf5c5aa479
commit cca614fea8
1 changed files with 2 additions and 7 deletions

View File

@ -129,13 +129,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
};
final IntegerBiConsumer chunkRemover = (chunkX, chunkZ) -> {
// Unload old chunks
final Instance instance = this.instance;
if (instance == null) return;
final Chunk chunk = instance.getChunk(chunkX, chunkZ);
if (chunk != null) {
sendPacket(new UnloadChunkPacket(chunkX, chunkZ));
GlobalHandles.PLAYER_CHUNK_UNLOAD.call(new PlayerChunkUnloadEvent(this, chunkX, chunkZ));
}
sendPacket(new UnloadChunkPacket(chunkX, chunkZ));
GlobalHandles.PLAYER_CHUNK_UNLOAD.call(new PlayerChunkUnloadEvent(this, chunkX, chunkZ));
};
private final AtomicInteger teleportId = new AtomicInteger();