mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-03 01:19:58 +01:00
Merge branch 'master' of github.com:essentials/Essentials
This commit is contained in:
commit
dc36a50d85
@ -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())
|
||||
|
@ -177,4 +177,6 @@ public interface ISettings extends IConf
|
||||
long getTeleportInvulnerability();
|
||||
|
||||
boolean isTeleportInvulnerability();
|
||||
|
||||
long getLoginAttackDelay();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 | #
|
||||
|
Loading…
Reference in New Issue
Block a user