mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 19:54:26 +00:00
AbilityDefend event
This commit is contained in:
1 parent
edf5ff7c73
commit
b989a89889
6 files changed
+59
-2
No files matched your search
@@ -214,6 +214,46 @@ public class AbilityEvent extends CustomNPCsEvent implements IAbilityEvent {
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class DefendEvent extends AbilityEvent implements IAbilityEvent.DefendEvent {
|
||||
private final IEntityLivingBase attacker;
|
||||
private final IEntityLivingBase lastAttacker;
|
||||
private float damage;
|
||||
|
||||
public DefendEvent(EntityLivingBase entity, Ability ability, EntityLivingBase attacker,
|
||||
EntityLivingBase lastAttacker, float damage) {
|
||||
super(entity, ability, null);
|
||||
this.attacker = attacker != null ? (IEntityLivingBase) NpcAPI.Instance().getIEntity(attacker) : null;
|
||||
this.lastAttacker = lastAttacker != null ? (IEntityLivingBase) NpcAPI.Instance().getIEntity(lastAttacker) : null;
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingBase getAttacker() {
|
||||
return attacker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEntityLivingBase getLastAttacker() {
|
||||
return lastAttacker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamage() {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(float damage) {
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return EnumScriptType.ABILITY_DEFEND.function;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class ToggleEvent extends AbilityEvent implements IAbilityEvent.ToggleEvent {
|
||||
private final int oldState;
|
||||
|
||||
Reference in new issue
Block a user