Package org.spout.vanilla.component.block.material

Examples of org.spout.vanilla.component.block.material.CommandBlock


public class CommandBlockHandler extends MessageHandler<CommandBlockMessage> {
  @Override
  public void handleServer(ServerSession session, CommandBlockMessage msg) {
    int x = msg.getX(), y = msg.getY(), z = msg.getZ();
    String text = msg.getCommand();
    CommandBlock c = VanillaPlugin.getInstance().getEngine().getDefaultWorld().getBlock(x, y, z).get(CommandBlock.class);
    Player player = session.getPlayer();
    String prefix = VanillaPlugin.getInstance().getPrefix();
    if (c == null || !(c instanceof CommandBlock)) {
      player.getEngine().getLogger().warning("CommandBlock information received, but there is no CommandBlock at {" + x + "," + y + "," + z + "}.");
      return;
    }
    c.setCommand(text, new PlayerCause(player));
  }
View Full Code Here


  }

  @Override
  public void onUpdate(BlockMaterial oldMaterial, Block block) {
    super.onUpdate(oldMaterial, block);
    CommandBlock cmdBlock = block.get(CommandBlock.class);
    cmdBlock.setPowered(isReceivingPower(block));
  }
View Full Code Here

TOP

Related Classes of org.spout.vanilla.component.block.material.CommandBlock

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.