attack cooldown bypass
This commit is contained in:
@@ -3,8 +3,6 @@ package io.github.itzispyder.ogredupealias.events;
|
|||||||
import io.github.itzispyder.ogredupealias.plugin.ItemPresets;
|
import io.github.itzispyder.ogredupealias.plugin.ItemPresets;
|
||||||
import io.github.itzispyder.ogredupealias.plugin.RecipientList;
|
import io.github.itzispyder.ogredupealias.plugin.RecipientList;
|
||||||
import io.github.itzispyder.ogredupealias.utils.ItemUtils;
|
import io.github.itzispyder.ogredupealias.utils.ItemUtils;
|
||||||
import io.github.itzispyder.ogredupealias.utils.SoundPlayer;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -28,12 +26,10 @@ public class EntityDamageListener implements Listener {
|
|||||||
|
|
||||||
if (damager instanceof Player pDamager && victim instanceof LivingEntity vLiving) {
|
if (damager instanceof Player pDamager && victim instanceof LivingEntity vLiving) {
|
||||||
final ItemStack item = pDamager.getInventory().getItemInMainHand();
|
final ItemStack item = pDamager.getInventory().getItemInMainHand();
|
||||||
final SoundPlayer sticky = new SoundPlayer(vLiving.getLocation(), Sound.BLOCK_SLIME_BLOCK_BREAK, 1, 10);
|
|
||||||
|
|
||||||
if (ItemUtils.nbtMatches(item, ItemPresets.TROLL_SWORD) || attackCooldownBypassers.isRecipient(pDamager)) {
|
if (ItemUtils.nbtMatches(item, ItemPresets.TROLL_SWORD) || attackCooldownBypassers.isRecipient(pDamager)) {
|
||||||
vLiving.setNoDamageTicks(1);
|
vLiving.setNoDamageTicks(1);
|
||||||
vLiving.setMaximumNoDamageTicks(2);
|
vLiving.setMaximumNoDamageTicks(2);
|
||||||
sticky.playWithinAt(100);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vLiving.setNoDamageTicks(19);
|
vLiving.setNoDamageTicks(19);
|
||||||
|
|||||||
Reference in New Issue
Block a user