Updated burn event handling.

This commit is contained in:
sk89q 2011-02-02 22:21:44 -08:00
parent b379b8f022
commit ef7d487ec5
2 changed files with 29 additions and 2 deletions

View File

@ -175,8 +175,7 @@ public void onBlockIgnite(BlockIgniteEvent event) {
Block block = event.getBlock();
//Player player = event.getPlayer();
World world = block.getWorld();
boolean isFireSpread = cause == IgniteCause.SLOW_SPREAD
|| cause == IgniteCause.SPREAD;
boolean isFireSpread = cause == IgniteCause.SPREAD;
if (plugin.preventLavaFire && cause == IgniteCause.LAVA) {
event.setCancelled(true);
@ -247,6 +246,33 @@ public void onBlockIgnite(BlockIgniteEvent event) {
}*/
}
/**
* Called when a block is destroyed from burning
*
* @param event Relevant event details
*/
public void onBlockBurn(BlockBurnEvent event) {
if (plugin.disableFireSpread) {
event.setCancelled(true);
return;
}
if (plugin.fireSpreadDisableToggle) {
event.setCancelled(true);
return;
}
if (plugin.disableFireSpreadBlocks.size() > 0) {
Block block = event.getBlock();
World world = block.getWorld();
if (plugin.disableFireSpreadBlocks.contains(block.getTypeId())) {
event.setCancelled(true);
return;
}
}
}
/**
* Called when block physics occurs
*

View File

@ -183,6 +183,7 @@ private void registerEvents() {
registerEvent(Event.Type.BLOCK_INTERACT, blockListener, Priority.High);
registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.High);
registerEvent(Event.Type.BLOCK_RIGHTCLICKED, blockListener, Priority.High);
registerEvent(Event.Type.BLOCK_BURN, blockListener, Priority.High);
registerEvent(Event.Type.REDSTONE_CHANGE, blockListener, Priority.High);
registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.High);