@Override public void updateBlock(GlowBlock block) { GlowBlockState state = block.getState(); state.setType(Material.REDSTONE_ORE); BlockFadeEvent fadeEvent = new BlockFadeEvent(block, state); EventFactory.getInstance().callEvent(fadeEvent); if (!fadeEvent.isCancelled()) { state.update(true); } } }
@Override public void updateBlock(GlowBlock block) { if (block.getLightFromBlocks() > 11) { GlowBlockState state = block.getState(); state.setType(Material.AIR); state.setData(new MaterialData(Material.AIR)); BlockFadeEvent fadeEvent = new BlockFadeEvent(block, state); EventFactory.getInstance().callEvent(fadeEvent); if (!fadeEvent.isCancelled()) { state.update(true); } } } }
@Override public void updateBlock(GlowBlock block) { if (block.getLightFromBlocks() > 11) { GlowBlockState state = block.getState(); state.setType(Material.AIR); state.setData(new MaterialData(Material.AIR)); BlockFadeEvent fadeEvent = new BlockFadeEvent(block, state); EventFactory.getInstance().callEvent(fadeEvent); if (!fadeEvent.isCancelled()) { state.update(true); } } } }
@Override public void updateBlock(GlowBlock block) { if (isNearWater(block) || GlowBiomeClimate.isRainy(block)) { block.setData((byte) 7); // set this block as fully wet } else if (block.getData() > 0) { block .setData((byte) (block.getData() - 1)); // if this block is wet, it becomes less wet } else if (!Arrays.asList(possibleCrops) .contains(block.getRelative(BlockFace.UP).getType())) { // turns block back to dirt if nothing is planted on GlowBlockState state = block.getState(); state.setType(Material.DIRT); state.setRawData((byte) 0); BlockFadeEvent fadeEvent = new BlockFadeEvent(block, state); EventFactory.getInstance().callEvent(fadeEvent); if (!fadeEvent.isCancelled()) { state.update(true); } } }
BlockFadeEvent fadeEvent = new BlockFadeEvent(block, state); EventFactory.getInstance().callEvent(fadeEvent); if (!fadeEvent.isCancelled()) { state.update(true);
@Override public void updateBlock(GlowBlock block) { if (block.getLightFromBlocks() > 11 - block.getMaterialValues().getLightOpacity()) { Material type = block.getWorld().getEnvironment() == Environment.NETHER ? Material.AIR : Material.STATIONARY_WATER; GlowBlockState state = block.getState(); state.setType(type); state.setData(new MaterialData(type)); BlockFadeEvent fadeEvent = new BlockFadeEvent(block, state); EventFactory.getInstance().callEvent(fadeEvent); if (!fadeEvent.isCancelled()) { state.update(true); } } } }
BlockFadeEvent fadeEvent = new BlockFadeEvent(block, state); EventFactory.getInstance().callEvent(fadeEvent); if (!fadeEvent.isCancelled()) { state.update(true);
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockMeltEvent(final BlockFadeEvent event) { final Block block = event.getBlock(); if (block.getType() == Material.FIRE) { return; } event.setCancelled(Illumination.isIlluminationTorch(block)); if (!event.isCancelled()) { event.setCancelled(!WaterManipulation.canPhysicsChange(block)); } if (!event.isCancelled()) { event.setCancelled(!EarthPassive.canPhysicsChange(block)); } if (!event.isCancelled()) { event.setCancelled(PhaseChange.getFrozenBlocksAsBlock().contains(block)); } if (!event.isCancelled()) { event.setCancelled(!SurgeWave.canThaw(block)); } if (!event.isCancelled()) { event.setCancelled(!Torrent.canThaw(block)); } if (BlazeArc.getIgnitedBlocks().containsKey(block)) { BlazeArc.removeBlock(block); } }
/** * @param event */ @EventHandler(priority = EventPriority.NORMAL) public void onBlockFade(BlockFadeEvent event) { if (event.isCancelled()) { return; } //If the block is going to disappear because it's a field.(leaves, ice, etc) //Cancel the event if (plugin.getForceFieldManager().isField(event.getBlock())) { event.setCancelled(true); } }