mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 22:13:42 +01:00
9623b5f19c
A recent commit has been made that caused patches to be out of order, rebuilding
42 lines
2.0 KiB
Diff
42 lines
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/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
index 976c44c8eeecc513fa11de55b80317550f621407..7240b885d96eb2df187b6229449af1a893a4524e 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
|
@@ -16,6 +16,8 @@ import java.util.OptionalInt;
|
|
import java.util.Random;
|
|
import java.util.UUID;
|
|
import javax.annotation.Nullable;
|
|
+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;
|
|
|
|
@@ -1938,11 +1940,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
|
|
}
|
|
|
|
}
|