From 5df63ec242dcacf0404d91a5d197d816ef62ac12 Mon Sep 17 00:00:00 2001 From: booky10 <53302036+booky10@users.noreply.github.com> Date: Sun, 29 Oct 2023 02:45:07 +0200 Subject: [PATCH] Fix entity camera not being reset when cancelling spectating start/stop events (#9883) --- ...ayer-spectator-target-events-and-improve-impl.patch | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/patches/server/Call-player-spectator-target-events-and-improve-impl.patch b/patches/server/Call-player-spectator-target-events-and-improve-impl.patch index 464d8ee1e5..5979846644 100644 --- a/patches/server/Call-player-spectator-target-events-and-improve-impl.patch +++ b/patches/server/Call-player-spectator-target-events-and-improve-impl.patch @@ -30,11 +30,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (this.camera == this) { + com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity()); + if (!playerStopSpectatingEntityEvent.callEvent()) { ++ this.camera = entity1; // rollback camera entity again + return; + } + } else { + com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent playerStartSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity(), entity.getBukkitEntity()); + if (!playerStartSpectatingEntityEvent.callEvent()) { ++ this.camera = entity1; // rollback camera entity again + return; + } + } @@ -42,11 +44,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Level world = this.camera.level(); if (world instanceof ServerLevel) { -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { - this.connection.send(new ClientboundSetCameraPacket(this.camera)); - this.connection.resetPosition(); - } -- - } - - @Override