Skip to content

Commit

Permalink
Enhance damages event
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Apr 29, 2015
1 parent 60f9ad5 commit be5956d
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -83,6 +83,7 @@ public void breakDown() {
// <context.damage> returns an Element(Decimal) of the amount of damage dealt.
// <context.final_damage> returns an Element(Decimal) of the amount of damage dealt, after armor is calculated.
// <context.entity> returns the dEntity that was damaged.
// <context.damage_TYPE> returns the damage by a given damage type. Types: BASE, HARD_HAT, BLOCKING, ARMOR,RESISTANCE, MAGIC, ABSORPTION
//
// @Determine
// "CANCELLED" to stop the entity from being damaged.
Expand All @@ -104,6 +105,9 @@ public void entityDamage(EntityDamageEvent event) {
context.put("damage", new Element(event.getDamage()));
context.put("final_damage", new Element(event.getFinalDamage()));
context.put("cause", new Element(event.getCause().name()));
for (EntityDamageEvent.DamageModifier dm: EntityDamageEvent.DamageModifier.values()) {
context.put("damage_" + dm.name(), new Element(event.getDamage(dm)));
}

if (entity.isCitizensNPC()) npc = entity.getDenizenNPC();
else if (entity.isPlayer()) player = entity.getDenizenPlayer();
Expand Down

0 comments on commit be5956d

Please sign in to comment.