PlayerEvent:

-Added PlayerEvent.AttackEvent & PlayerEvent.AttackedEvent, preventing any knockback from happening from attacks.
This commit is contained in:
c0508383 committed 2022-07-07 12:49:30 -05:00
1 parent 5e0b1282f7
commit 12a3fffeab
5 files changed
+62 -16

No files matched your search

@@ -137,6 +137,20 @@ public class PlayerEvent extends CustomNPCsEvent {
}
}
@Cancelable
public static class AttackedEvent extends PlayerEvent {
public final IDamageSource damageSource;
public final IEntity source;
public final float damage;
public AttackedEvent(IPlayer player, Entity source, float damage, DamageSource damagesource) {
super(player);
this.source = NpcAPI.Instance().getIEntity(source);
this.damage = damage;
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
}
}
@Cancelable
public static class DamagedEvent extends PlayerEvent {
public final IDamageSource damageSource;
@@ -223,6 +237,20 @@ public class PlayerEvent extends CustomNPCsEvent {
}
}
@Cancelable
public static class AttackEvent extends PlayerEvent {
public final IDamageSource damageSource;
public final IEntity target;
public float damage;
public AttackEvent(IPlayer player, Entity target, float damage, DamageSource damagesource) {
super(player);
this.target = NpcAPI.Instance().getIEntity(target);
this.damage = damage;
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
}
}
@Cancelable
public static class DamagedEntityEvent extends PlayerEvent {
public final IDamageSource damageSource;
@@ -285,18 +313,6 @@ public class PlayerEvent extends CustomNPCsEvent {
}
}
@Cancelable
public static class AttackEvent extends PlayerEvent {
public final int type;
public final Object target;
public AttackEvent(IPlayer player, int type, Object target) {
super(player);
this.type = type;
this.target = target;
}
}
@Cancelable
public static class InteractEvent extends PlayerEvent {
public final int type;