Paper/paper-server/patches/sources/net/minecraft/server/network/PlayerChunkSender.java.patch

27 lines
1.5 KiB
Diff
Raw Normal View History

2020-10-05 21:25:16 +02:00
--- a/net/minecraft/server/network/PlayerChunkSender.java
+++ b/net/minecraft/server/network/PlayerChunkSender.java
2024-12-14 17:00:39 +01:00
@@ -44,6 +_,11 @@
public void dropChunk(ServerPlayer player, ChunkPos chunkPos) {
if (!this.pendingChunks.remove(chunkPos.toLong()) && player.isAlive()) {
player.connection.send(new ClientboundForgetLevelChunkPacket(chunkPos));
2020-10-05 21:25:16 +02:00
+ // Paper start - PlayerChunkUnloadEvent
+ if (io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0) {
2024-12-14 17:00:39 +01:00
+ new io.papermc.paper.event.packet.PlayerChunkUnloadEvent(player.getBukkitEntity().getWorld().getChunkAt(chunkPos.longKey), player.getBukkitEntity()).callEvent();
2020-10-05 21:25:16 +02:00
+ }
+ // Paper end - PlayerChunkUnloadEvent
}
}
2024-12-14 17:00:39 +01:00
@@ -75,6 +_,11 @@
2020-10-05 21:25:16 +02:00
2024-12-14 17:00:39 +01:00
private static void sendChunk(ServerGamePacketListenerImpl packetListener, ServerLevel level, LevelChunk chunk) {
packetListener.send(new ClientboundLevelChunkWithLightPacket(chunk, level.getLightEngine(), null, null));
2020-10-05 21:25:16 +02:00
+ // Paper start - PlayerChunkLoadEvent
+ if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
2024-12-14 17:00:39 +01:00
+ new io.papermc.paper.event.packet.PlayerChunkLoadEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), packetListener.getPlayer().getBukkitEntity()).callEvent();
2020-10-05 21:25:16 +02:00
+ }
+ // Paper end - PlayerChunkLoadEvent
2024-12-14 17:00:39 +01:00
ChunkPos pos = chunk.getPos();
DebugPackets.sendPoiPacketsForChunk(level, pos);
2020-10-05 21:25:16 +02:00
}