Paper/Spigot-Server-Patches/0617-Player-Chunk-Load-Unload-Events.patch
Mariell Hoversholm 9889c651ce apply fixup
I managed to move it, yet forgot to actually fix it up...
2021-03-19 07:54:18 +01:00

42 lines
2.1 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/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index b420e93590d0f109ad13b8ddaa5cd093da9e067d..9522a4a2060fc8b1bda53f72414810ac09915275 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -139,6 +139,8 @@ import net.minecraft.world.scores.ScoreboardScore;
import net.minecraft.world.scores.ScoreboardTeam;
import net.minecraft.world.scores.ScoreboardTeamBase;
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
+import io.papermc.paper.event.packet.PlayerChunkLoadEvent; // Paper
+import io.papermc.paper.event.packet.PlayerChunkUnloadEvent; // Paper
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -2088,11 +2090,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(ChunkCoordIntPair chunkcoordintpair, Packet<?> packet, Packet<?> packet1) {
this.playerConnection.sendPacket(packet1);
this.playerConnection.sendPacket(packet);
+ // Paper start
+ if(PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0){
+ new PlayerChunkLoadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkcoordintpair.longKey), this.getBukkitEntity()).callEvent();
+ }
+ // Paper end
}
public void a(ChunkCoordIntPair chunkcoordintpair) {
if (this.isAlive()) {
this.playerConnection.sendPacket(new PacketPlayOutUnloadChunk(chunkcoordintpair.x, chunkcoordintpair.z));
+ // Paper start
+ if(PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0){
+ new PlayerChunkUnloadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkcoordintpair.longKey), this.getBukkitEntity()).callEvent();
+ }
+ // Paper end
}
}