Skip to content

Commit

Permalink
Fix entity combustion in regions always getting cancelled.
Browse files Browse the repository at this point in the history
Note that this technically might lead to some inaccuracies if
entity is on a region boundary, but requires server fix.
Fixes WORLDGUARD-3758, WORLDGUARD-3770.
  • Loading branch information
wizjany committed Nov 20, 2016
1 parent 26e5995 commit c60502f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -713,8 +713,9 @@ public void onEntityDamage(EntityDamageEvent event) {
@EventHandler(ignoreCancelled = true)
public void onEntityCombust(EntityCombustEvent event) {
if (event instanceof EntityCombustByBlockEvent) {
Events.fireToCancel(event, new DamageEntityEvent(event, create(((EntityCombustByBlockEvent) event).getCombuster()), event.getEntity()));

// at the time of writing, spigot is throwing null for the event's combuster. this causes lots of issues downstream.
// whenever (i mean if ever) it is fixed, use getCombuster again instead of the current block
Events.fireToCancel(event, new DamageEntityEvent(event, create(event.getEntity().getLocation().getBlock()), event.getEntity()));
} else if (event instanceof EntityCombustByEntityEvent) {
Events.fireToCancel(event, new DamageEntityEvent(event, create(((EntityCombustByEntityEvent) event).getCombuster()), event.getEntity()));
}
Expand Down

0 comments on commit c60502f

Please sign in to comment.