Merge branch 'master' of github.com:essentials/Essentials

This commit is contained in:
KHobbits 2012-05-22 17:54:39 +01:00
commit dc36a50d85
4 changed files with 27 additions and 2 deletions

View File

@ -9,8 +9,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.inventory.ItemStack;
@ -32,10 +32,18 @@ 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()))
{
event.setCancelled(true);
}
if (attacker.hasInvulnerabilityAfterTeleport() || defender.hasInvulnerabilityAfterTeleport())
{
event.setCancelled(true);
}
attacker.updateActivity(true);
final List<String> commandList = attacker.getPowertool(attacker.getItemInHand());
if (commandList != null && !commandList.isEmpty())

View File

@ -177,4 +177,6 @@ public interface ISettings extends IConf
long getTeleportInvulnerability();
boolean isTeleportInvulnerability();
long getLoginAttackDelay();
}

View File

@ -798,10 +798,22 @@ public class Settings implements ISettings
{
return (config.getLong("teleport-invulnerability", 0) > 0);
}
@Override
public boolean isTeleportInvulnerability()
{
return teleportInvulnerability;
}
private long _loginAttackDelay()
{
return config.getLong("login-attack-delay", 0) * 1000;
}
@Override
public long getLoginAttackDelay()
{
return _loginAttackDelay();
}
}

View File

@ -308,6 +308,9 @@ repair-enchanted: true
#If you set this to true any plugin that uses teleport will have the previous location registered.
register-back-in-listener: false
#Delay to wait before people can cause attack damage after logging in
login-attack-delay: 0
############################################################
# +------------------------------------------------------+ #
# | EssentialsHome | #