3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Call PlayerChunkUnloadEvent

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-07-19 13:50:38 +02:00
Ursprung 7ea403902b
Commit e71c1df54c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
2 geänderte Dateien mit 12 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -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) {

Datei anzeigen

@ -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 {