mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-22 17:17:57 +01:00
No longer destroying additional fire blocks when fire-spread is disallowed.
Problem: This feature breaks the consistency of Bukkit's BlockFadeEvent. Resolution 1: Emit BlockFadeEvent before removing. - This might break plugins if they don't expect fire to disappear the way WG removes it. Resolution 2: Remove the additional dousing. - Fire still spreads around a bit (probably due to a bukkit bug), but does not destroy anything. I picked resolution 2. Rationale: Occam's razor.
This commit is contained in:
parent
beb0bb3a1e
commit
c88052eeb8
@ -399,9 +399,7 @@ public void onBlockBurn(BlockBurnEvent event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wcfg.fireSpreadDisableToggle) {
|
if (wcfg.fireSpreadDisableToggle) {
|
||||||
Block block = event.getBlock();
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
checkAndDestroyAround(block.getWorld(), block.getX(), block.getY(), block.getZ(), BlockID.FIRE);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +408,6 @@ public void onBlockBurn(BlockBurnEvent event) {
|
|||||||
|
|
||||||
if (wcfg.disableFireSpreadBlocks.contains(block.getTypeId())) {
|
if (wcfg.disableFireSpreadBlocks.contains(block.getTypeId())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
checkAndDestroyAround(block.getWorld(), block.getX(), block.getY(), block.getZ(), BlockID.FIRE);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -422,15 +419,11 @@ public void onBlockBurn(BlockBurnEvent event) {
|
|||||||
|
|
||||||
if (wcfg.useRegions) {
|
if (wcfg.useRegions) {
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
int x = block.getX();
|
|
||||||
int y = block.getY();
|
|
||||||
int z = block.getZ();
|
|
||||||
Vector pt = toVector(block);
|
Vector pt = toVector(block);
|
||||||
RegionManager mgr = plugin.getGlobalRegionManager().get(block.getWorld());
|
RegionManager mgr = plugin.getGlobalRegionManager().get(block.getWorld());
|
||||||
ApplicableRegionSet set = mgr.getApplicableRegions(pt);
|
ApplicableRegionSet set = mgr.getApplicableRegions(pt);
|
||||||
|
|
||||||
if (!set.allows(DefaultFlag.FIRE_SPREAD)) {
|
if (!set.allows(DefaultFlag.FIRE_SPREAD)) {
|
||||||
checkAndDestroyAround(block.getWorld(), x, y, z, BlockID.FIRE);
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -438,21 +431,6 @@ public void onBlockBurn(BlockBurnEvent event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAndDestroyAround(World world, int x, int y, int z, int required) {
|
|
||||||
checkAndDestroy(world, x, y, z + 1, required);
|
|
||||||
checkAndDestroy(world, x, y, z - 1, required);
|
|
||||||
checkAndDestroy(world, x, y + 1, z, required);
|
|
||||||
checkAndDestroy(world, x, y - 1, z, required);
|
|
||||||
checkAndDestroy(world, x + 1, y, z, required);
|
|
||||||
checkAndDestroy(world, x - 1, y, z, required);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkAndDestroy(World world, int x, int y, int z, int required) {
|
|
||||||
if (world.getBlockTypeIdAt(x, y, z) == required) {
|
|
||||||
world.getBlockAt(x, y, z).setTypeId(BlockID.AIR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called when block physics occurs.
|
* Called when block physics occurs.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user