mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
41 lines
2.1 KiB
Diff
41 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/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -0,0 +0,0 @@ import net.minecraft.world.level.dimension.DimensionType;
|
|
import net.minecraft.world.level.portal.PortalInfo;
|
|
import net.minecraft.world.phys.AABB;
|
|
import net.minecraft.world.phys.Vec3;
|
|
+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;
|
|
import net.minecraft.world.Container;
|
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
|
public void trackChunk(ChunkPos chunkcoordintpair, Packet<?> packet, Packet<?> packet1) {
|
|
this.connection.send(packet1);
|
|
this.connection.send(packet);
|
|
+ // Paper start
|
|
+ if(PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0){
|
|
+ new PlayerChunkLoadEvent(this.getBukkitEntity().getWorld().getChunkAt(chunkcoordintpair.longKey), this.getBukkitEntity()).callEvent();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
public void untrackChunk(ChunkPos chunkcoordintpair) {
|
|
if (this.isAlive()) {
|
|
this.connection.send(new ClientboundForgetLevelChunkPacket(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
|
|
}
|
|
|
|
}
|