use of org.bukkit.event.block.BlockIgniteEvent in project Arcade2 by ShootGame.
the class BlockTransformListeners method onBlockIgnite.
@EventHandler(ignoreCancelled = true)
public void onBlockIgnite(BlockIgniteEvent event) {
BlockIgniteEvent.IgniteCause cause = BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL;
if (event.getCause().equals(cause)) {
return;
}
BlockState newState = this.applyState(event.getBlock(), Material.FIRE);
this.post(event, event.getBlock().getState(), newState, event.getPlayer());
}
use of org.bukkit.event.block.BlockIgniteEvent in project Glowstone by GlowstoneMC.
the class Explosion method setBlockOnFire.
private void setBlockOnFire(GlowBlock block) {
if (ThreadLocalRandom.current().nextInt(3) != 0) {
return;
}
Block below = block.getRelative(BlockFace.DOWN);
Material belowType = below.getType();
if (belowType == Material.AIR || belowType == Material.FIRE || !belowType.isFlammable()) {
return;
}
BlockIgniteEvent event = EventFactory.getInstance().callEvent(new BlockIgniteEvent(block, IgniteCause.EXPLOSION, source));
if (event.isCancelled()) {
return;
}
block.setType(Material.FIRE);
}
use of org.bukkit.event.block.BlockIgniteEvent in project Glowstone by GlowstoneMC.
the class ItemFlintAndSteel method setBlockOnFire.
private boolean setBlockOnFire(GlowPlayer player, GlowBlock clicked, BlockFace face, ItemStack holding, Vector clickedLoc, EquipmentSlot hand) {
GlowBlock fireBlock = clicked.getRelative(face);
if (fireBlock.getType() != Material.AIR) {
return true;
}
if (!clicked.isFlammable() && clicked.getRelative(BlockFace.DOWN).getType() == Material.AIR) {
return true;
}
BlockIgniteEvent event = EventFactory.getInstance().callEvent(new BlockIgniteEvent(fireBlock, IgniteCause.FLINT_AND_STEEL, player, null));
if (event.isCancelled()) {
player.setItemInHand(holding);
return false;
}
// clone holding to avoid decreasing of the item's amount
ItemTable.instance().getBlock(Material.FIRE).rightClickBlock(player, clicked, face, holding.clone(), clickedLoc, hand);
return true;
}
Aggregations