SPIGOT-436: Add accompanying getSpectatorTarget().

This commit is contained in:
md_5 2015-06-12 15:34:54 +10:00
parent 8f0f4ed80f
commit 0dfb243c86

View File

@ -1315,6 +1315,12 @@ 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))); 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 org.bukkit.entity.Entity getSpectatorTarget() {
Entity followed = getHandle().C(); // PAIL
return followed == getHandle() ? null : followed.getBukkitEntity();
}
@Override @Override
public void setSpectatorTarget(org.bukkit.entity.Entity entity) { public void setSpectatorTarget(org.bukkit.entity.Entity entity) {
Preconditions.checkArgument(getGameMode() == GameMode.SPECTATOR, "Player must be in spectator mode"); Preconditions.checkArgument(getGameMode() == GameMode.SPECTATOR, "Player must be in spectator mode");