Package org.bukkit.block

Examples of org.bukkit.block.BlockState


      // first ring
      this.setBlock(x + 1, y - 1, z + 1, this.kind);
      this.setBlock(x + 1, y - 1, z, this.kind);
      this.setBlock(x + 1, y - 1, z - 1, this.kind);
      this.setBlock(x, y - 1, z + 1, this.kind);
      BlockState lightBlock = this.warzone.getWorld().getBlockAt(x, y - 1, z).getState();
      lightBlock.setType(light.getType());
      lightBlock.setData(light.getData());
      lightBlock.update(true);
      this.setBlock(x, y - 1, z - 1, this.kind);
      this.setBlock(x - 1, y - 1, z + 1, this.kind);
      this.setBlock(x - 1, y - 1, z, this.kind);
      this.setBlock(x - 1, y - 1, z - 1, this.kind);
    }
View Full Code Here


      War.war.getSpoutDisplayer().updateStats(this.warzone);
    }
  }

  private void setBlock(int x, int y, int z, TeamKind kind) {
    BlockState block = this.warzone.getWorld().getBlockAt(x, y, z).getState();
    block.setType(kind.getMaterial());
    block.setData(kind.getBlockData());
    block.update(true);
  }
View Full Code Here

    int x = this.teamFlag.getBlockX();
    int y = this.teamFlag.getBlockY();
    int z = this.teamFlag.getBlockZ();

    // first ring
    BlockState current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z + 1).getState();
    current.setType(this.warzone.getWarzoneMaterials().getMainBlock().getType());
    current.setData(this.warzone.getWarzoneMaterials().getMainBlock().getData());
    current.update(true);
    current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z).getState();
    current.setType(this.warzone.getWarzoneMaterials().getMainBlock().getType());
    current.setData(this.warzone.getWarzoneMaterials().getMainBlock().getData());
    current.update(true);
    current = this.warzone.getWorld().getBlockAt(x + 1, y - 1, z - 1).getState();
    current.setType(this.warzone.getWarzoneMaterials().getMainBlock().getType());
    current.setData(this.warzone.getWarzoneMaterials().getMainBlock().getData());
    current.update(true);
    current = this.warzone.getWorld().getBlockAt(x, y - 1, z + 1).getState();
    current.setType(this.warzone.getWarzoneMaterials().getMainBlock().getType());
    current.setData(this.warzone.getWarzoneMaterials().getMainBlock().getData());
    current.update(true);
    current = this.warzone.getWorld().getBlockAt(x, y - 1, z).getState();
    current.setType(this.warzone.getWarzoneMaterials().getLightBlock().getType());
    current.setData(this.warzone.getWarzoneMaterials().getLightBlock().getData());
    current.update(true);
    current = this.warzone.getWorld().getBlockAt(x, y - 1, z - 1).getState();
    current.setType(this.warzone.getWarzoneMaterials().getMainBlock().getType());
    current.setData(this.warzone.getWarzoneMaterials().getMainBlock().getData());
    current.update(true);
    current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z + 1).getState();
    current.setType(this.warzone.getWarzoneMaterials().getMainBlock().getType());
    current.setData(this.warzone.getWarzoneMaterials().getMainBlock().getData());
    current.update(true);
    current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z).getState();
    current.setType(this.warzone.getWarzoneMaterials().getMainBlock().getType());
    current.setData(this.warzone.getWarzoneMaterials().getMainBlock().getData());
    current.update(true);
    current = this.warzone.getWorld().getBlockAt(x - 1, y - 1, z - 1).getState();
    current.setType(this.warzone.getWarzoneMaterials().getMainBlock().getType());
    current.setData(this.warzone.getWarzoneMaterials().getMainBlock().getData());
    current.update(true);

    // flag
    BlockState flagBlock = this.warzone.getWorld().getBlockAt(x, y + 1, z).getState();
    flagBlock.setType(this.kind.getMaterial());
    flagBlock.setData(this.kind.getBlockData());
    flagBlock.update(true);

    // Flag post using Orientation
    int yaw = 0;
    if (this.teamFlag.getYaw() >= 0) {
      yaw = (int) (this.teamFlag.getYaw() % 360);
View Full Code Here

    volume.setCornerOne(corner1);
    volume.setCornerTwo(corner2);
    ResultSet query = stmt.executeQuery("SELECT * FROM blocks");
    while (query.next()) {
      int x = query.getInt("x"), y = query.getInt("y"), z = query.getInt("z");
      BlockState modify = corner1.getRelative(x, y, z).getState();
      ItemStack data = new ItemStack(Material.valueOf(query.getString("type")), 0, query.getShort("data"));
      modify.setType(data.getType());
      modify.setData(data.getData());
      volume.getBlocks().add(modify);
    }
    query.close();
    stmt.close();
    databaseConnection.close();
View Full Code Here

                  String[] blockSplit = blockLine.split(",");
                  if (blockLine != null && !blockLine.equals("") && blockSplit.length > 1) {
                    int typeID = Integer.parseInt(blockSplit[0]);
                    byte data = Byte.parseByte(blockSplit[1]);

                    BlockState dummy = volume.getWorld().getBlockAt(x1 + i, y1 + j, z1 + k).getState();
                    dummy.setTypeId(typeID);
                    dummy.setRawData(data);
                    volume.getBlocks().add(dummy);
                  }
                  blockReads++;
                }
              } catch (Exception e) {
View Full Code Here

       
        if (softRestore) {
            if (arena.isProtected())
                return false;
           
            BlockState state = b.getState();
            Repairable r = null;
           
            if (state instanceof InventoryHolder)
                r = new RepairableContainer(state);
            else if (state instanceof Sign)
                r = new RepairableSign(state);
            else if (state.getData() instanceof Attachable)
                r = new RepairableAttachable(state);
            else
                r = new RepairableBlock(state);

            arena.addRepairable(r);
View Full Code Here

        if (!softRestoreDrops)
            event.setYield(0);

        // Handle all the blocks in the block list.
        for (Block b : event.blockList()) {
            BlockState state = b.getState();

            if (state.getData() instanceof Door && ((Door) state.getData()).isTopHalf()) {
                state = b.getRelative(BlockFace.DOWN).getState();
            }
            else if (state.getData() instanceof Bed && ((Bed) state.getData()).isHeadOfBed()) {
                state = b.getRelative(((Bed) state.getData()).getFacing().getOppositeFace()).getState();
            }

            // Create a Repairable from the block.
            Repairable r = null;
            if (state instanceof InventoryHolder)
                r = new RepairableContainer(state);
            else if (state instanceof Sign)
                r = new RepairableSign(state);
            else if (state.getData() instanceof Bed)
                r = new RepairableBed(state);
            else if (state.getData() instanceof Door)
                r = new RepairableDoor(state);
            else if (state.getData() instanceof Attachable || state.getData() instanceof Redstone)
                r = new RepairableAttachable(state);
            else
                r = new RepairableBlock(state);

            // Cakes and liquids should just get removed. If player-placed block, drop as item.
            Material mat = state.getType();
            if (mat == Material.CAKE_BLOCK || mat == Material.WATER || mat == Material.LAVA)
                arena.removeBlock(b);
            else if (arena.removeBlock(b))
                arena.getWorld().dropItemNaturally(b.getLocation(), new ItemStack(state.getTypeId(), 1));
            else if (softRestore)
                arena.addRepairable(r);
            else
                arena.queueRepairable(r);
        }
View Full Code Here

    {
        if (topLeft == null) {
            return false;
        }
       
        BlockState state = topLeft.getBlock().getState();
       
        if (!(state instanceof Sign))
        {
            Messenger.severe("Leaderboards for '" + arena.configName() + "' could not be established!");
            return false;
View Full Code Here

   
    private int getSignCount(Sign s, BlockFace direction)
    {
        int i = 1;
       
        BlockState state = s.getBlock().getState();
        while ((state = state.getBlock().getRelative(direction).getState()) instanceof Sign)
            i++;
       
        return i;
    }
View Full Code Here

        return i;
    }
   
    private Sign getAdjacentSign(Sign s, BlockFace direction)
    {
        BlockState state = s.getBlock().getRelative(direction).getState();
        if (state instanceof Sign)
            return (Sign) state;
        return null;
    }
View Full Code Here

TOP

Related Classes of org.bukkit.block.BlockState

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.