diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-07 16:57:06 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-04-07 16:57:06 +0000 |
commit | 5dcb5e02fb19040986eea8cb09604ba941cf30af (patch) | |
tree | 93f092f912992978d10ab221015aa0bd1e39a9ba | |
parent | 3908443717ba29ebcab3ff7e8f9971a1e2aad3b8 (diff) | |
download | Essentials-5dcb5e02fb19040986eea8cb09604ba941cf30af.tar Essentials-5dcb5e02fb19040986eea8cb09604ba941cf30af.tar.gz Essentials-5dcb5e02fb19040986eea8cb09604ba941cf30af.tar.lz Essentials-5dcb5e02fb19040986eea8cb09604ba941cf30af.tar.xz Essentials-5dcb5e02fb19040986eea8cb09604ba941cf30af.zip |
[trunk] Last heal, Last teleport: Don't error if it's the first time.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1144 e251c2fe-e539-e718-e476-b85c1f46cddb
-rw-r--r-- | Essentials/src/com/earth2me/essentials/User.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 1b14c7be5..b4c1fb452 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -139,10 +139,13 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo public void teleportCooldown(boolean justCheck) throws Exception { long now = Calendar.getInstance().getTimeInMillis(); - long cooldown = Essentials.getSettings().getTeleportCooldown(); - long left = lastTeleport + cooldown - now; - if (left > 0 && !isOp() && !isAuthorized("essentials.teleport.cooldown.bypass")) - throw new Exception("Time before next teleport: " + Essentials.FormatTime(left)); + if (lastTeleport > 0) { + long cooldown = Essentials.getSettings().getTeleportCooldown(); + long left = lastTeleport + cooldown - now; + if (left > 0 && !isOp() && !isAuthorized("essentials.teleport.cooldown.bypass")) { + throw new Exception("Time before next teleport: " + Essentials.FormatTime(left)); + } + } // if justCheck is set, don't update lastTeleport; we're just checking if (!justCheck) lastTeleport = now; } @@ -155,10 +158,13 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo public void healCooldown() throws Exception { long now = Calendar.getInstance().getTimeInMillis(); - long cooldown = Essentials.getSettings().getHealCooldown(); - long left = lastHeal + cooldown - now; - if (left > 0 && !isOp() && !isAuthorized("essentials.heal.cooldown.bypass")) - throw new Exception("Time before next heal: " + Essentials.FormatTime(left)); + if (lastHeal > 0) { + long cooldown = Essentials.getSettings().getHealCooldown(); + long left = lastHeal + cooldown - now; + if (left > 0 && !isOp() && !isAuthorized("essentials.heal.cooldown.bypass")) { + throw new Exception("Time before next heal: " + Essentials.FormatTime(left)); + } + } lastHeal = now; } |