Tidy up PVP attack delay.

This commit is contained in:
KHobbits 2012-05-22 21:02:28 +01:00
parent dc36a50d85
commit 7f5f6b6ac9
2 changed files with 9 additions and 6 deletions

View File

@ -33,8 +33,8 @@ public class EssentialsEntityListener implements Listener
final User defender = ess.getUser(eDefend);
final User attacker = ess.getUser(eAttack);
if (!attacker.isAuthorized("essentials.pvpdelay.exempt") &&
System.currentTimeMillis() < (attacker.getLastLogin() + ess.getSettings().getLoginAttackDelay()))
if (ess.getSettings().getLoginAttackDelay() > 0 && !attacker.isAuthorized("essentials.pvpdelay.exempt")
&& (System.currentTimeMillis() < (attacker.getLastLogin() + ess.getSettings().getLoginAttackDelay())))
{
event.setCancelled(true);
}

View File

@ -388,6 +388,7 @@ public class Settings implements ISettings
cancelAfkOnMove = _cancelAfkOnMove();
getFreezeAfkPlayers = _getFreezeAfkPlayers();
itemSpawnBl = _getItemSpawnBlacklist();
loginAttackDelay = _loginAttackDelay();
kits = _getKits();
chatFormats.clear();
}
@ -805,6 +806,8 @@ public class Settings implements ISettings
return teleportInvulnerability;
}
private long loginAttackDelay;
private long _loginAttackDelay()
{
return config.getLong("login-attack-delay", 0) * 1000;
@ -813,7 +816,7 @@ public class Settings implements ISettings
@Override
public long getLoginAttackDelay()
{
return _loginAttackDelay();
return loginAttackDelay;
}
}