mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-13 18:14:38 +02: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:
@@ -139,10 +139,13 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
|
|||||||
public void teleportCooldown(boolean justCheck) throws Exception
|
public void teleportCooldown(boolean justCheck) throws Exception
|
||||||
{
|
{
|
||||||
long now = Calendar.getInstance().getTimeInMillis();
|
long now = Calendar.getInstance().getTimeInMillis();
|
||||||
|
if (lastTeleport > 0) {
|
||||||
long cooldown = Essentials.getSettings().getTeleportCooldown();
|
long cooldown = Essentials.getSettings().getTeleportCooldown();
|
||||||
long left = lastTeleport + cooldown - now;
|
long left = lastTeleport + cooldown - now;
|
||||||
if (left > 0 && !isOp() && !isAuthorized("essentials.teleport.cooldown.bypass"))
|
if (left > 0 && !isOp() && !isAuthorized("essentials.teleport.cooldown.bypass")) {
|
||||||
throw new Exception("Time before next teleport: " + Essentials.FormatTime(left));
|
throw new Exception("Time before next teleport: " + Essentials.FormatTime(left));
|
||||||
|
}
|
||||||
|
}
|
||||||
// if justCheck is set, don't update lastTeleport; we're just checking
|
// if justCheck is set, don't update lastTeleport; we're just checking
|
||||||
if (!justCheck) lastTeleport = now;
|
if (!justCheck) lastTeleport = now;
|
||||||
}
|
}
|
||||||
@@ -155,10 +158,13 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
|
|||||||
public void healCooldown() throws Exception
|
public void healCooldown() throws Exception
|
||||||
{
|
{
|
||||||
long now = Calendar.getInstance().getTimeInMillis();
|
long now = Calendar.getInstance().getTimeInMillis();
|
||||||
|
if (lastHeal > 0) {
|
||||||
long cooldown = Essentials.getSettings().getHealCooldown();
|
long cooldown = Essentials.getSettings().getHealCooldown();
|
||||||
long left = lastHeal + cooldown - now;
|
long left = lastHeal + cooldown - now;
|
||||||
if (left > 0 && !isOp() && !isAuthorized("essentials.heal.cooldown.bypass"))
|
if (left > 0 && !isOp() && !isAuthorized("essentials.heal.cooldown.bypass")) {
|
||||||
throw new Exception("Time before next heal: " + Essentials.FormatTime(left));
|
throw new Exception("Time before next heal: " + Essentials.FormatTime(left));
|
||||||
|
}
|
||||||
|
}
|
||||||
lastHeal = now;
|
lastHeal = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user