mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-15 23:25:37 +01:00
Call PlayerChunkUnloadEvent
This commit is contained in:
parent
7ea403902b
commit
e71c1df54c
@ -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
|
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
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..244674dc44d80ee5ce78d2ed2c6ab94fd5d3d07f
|
index 0000000000000000000000000000000000000000..7249b78e21b12117480a18f2d07d0c978fe42e56
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/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
|
||||||
@@ -0,0 +1,1076 @@
|
@@ -0,0 +1,1082 @@
|
||||||
+package ca.spottedleaf.moonrise.patches.chunk_system.player;
|
+package ca.spottedleaf.moonrise.patches.chunk_system.player;
|
||||||
+
|
+
|
||||||
+import ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor;
|
+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
|
+ // Note: drop isAlive() check so that chunks properly unload client-side when the player dies
|
||||||
+ ((ChunkSystemChunkHolder)((ChunkSystemServerLevel)this.world).moonrise$getChunkTaskScheduler().chunkHolderManager
|
+ ((ChunkSystemChunkHolder)((ChunkSystemServerLevel)this.world).moonrise$getChunkTaskScheduler().chunkHolderManager
|
||||||
+ .getChunkHolder(chunkX, chunkZ).vanillaChunkHolder).moonrise$removeReceivedChunk(this.player);
|
+ .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) {
|
+ private final SingleUserAreaMap<PlayerChunkLoaderData> broadcastMap = new SingleUserAreaMap<>(this) {
|
||||||
|
@ -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
|
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
|
--- 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
|
+++ 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
|
// 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
|
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
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/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 {
|
@@ -3484,6 +3484,35 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
Loading…
Reference in New Issue
Block a user