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); }
block); EventFactory.getInstance().callEvent(igniteEvent); if (!igniteEvent.isCancelled()) { GlowBlockState state = aboveB.getState(); state.setType(Material.FIRE); block); EventFactory.getInstance().callEvent(igniteEvent); if (!igniteEvent.isCancelled()) { GlowBlockState state = b.getState(); state.setType(Material.FIRE);
private void setBlockOnFire(GlowBlock block) { if (block.isEmpty() && block.getRelative(BlockFace.DOWN).isFlammable()) { BlockIgniteEvent igniteEvent = new BlockIgniteEvent(block, IgniteCause.LIGHTNING, this); EventFactory.getInstance().callEvent(igniteEvent); if (!igniteEvent.isCancelled()) { BlockState state = block.getState(); state.setType(Material.FIRE); state.update(true); } } }
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; } }
EventFactory.getInstance() .callEvent(igniteEvent); if (igniteEvent.isCancelled()) { continue;
if (event.isCancelled()) { return;