mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-03-07 12:47:29 +08:00
[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
This commit is contained in:
parent
3908443717
commit
5dcb5e02fb
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user