use of org.bukkit.block.data.Lightable in project Minigames by AddstarMC.
the class PulseRedstoneAction method executeNodeAction.
@Override
public void executeNodeAction(MinigamePlayer player, Node node) {
debug(player, node);
BlockData bdata = Material.REDSTONE_BLOCK.createBlockData();
if (torch.getFlag()) {
bdata = Material.REDSTONE_TORCH.createBlockData();
if (bdata instanceof Lightable)
((Lightable) bdata).setLit(true);
}
final BlockState last = node.getLocation().getBlock().getState();
node.getLocation().getBlock().setBlockData(bdata);
Bukkit.getScheduler().scheduleSyncDelayedTask(Minigames.getPlugin(), () -> last.update(true), 20 * time.getFlag());
}
use of org.bukkit.block.data.Lightable in project Denizen-For-Bukkit by DenizenScript.
the class MaterialSwitchable method describes.
public static boolean describes(ObjectTag material) {
if (!(material instanceof MaterialTag)) {
return false;
}
MaterialTag mat = (MaterialTag) material;
if (!mat.hasModernData()) {
return false;
}
BlockData data = mat.getModernData();
return data instanceof Powerable || data instanceof Openable || data instanceof Dispenser || data instanceof DaylightDetector || data instanceof Piston || data instanceof Lightable || data instanceof EndPortalFrame || data instanceof Hopper;
}
use of org.bukkit.block.data.Lightable in project Glowstone by GlowstoneMC.
the class BlockRedstoneOre method blockInteract.
@Override
public boolean blockInteract(GlowPlayer player, GlowBlock block, BlockFace face, Vector clickedLoc) {
BlockData blockData = Bukkit.getServer().createBlockData(Material.REDSTONE_ORE);
((Lightable) blockData).setLit(true);
EntityChangeBlockEvent changeBlockEvent = new EntityChangeBlockEvent(player, block, blockData);
EventFactory.getInstance().callEvent(changeBlockEvent);
if (!changeBlockEvent.isCancelled()) {
GlowBlockState state = block.getState();
state.setType(Material.REDSTONE_ORE);
state.update(true);
}
return false;
}
Aggregations