@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()) {
@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()) {