Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-29 01:20:10 +01:00
a207d14a0e
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
42 Zeilen
2.1 KiB
Diff
42 Zeilen
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 1b5f24920c46cd238a79f5a2857d26fa1c12b983..ff831ca0cbc0cabbf78178c609ccf70d78da7980 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -136,6 +136,8 @@ 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;
|
|
@@ -2095,11 +2097,21 @@ 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
|
|
}
|
|
|
|
}
|