mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-28 18:54:48 +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) {
|
+ if (this.camera == this) {
|
||||||
+ com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity());
|
+ com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity());
|
||||||
+ if (!playerStopSpectatingEntityEvent.callEvent()) {
|
+ if (!playerStopSpectatingEntityEvent.callEvent()) {
|
||||||
|
+ this.camera = entity1; // rollback camera entity again
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ } else {
|
+ } else {
|
||||||
+ com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent playerStartSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity(), entity.getBukkitEntity());
|
+ com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent playerStartSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStartSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity(), entity.getBukkitEntity());
|
||||||
+ if (!playerStartSpectatingEntityEvent.callEvent()) {
|
+ if (!playerStartSpectatingEntityEvent.callEvent()) {
|
||||||
|
+ this.camera = entity1; // rollback camera entity again
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
@ -42,11 +44,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
Level world = this.camera.level();
|
Level world = this.camera.level();
|
||||||
|
|
||||||
if (world instanceof ServerLevel) {
|
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…
Add table
Reference in a new issue