mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-03 15:08:02 +01:00
parent
a0e397e57f
commit
d9716a5bd8
@ -67,6 +67,7 @@
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.Dispenser;
|
||||
import org.bukkit.entity.AreaEffectCloud;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.BreezeWindCharge;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -913,11 +914,19 @@ public void onEntityDamage(EntityDamageEvent event) {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityCombust(EntityCombustEvent event) {
|
||||
if (event instanceof EntityCombustByBlockEvent) {
|
||||
if (event instanceof EntityCombustByBlockEvent combustByBlockEvent) {
|
||||
// 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()));
|
||||
Block combuster = combustByBlockEvent.getCombuster();
|
||||
Events.fireToCancel(event, new DamageEntityEvent(event,
|
||||
create(combuster == null ? event.getEntity().getLocation().getBlock() : combuster), event.getEntity()));
|
||||
} else if (event instanceof EntityCombustByEntityEvent) {
|
||||
if (event.getEntity() instanceof Arrow) {
|
||||
// this only happens from the Flame enchant. igniting arrows in other ways (eg with lava) doesn't even
|
||||
// throw the combust event, not even the CombustByBlock event... they're also very buggy and don't even
|
||||
// show as lit on the client consistently
|
||||
return;
|
||||
}
|
||||
Events.fireToCancel(event, new DamageEntityEvent(event, create(((EntityCombustByEntityEvent) event).getCombuster()), event.getEntity()));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user