13
0
geforkt von Mirrors/Paper

Fix entity camera not being reset when cancelling spectating start/stop events (#9883)

Dieser Commit ist enthalten in:
booky10 2023-10-29 02:45:07 +02:00
Ursprung 5165228828
Commit 5df63ec242

Datei anzeigen

@ -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