aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0436-Player-Chunk-Load-Unload-Events.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-12-05 11:18:29 +0100
committerNassim Jahnke <[email protected]>2024-12-05 12:20:56 +0100
commite4e24f3335609b38f460ced71d18babcf11bf9cb (patch)
tree51880d664b3444ce26d6f8cdeb3b8219e5616fca /patches/server/0436-Player-Chunk-Load-Unload-Events.patch
parentc54c062e6ff742445bf7749c84106ca67090172d (diff)
downloadPaper-e4e24f3335609b38f460ced71d18babcf11bf9cb.tar.gz
Paper-e4e24f3335609b38f460ced71d18babcf11bf9cb.zip
Move around patches again
Diffstat (limited to 'patches/server/0436-Player-Chunk-Load-Unload-Events.patch')
-rw-r--r--patches/server/0436-Player-Chunk-Load-Unload-Events.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/patches/server/0436-Player-Chunk-Load-Unload-Events.patch b/patches/server/0436-Player-Chunk-Load-Unload-Events.patch
new file mode 100644
index 0000000000..0fee853cd3
--- /dev/null
+++ b/patches/server/0436-Player-Chunk-Load-Unload-Events.patch
@@ -0,0 +1,34 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: ysl3000 <[email protected]>
+Date: Mon, 5 Oct 2020 21:25:16 +0200
+Subject: [PATCH] Player Chunk Load/Unload Events
+
+
+diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
+index 7c4b795b8a0f58dd07bc5acb1e309476bf4cbe90..cdd66e6ce96e2613afe7f06ca8da3cfaa6704b2d 100644
+--- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
++++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
+@@ -44,6 +44,11 @@ public class PlayerChunkSender {
+ public void dropChunk(ServerPlayer player, ChunkPos pos) {
+ if (!this.pendingChunks.remove(pos.toLong()) && player.isAlive()) {
+ player.connection.send(new ClientboundForgetLevelChunkPacket(pos));
++ // Paper start - PlayerChunkUnloadEvent
++ if (io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0) {
++ new io.papermc.paper.event.packet.PlayerChunkUnloadEvent(player.getBukkitEntity().getWorld().getChunkAt(pos.longKey), player.getBukkitEntity()).callEvent();
++ }
++ // Paper end - PlayerChunkUnloadEvent
+ }
+ }
+
+@@ -75,6 +80,11 @@ public class PlayerChunkSender {
+
+ private static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) {
+ handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null));
++ // Paper start - PlayerChunkLoadEvent
++ if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
++ new io.papermc.paper.event.packet.PlayerChunkLoadEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), handler.getPlayer().getBukkitEntity()).callEvent();
++ }
++ // Paper end - PlayerChunkLoadEvent
+ ChunkPos chunkPos = chunk.getPos();
+ DebugPackets.sendPoiPacketsForChunk(world, chunkPos);
+ }