From 66dc0ac979e286fd1e582e7d0b6fae707f22e5b1 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke <nassim@njahnke.dev> Date: Fri, 19 Jul 2024 13:50:38 +0200 Subject: [PATCH] Call PlayerChunkUnloadEvent --- patches/server/Moonrise-optimisation-patches.patch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/patches/server/Moonrise-optimisation-patches.patch b/patches/server/Moonrise-optimisation-patches.patch index 281511d097..6ba8413e58 100644 --- a/patches/server/Moonrise-optimisation-patches.patch +++ b/patches/server/Moonrise-optimisation-patches.patch @@ -5216,7 +5216,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Note: drop isAlive() check so that chunks properly unload client-side when the player dies + ((ChunkSystemChunkHolder)((ChunkSystemServerLevel)this.world).moonrise$getChunkTaskScheduler().chunkHolderManager + .getChunkHolder(chunkX, chunkZ).vanillaChunkHolder).moonrise$removeReceivedChunk(this.player); -+ this.player.connection.send(new ClientboundForgetLevelChunkPacket(new ChunkPos(chunkX, chunkZ))); ++ final ChunkPos chunkPos = new ChunkPos(chunkX, chunkZ); ++ this.player.connection.send(new ClientboundForgetLevelChunkPacket(chunkPos)); ++ // Paper start - PlayerChunkUnloadEvent ++ if (io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0) { ++ new io.papermc.paper.event.packet.PlayerChunkUnloadEvent(this.world.getWorld().getChunkAt(chunkPos.longKey), this.player.getBukkitEntity()).callEvent(); ++ } ++ // Paper end - PlayerChunkUnloadEvent + } + + private final SingleUserAreaMap<PlayerChunkLoaderData> broadcastMap = new SingleUserAreaMap<>(this) {