Skip to content

Commit

Permalink
entity damage event: update context.final_damage dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 23, 2020
1 parent 01f71dc commit c78ebfa
Showing 1 changed file with 1 addition and 3 deletions.
Expand Up @@ -76,7 +76,6 @@ public EntityDamagedScriptEvent() {

public EntityTag entity;
public ElementTag cause;
public ElementTag final_damage;
public EntityTag damager;
public EntityTag projectile;
public ItemTag held;
Expand Down Expand Up @@ -153,7 +152,7 @@ else if (name.equals("damage")) {
return new ElementTag(event.getDamage());
}
else if (name.equals("final_damage")) {
return final_damage;
return new ElementTag(event.getFinalDamage());
}
else if (name.equals("cause")) {
return cause;
Expand Down Expand Up @@ -185,7 +184,6 @@ else if (name.startsWith("damage_")) {
@EventHandler
public void onEntityDamaged(EntityDamageEvent event) {
entity = new EntityTag(event.getEntity());
final_damage = new ElementTag(event.getFinalDamage());
cause = new ElementTag(CoreUtilities.toLowerCase(event.getCause().name()));
damager = null;
projectile = null;
Expand Down

0 comments on commit c78ebfa

Please sign in to comment.