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