Skip to content

Instantly share code, notes, and snippets.

@EdGruberman
Created January 9, 2012 00:44
Show Gist options
  • Save EdGruberman/1580299 to your computer and use it in GitHub Desktop.
Save EdGruberman/1580299 to your computer and use it in GitHub Desktop.
in an EntityListener:
@Override
public void onEntityCombust(final EntityCombustEvent event) {
if (event.isCancelled() || !(event.getEntity() instanceof Player)) return;
DamageReport.recordCombuster(event);
}
in DamageReport:
static void recordCombuster(final EntityCombustEvent event) {
if (event instanceof EntityCombustByEntityEvent) {
EntityCombustByEntityEvent byEntity = (EntityCombustByEntityEvent) event;
DamageReport.combuster.put(event.getEntity(), DamageReport.describeEntity(byEntity.getCombuster()));
return;
}
System.out.println(event instanceof EntityCombustByBlockEvent);
if (event instanceof EntityCombustByBlockEvent) {
EntityCombustByBlockEvent byBlock = (EntityCombustByBlockEvent) event;
DamageReport.combuster.put(event.getEntity(), DamageReport.describeMaterial(byBlock.getCombuster().getState().getData()));
return;
}
}
when a Player walks into lava and back out again, in console:
2012-01-08 17:41:15 [INFO] false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment