Make fire-spread actually prevent spreading instead of just burning.

Same with lava-fire.
Fixes WORLDGUARD-3699.
This commit is contained in:
wizjany 2016-06-11 02:29:20 -04:00
parent 6c3dd4234d
commit 53aadca45b
2 changed files with 10 additions and 2 deletions

View File

@ -431,7 +431,6 @@ public void onEntityInteract(org.bukkit.event.entity.EntityInteractEvent event)
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onBlockIgnite(BlockIgniteEvent event) { public void onBlockIgnite(BlockIgniteEvent event) {
Block block = event.getBlock(); Block block = event.getBlock();
Material type = block.getType();
Cause cause; Cause cause;
// Find the cause // Find the cause

View File

@ -62,6 +62,7 @@
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.event.vehicle.VehicleExitEvent;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -187,7 +188,15 @@ public boolean apply(Location target) {
/* Flint and steel, fire charge, etc. */ /* Flint and steel, fire charge, etc. */
if (type == Material.FIRE) { if (type == Material.FIRE) {
canPlace = query.testBuild(target, associable, combine(event, DefaultFlag.BLOCK_PLACE, DefaultFlag.LIGHTER)); Block block = event.getCause().getFirstBlock();
boolean fire = block != null && block.getType() == Material.FIRE;
boolean lava = block != null && Materials.isLava(block.getType());
List<StateFlag> flags = new ArrayList<StateFlag>();
flags.add(DefaultFlag.BLOCK_PLACE);
flags.add(DefaultFlag.LIGHTER);
if (fire) flags.add(DefaultFlag.FIRE_SPREAD);
if (lava) flags.add(DefaultFlag.LAVA_FIRE);
canPlace = query.testBuild(target, associable, combine(event, flags.toArray(new StateFlag[flags.size()])));
what = "place fire"; what = "place fire";
/* Everything else */ /* Everything else */