summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2015-06-07 17:54:29 +1000
committermd_5 <git@md-5.net>2015-06-09 09:17:54 +1000
commitf4ecc39ffc711fdc3da07e8d869ab5c15b9296dc (patch)
tree93c51ad364a2538377e821ca3016bdcc07111a06 /src
parent53433de98d7e83dca4ff77d83447e7fca57d3639 (diff)
downloadcraftbukkit-f4ecc39ffc711fdc3da07e8d869ab5c15b9296dc.tar
craftbukkit-f4ecc39ffc711fdc3da07e8d869ab5c15b9296dc.tar.gz
craftbukkit-f4ecc39ffc711fdc3da07e8d869ab5c15b9296dc.tar.lz
craftbukkit-f4ecc39ffc711fdc3da07e8d869ab5c15b9296dc.tar.xz
craftbukkit-f4ecc39ffc711fdc3da07e8d869ab5c15b9296dc.zip
SPIGOT-436: Add spectator camera API.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e229dc07..82e2a90a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/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());
+ }
}