From bc7a5cd6739cad56b2496960ce1724661707aa8b Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Fri, 17 Jun 2011 02:28:25 -0400 Subject: [PATCH] Added per player time support. Thanks eisental, Shamebot and needspeed10! --- src/main/java/org/bukkit/entity/Player.java | 42 +++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index 2346aa03..b51324d7 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -236,4 +236,46 @@ public interface Player extends HumanEntity, CommandSender { * @param amount Amount to increment this statistic by */ public void incrementStatistic(Statistic statistic, Material material, int amount); + + /** + * Sets the current time on the player's client. When relative is true the player's time + * will be kept synchronized to its world time with the specified offset. + * + * When using non relative time the player's time will stay fixed at the specified time parameter. It's up to + * the caller to continue updating the player's time. To restore player time to normal use resetPlayerTime(). + * + * @param time The current player's perceived time or the player's time offset from the server time. + * @param relative When true the player time is kept relative to its world time. + */ + public void setPlayerTime(long time, boolean relative); + + /** + * Returns the player's current timestamp. + * + * @return + */ + public long getPlayerTime(); + + /** + * Returns the player's current time offset relative to server time, or the current player's fixed time + * if the player's time is absolute. + * + * @return + */ + public long getPlayerTimeOffset(); + + /** + * Returns true if the player's time is relative to the server time, otherwise the player's time is absolute and + * will not change its current time unless done so with setPlayerTime(). + * + * @return true if the player's time is relative to the server time. + */ + public boolean isPlayerTimeRelative(); + + /** + * Restores the normal condition where the player's time is synchronized with the server time. + * Equivalent to calling setPlayerTime(0, true). + */ + public void resetPlayerTime(); + }