Ejemplo n.º 1
0
  @Override
  public boolean isCustomBlock(Block block) {

    if (!(block instanceof SpoutCraftBlock)) {
      return false;
    }

    boolean outcome = false;

    SpoutCraftBlock scb = (SpoutCraftBlock) block;

    Integer blockId = scb.getCustomBlockId();
    Integer metaData = scb.getCustomMetaData();

    if (blockId != null && metaData != null) {
      outcome = true;
    }

    return outcome;
  }
Ejemplo n.º 2
0
  public boolean sendBlockOverrideToPlayers(Player[] players, Chunk chunk) {

    SpoutCraftChunk scc = getSpoutCraftChunk(chunk);
    if (scc == null) {
      return false;
    }

    BlockVector[] blocks = scc.getTaggedBlocks();

    if (blocks == null) {
      return false;
    }

    boolean success = true;
    for (BlockVector block : blocks) {
      correctBlockVector(block, scc);

      SpoutCraftBlock scb =
          getSpoutCraftBlock(
              chunk.getWorld().getBlockAt(block.getBlockX(), block.getBlockY(), block.getBlockZ()));

      if (scb == null) {
        success = false;
        continue;
      }

      Integer blockId = scb.getCustomBlockId();
      Integer metaData = scb.getCustomMetaData();

      if (blockId != null && metaData != null) {
        sendBlockOverrideToPlayers(players, block, blockId, metaData);
      }
    }

    return success;
  }