mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 06:30:46 +01:00
Fix entity camera not being reset when cancelling spectating start/stop events (#9883)
This commit is contained in:
parent
5165228828
commit
5df63ec242
1 changed files with 2 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue