Skip to content

Commit d9716a5

Browse files
committed
Ignore arrow combustion.
Closes #2144.
1 parent a0e397e commit d9716a5

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
import org.bukkit.block.data.Waterlogged;
6868
import org.bukkit.block.data.type.Dispenser;
6969
import org.bukkit.entity.AreaEffectCloud;
70+
import org.bukkit.entity.Arrow;
7071
import org.bukkit.entity.BreezeWindCharge;
7172
import org.bukkit.entity.Creeper;
7273
import org.bukkit.entity.Entity;
@@ -913,11 +914,19 @@ public void onEntityDamage(EntityDamageEvent event) {
913914

914915
@EventHandler(ignoreCancelled = true)
915916
public void onEntityCombust(EntityCombustEvent event) {
916-
if (event instanceof EntityCombustByBlockEvent) {
917+
if (event instanceof EntityCombustByBlockEvent combustByBlockEvent) {
917918
// at the time of writing, spigot is throwing null for the event's combuster. this causes lots of issues downstream.
918919
// whenever (i mean if ever) it is fixed, use getCombuster again instead of the current block
919-
Events.fireToCancel(event, new DamageEntityEvent(event, create(event.getEntity().getLocation().getBlock()), event.getEntity()));
920+
Block combuster = combustByBlockEvent.getCombuster();
921+
Events.fireToCancel(event, new DamageEntityEvent(event,
922+
create(combuster == null ? event.getEntity().getLocation().getBlock() : combuster), event.getEntity()));
920923
} else if (event instanceof EntityCombustByEntityEvent) {
924+
if (event.getEntity() instanceof Arrow) {
925+
// this only happens from the Flame enchant. igniting arrows in other ways (eg with lava) doesn't even
926+
// throw the combust event, not even the CombustByBlock event... they're also very buggy and don't even
927+
// show as lit on the client consistently
928+
return;
929+
}
921930
Events.fireToCancel(event, new DamageEntityEvent(event, create(((EntityCombustByEntityEvent) event).getCombuster()), event.getEntity()));
922931
}
923932
}

0 commit comments

Comments
 (0)