aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-07-19 13:50:38 +0200
committerNassim Jahnke <[email protected]>2024-07-19 13:50:38 +0200
commite71c1df54c8829d77f62751860e8906db7748139 (patch)
tree8aadf603cad7db2484c917e488e6a38b04db5a64 /patches/server
parent7ea403902b81e15ec54a93972d337c4531a56b1e (diff)
downloadPaper-e71c1df54c8829d77f62751860e8906db7748139.tar.gz
Paper-e71c1df54c8829d77f62751860e8906db7748139.zip
Call PlayerChunkUnloadEvent
Diffstat (limited to 'patches/server')
-rw-r--r--patches/server/0988-Moonrise-optimisation-patches.patch12
-rw-r--r--patches/server/1015-API-for-checking-sent-chunks.patch6
2 files changed, 12 insertions, 6 deletions
diff --git a/patches/server/0988-Moonrise-optimisation-patches.patch b/patches/server/0988-Moonrise-optimisation-patches.patch
index d247d377e2..9412139853 100644
--- a/patches/server/0988-Moonrise-optimisation-patches.patch
+++ b/patches/server/0988-Moonrise-optimisation-patches.patch
@@ -4780,10 +4780,10 @@ index 0000000000000000000000000000000000000000..003a857e70ead858e8437e3c1bfaf22f
+}
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
new file mode 100644
-index 0000000000000000000000000000000000000000..244674dc44d80ee5ce78d2ed2c6ab94fd5d3d07f
+index 0000000000000000000000000000000000000000..7249b78e21b12117480a18f2d07d0c978fe42e56
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
-@@ -0,0 +1,1076 @@
+@@ -0,0 +1,1082 @@
+package ca.spottedleaf.moonrise.patches.chunk_system.player;
+
+import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor;
@@ -5216,7 +5216,13 @@ index 0000000000000000000000000000000000000000..244674dc44d80ee5ce78d2ed2c6ab94f
+ // 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) {
diff --git a/patches/server/1015-API-for-checking-sent-chunks.patch b/patches/server/1015-API-for-checking-sent-chunks.patch
index ea42e9e7d9..f3f1bf8f5c 100644
--- a/patches/server/1015-API-for-checking-sent-chunks.patch
+++ b/patches/server/1015-API-for-checking-sent-chunks.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] API for checking sent chunks
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
-index 244674dc44d80ee5ce78d2ed2c6ab94fd5d3d07f..bdf9244ab7e62f5d6cdd6e21e1a5daee1ddb37f4 100644
+index 7249b78e21b12117480a18f2d07d0c978fe42e56..ab18bbf87dfc1455ed185a5152dad6d236565ecc 100644
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
-@@ -1072,5 +1072,10 @@ public final class RegionizedPlayerChunkLoader {
+@@ -1078,5 +1078,10 @@ public final class RegionizedPlayerChunkLoader {
// now all tickets should be removed, which is all of our external state
}
@@ -20,7 +20,7 @@ index 244674dc44d80ee5ce78d2ed2c6ab94fd5d3d07f..bdf9244ab7e62f5d6cdd6e21e1a5daee
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-index 4e7da1be4acf1028022e62a652df3e262a85fa0f..a62ed0a348c22c1f315ca0deba63f7c2d09b709e 100644
+index 2f56cbcc1d1af98f58c310ff8b4ce33cc950e977..992437a6e838f653f32d33b5b3f702c484640a97 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3484,6 +3484,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player {