geforkt von Mirrors/Paper
b3ec8bd8ae
This reverts commit 81c5901c67
.
35 Zeilen
2.0 KiB
Diff
35 Zeilen
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: ysl3000 <yannicklamprecht@live.de>
|
|
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 0f7ee2eea68a5c910bdf4d6263ed09cbed592516..ef85236b958d8187959c7d446bc2f3c7480854bb 100644
|
|
--- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
|
|
+++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
|
|
@@ -45,6 +45,11 @@ public class PlayerChunkSender {
|
|
// Paper start - rewrite player chunk loader
|
|
public static void dropChunkStatic(ServerPlayer player, ChunkPos pos) {
|
|
player.connection.send(new ClientboundForgetLevelChunkPacket(pos));
|
|
+ // Paper start
|
|
+ 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
|
|
}
|
|
// Paper end - rewrite player chunk loader
|
|
|
|
@@ -84,6 +89,11 @@ public class PlayerChunkSender {
|
|
|
|
public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - rewrite chunk loader - public
|
|
handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null));
|
|
+ // Paper start
|
|
+ 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
|
|
ChunkPos chunkPos = chunk.getPos();
|
|
DebugPackets.sendPoiPacketsForChunk(world, chunkPos);
|
|
}
|