Package com.sk89q.craftbook.util.events

Examples of com.sk89q.craftbook.util.events.SourcedBlockRedstoneEvent


    protected void handleDirectWireInput(WorldVector pt, Block sourceBlock, int oldLevel, int newLevel) {

        Block block = sourceBlock.getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
        if(BukkitUtil.equals(sourceBlock.getLocation(), block.getLocation())) //The same block, don't run.
            return;
        final SourcedBlockRedstoneEvent event = new SourcedBlockRedstoneEvent(sourceBlock, block, oldLevel, newLevel);

        CraftBookPlugin.inst().getServer().getPluginManager().callEvent(event);

        CraftBookPlugin.server().getScheduler().runTask(CraftBookPlugin.inst(), new Runnable() {

            @Override
            public void run () {
                try {
                    CartMechanismBlocks cmb = CartMechanismBlocks.find(event.getBlock());
                    CartBlockRedstoneEvent ev = new CartBlockRedstoneEvent(event.getBlock(), event.getSource(), event.getOldCurrent(), event.getNewCurrent(), cmb, CartBlockMechanism.getCart(cmb.rail));
                    CraftBookPlugin.inst().getServer().getPluginManager().callEvent(ev);
                } catch (InvalidMechanismException ignored) {
                }
            }
        });
View Full Code Here

TOP

Related Classes of com.sk89q.craftbook.util.events.SourcedBlockRedstoneEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.