Don't burn important blocks. Fixes #697

This commit is contained in:
cmastudios 2013-10-27 16:03:28 -05:00
parent 9e6b0d9f17
commit a039e65a8a

View File

@ -9,6 +9,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
@ -239,6 +240,14 @@ public class WarBlockListener implements Listener {
}
}
@EventHandler
public void onBlockBurn(final BlockBurnEvent event) {
Warzone zone = Warzone.getZoneByLocation(event.getBlock().getLocation());
if (zone != null && zone.isImportantBlock(event.getBlock())) {
event.setCancelled(true);
}
}
private void handleBreakOrDamage(Player player, Block block, Cancellable event) {
Warzone warzone = Warzone.getZoneByLocation(player);
Team team = Team.getTeamByPlayerName(player.getName());