From c2e5d5d9a39ee394147e0ee4ea739920b62ae4cb Mon Sep 17 00:00:00 2001 From: T00thpick1 Date: Fri, 19 Jul 2013 23:00:15 -0400 Subject: Add API to control scaled health. Adds BUKKIT-4590 --- src/main/java/org/bukkit/entity/Player.java | 36 ++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index 5c5d5268..3b58d120 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -650,21 +650,45 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline /** * Gets if the client is displayed a 'scaled' health, that is, health on a - * scale from 0-20. + * scale from 0-{@link #getHealthScale()}. * * @return if client health display is scaled - * @see Player#setScaledHealth(boolean) + * @see Player#setHealthScaled(boolean) */ - public boolean isScaledHealth(); + public boolean isHealthScaled(); /** * Sets if the client is displayed a 'scaled' health, that is, health on a - * scale from 0-20. + * scale from 0-{@link #getHealthScale()}. *

* Displayed health follows a simple formula displayedHealth = - * getHealth() / getMaxHealth() * 20.0D. + * getHealth() / getMaxHealth() * getHealthScale(). * * @param scale if the client health display is scaled */ - public void setScaleHealth(boolean scale); + public void setHealthScaled(boolean scale); + + /** + * Sets the number to scale health to for the client; this will also + * {@link #setHealthScaled(boolean) setHealthScaled(true)}. + *

+ * Displayed health follows a simple formula displayedHealth = + * getHealth() / getMaxHealth() * getHealthScale(). + * + * @param scale the number to scale health to + * @throws IllegalArgumentException if scale is <0 + * @throws IllegalArgumentException if scale is {@link Double#NaN} + * @throws IllegalArgumentException if scale is too high + */ + public void setHealthScale(double scale) throws IllegalArgumentException; + + /** + * Gets the number that health is scaled to for the client. + * + * @return the number that health would be scaled to for the client if + * HealthScaling is set to true + * @see Player#setHealthScale(double) + * @see Player#setHealthScaled(boolean) + */ + public double getHealthScale(); } -- cgit v1.2.3