From 75912b19d6af2a5c580823ae4453a243e93cd21b Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 7 Jun 2015 17:54:29 +1000 Subject: [PATCH] SPIGOT-436: Add spectator camera API. By: md_5 --- .../java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index e229dc0735..82e2a90afc 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.entity; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import com.mojang.authlib.GameProfile; import io.netty.buffer.Unpooled; @@ -1313,4 +1314,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } collection.add(new AttributeModifiable(getHandle().getAttributeMap(), (new AttributeRanged(null, "generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); } + + @Override + public void setSpectatorTarget(org.bukkit.entity.Entity entity) { + Preconditions.checkArgument(getGameMode() == GameMode.SPECTATOR, "Player must be in spectator mode"); + getHandle().setSpectatorTarget((entity == null) ? null : ((CraftEntity) entity).getHandle()); + } }