Exemplo n.º 1
0
  public void checkDelay(final User user) throws Exception {
    long nextUse = getNextUse(user);

    if (nextUse == 0L) {
      return;
    } else if (nextUse < 0L) {
      user.sendMessage(tl("kitOnce"));
      throw new NoChargeException();
    } else {
      user.sendMessage(tl("kitTimed", DateUtil.formatDateDiff(nextUse)));
      throw new NoChargeException();
    }
  }
Exemplo n.º 2
0
 @Override
 public void healCooldown() throws Exception {
   final Calendar now = new GregorianCalendar();
   if (getLastHealTimestamp() > 0) {
     final double cooldown = ess.getSettings().getHealCooldown();
     final Calendar cooldownTime = new GregorianCalendar();
     cooldownTime.setTimeInMillis(getLastHealTimestamp());
     cooldownTime.add(Calendar.SECOND, (int) cooldown);
     cooldownTime.add(Calendar.MILLISECOND, (int) ((cooldown * 1000.0) % 1000.0));
     if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass")) {
       throw new Exception(
           tl("timeBeforeHeal", DateUtil.formatDateDiff(cooldownTime.getTimeInMillis())));
     }
   }
   setLastHealTimestamp(now.getTimeInMillis());
 }