Added fire removal checks to BlockBurnEvent, which slows the effectiveness of a single use of flint and steel versus a citadel building.

In trials, I had a wooden NPC building in which 3 walls were vanilla and one wall was stone citadel'd (10 strength by default config). I set 3 fires on each wall, and after the fires had naturally gone out (~2 minutes), the 3 walls were nearly entirely gone, while the citadel'd wall (with 'extended fire protection') had lost 2-3 durability.

In an identical trial using the existing blockBurn without any particular fire protection, the citadel'd wall continued to burn for 15+ minutes (its still burning) and 80% of blocks were destroyed (notably the top blocks first)

If we added 8 more checks (the stone blocks in http://www.nebtown.info/ss/neb/2012_04_10_10-39-24.png ) we would have aggressive fire resistance, likely a single flintandsteel use against a building would only cause 2-4 blocks to lose 1 durability.

As for benchmarking, 'extended fire protection' approximately doubled the execution time of blockBurn for citadel'd blocks, however as it causes fires to go out faster it may help server performance hehe.
This commit is contained in:
Nebual
2012-04-10 11:10:52 -07:00
parent 98adf0fb22
commit 6c69170383

View File

@@ -19,6 +19,7 @@ import org.bukkit.event.block.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.material.Openable;
import org.bukkit.Material;
import static com.untamedears.citadel.Utility.*;
@@ -98,10 +99,34 @@ public class BlockListener extends PluginConsumer implements Listener {
Reinforcement reinforcement = plugin.dao.findReinforcement(bpre.getBlock());
bpre.setCancelled(reinforcement != null && reinforcement.getSecurityLevel() != SecurityLevel.PUBLIC);
}
private static final Material matfire = Material.FIRE;
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void blockBurn(BlockBurnEvent bbe) {
bbe.setCancelled(maybeReinforcementDamaged(bbe.getBlock()));
boolean wasprotected = maybeReinforcementDamaged(bbe.getBlock());
if (wasprotected) {
bbe.setCancelled(wasprotected);
Block block = bbe.getBlock();
// Basic essential fire protection
if (block.getRelative(0,1,0).getType() == matfire) {block.getRelative(0,1,0).setTypeId(0);} // Essential
// Extended fire protection (recommend)
if (block.getRelative(1,0,0).getType() == matfire) {block.getRelative(1,0,0).setTypeId(0);}
if (block.getRelative(-1,0,0).getType() == matfire) {block.getRelative(-1,0,0).setTypeId(0);}
if (block.getRelative(0,-1,0).getType() == matfire) {block.getRelative(0,-1,0).setTypeId(0);}
if (block.getRelative(0,0,1).getType() == matfire) {block.getRelative(0,0,1).setTypeId(0);}
if (block.getRelative(0,0,-1).getType() == matfire) {block.getRelative(0,0,-1).setTypeId(0);}
// Aggressive fire protection (would seriously reduce effectiveness of flint down to near the "you'd have to use it 25 times" mentality)
/*
if (block.getRelative(1,1,0).getType() == matfire) {block.getRelative(1,1,0).setTypeId(0);}
if (block.getRelative(1,-1,0).getType() == matfire) {block.getRelative(1,-1,0).setTypeId(0);}
if (block.getRelative(-1,1,0).getType() == matfire) {block.getRelative(-1,1,0).setTypeId(0);}
if (block.getRelative(-1,-1,0).getType() == matfire) {block.getRelative(-1,-1,0).setTypeId(0);}
if (block.getRelative(0,1,1).getType() == matfire) {block.getRelative(0,1,1).setTypeId(0);}
if (block.getRelative(0,-1,1).getType() == matfire) {block.getRelative(0,-1,1).setTypeId(0);}
if (block.getRelative(0,1,-1).getType() == matfire) {block.getRelative(0,1,-1).setTypeId(0);}
if (block.getRelative(0,-1,-1).getType() == matfire) {block.getRelative(0,-1,-1).setTypeId(0);}
*/
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)