Skip to content

Commit

Permalink
Add <entity.last_damage.cause> <entity.last_damage.amount> <entity.la…
Browse files Browse the repository at this point in the history
…st_damage.duration> .. valid Duration tags are in_second, in_hours, in_minutes, in_ticks, value --> Example: <player.last_damage.duration.in_minutes>
  • Loading branch information
aufdemrand committed Jul 5, 2013
1 parent 0c3acfb commit 2fe9d55
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/net/aufdemrand/denizen/objects/dEntity.java
Expand Up @@ -660,13 +660,17 @@ else if ((float) getLivingEntity().getHealth() / maxHealth < 1)
return new dPlayer(getLivingEntity().getKiller())
.getAttribute(attribute.fulfill(1));

if (attribute.startsWith("last_damage_cause"))
if (attribute.startsWith("last_damage.cause"))
return new Element(String.valueOf(entity.getLastDamageCause().getCause().toString()))
.getAttribute(attribute.fulfill(1));
.getAttribute(attribute.fulfill(2));

if (attribute.startsWith("last_damage"))
if (attribute.startsWith("last_damage.amount"))
return new Element(String.valueOf(getLivingEntity().getLastDamage()))
.getAttribute(attribute.fulfill(1));
.getAttribute(attribute.fulfill(2));

if (attribute.startsWith("last_damage.duration"))
return new Duration((long) getLivingEntity().getNoDamageTicks())
.getAttribute(attribute.fulfill(2));

if (attribute.startsWith("time_lived"))
return new Duration(entity.getTicksLived() / 20)
Expand Down

0 comments on commit 2fe9d55

Please sign in to comment.