Handle CraftPlayer#setSpectatorTarget better

Use a proper teleport for teleporting to entities in different
worlds.

Validate that the target entity is valid and deny spectate
requests from frozen players.

Also, make sure the entity is spawned to the client before
sending the camera packet. If the entity isn't spawned clientside
when it receives the camera packet, then the client will not
spectate the target entity.
This commit is contained in:
Spottedleaf
2020-05-14 18:05:00 -05:00
parent 7ead67800e
commit 4e7644ce04
3 changed files with 102 additions and 69 deletions

View File

@@ -116,7 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private boolean ci = true;
+ private boolean ci = true; public boolean hasChatColorsEnabled() { return this.ci; } // Paper - OBFHELPER
private long cj = SystemUtils.getMonotonicMillis();
private Entity spectatedEntity; private void setSpectatorTargetField(Entity e) { this.spectatedEntity = e; } // Paper - OBFHELPER
private Entity spectatedEntity;
public boolean worldChangeInvuln;
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}