Add PlayerClientLoadedWorldEvent (#11940)

This commit is contained in:
EnZaXD
2025-01-25 21:47:08 +01:00
committed by GitHub
parent 2477f1f6a9
commit fb5b173c6a
4 changed files with 87 additions and 6 deletions

View File

@@ -373,7 +373,7 @@
this.awaitingPositionFromClient.x,
this.awaitingPositionFromClient.y,
this.awaitingPositionFromClient.z,
@@ -495,6 +_,7 @@
@@ -495,12 +_,20 @@
this.lastGoodZ = this.awaitingPositionFromClient.z;
this.player.hasChangedDimension();
this.awaitingPositionFromClient = null;
@@ -381,6 +381,19 @@
}
}
@Override
public void handleAcceptPlayerLoad(ServerboundPlayerLoadedPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
+ // Paper start - PlayerLoadedWorldEvent
+ if (this.player.hasClientLoaded()) {
+ return;
+ }
+ final io.papermc.paper.event.player.PlayerClientLoadedWorldEvent event = new io.papermc.paper.event.player.PlayerClientLoadedWorldEvent(this.player.getBukkitEntity(), false);
+ event.callEvent();
+ // Paper end - PlayerLoadedWorldEvent
this.player.setClientLoaded(true);
}
@@ -521,6 +_,7 @@
@Override
public void handleRecipeBookChangeSettingsPacket(ServerboundRecipeBookChangeSettingsPacket packet) {