mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 13:49:05 +00:00
PlayerEvent:
-Added PlayerEvent.AttackEvent & PlayerEvent.AttackedEvent, preventing any knockback from happening from attacks.
This commit is contained in:
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;
|
||||
|
||||
Reference in new issue
Block a user