Fix AFK attack damage ticks
This commit is contained in:
@@ -25,7 +25,7 @@ public class EntityDamageListener implements Listener {
|
||||
if (damageEvent.getDamager() instanceof Player attacker) {
|
||||
attacker.sendMessage("%s%sLncvrtBox %s%s» %sYou can't attack AFK players!".formatted(GOLD, BOLD, GRAY, BOLD, RESET));
|
||||
player.sendMessage("%s%sLncvrtBox %s%s» %s%s tried to attack you while you were AFK!".formatted(GOLD, BOLD, GRAY, BOLD, RESET, attacker.getName()));
|
||||
if (attacker.getNoDamageTicks() == 0) {
|
||||
if (attacker.getNoDamageTicks() <= 10) {
|
||||
attacker.damage(0.0001);
|
||||
attacker.setVelocity(attacker.getLocation().toVector().subtract(player.getLocation().toVector()).normalize().setY(0.5).multiply(0.5));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user