Package org.bukkit.block

Examples of org.bukkit.block.BlockState


        continue;

      //Get some data from the entry
      Location loc = new Location(world, entry.getX(), entry.getY(), entry.getZ());
      Block block = world.getBlockAt(loc);
      BlockState state = block.getState();

      //Attempt global rollback
      if (rollbackType == RollbackType.GLOBAL && entry.rollback(world.getBlockAt(loc))) {
        entry.setUndoState(state);
        undo.add(entry);
View Full Code Here


        if (it == null)
          SimpleSpleef.log.warning("[SimpleSpleef] Could not restore the whole arena - changed blocks iterator has been killed somehow.");
        it = null;
        break;
      } else { // restore blocks
        BlockState blockState = it.next();
        blockState.update(true);

        /*Block block = changedBlock.location.getBlock();

        // load chunk if needed
        Chunk here = block.getChunk();
View Full Code Here

    if (event.getAction() == Action.LEFT_CLICK_BLOCK && configuration.getBoolean("instantDig", true) && checkMayBreakBlock(block, player)) {
      // cancel event
      event.setCancelled(true);
      // get block data
      Block clickedBlock = event.getClickedBlock();
      BlockState state = clickedBlock.getState();
      // set block to air
      clickedBlock.setType(Material.AIR);
      // update chunk information
      clickedBlock.getWorld().refreshChunk(clickedBlock.getChunk().getX(), clickedBlock.getChunk().getZ());
      // notify trackers
View Full Code Here

   */
  protected void blockBreakInGame(BlockBreakEvent event) {
    Block block = event.getBlock();
    if (block == null) return; // sanity check
    // get block data
    BlockState state = block.getState();
    boolean floorBroken = false;
    // may the block be broken?
    if (!checkMayBreakBlock(block, event.getPlayer())) {
      // cancel event
      event.setCancelled(true);
View Full Code Here

      SerializableBlockData blockData = originalBlocks.get(location); // get original block data
      if (blockData == null) return; // no NPEs, should not happen here, but just to make sure...
      // repair it
      Block block = location.getBlock();
      // get old data
      BlockState oldState = block.getState();
      block.setTypeIdAndData(blockData.getTypeId(), blockData.getData(), false);
      // update chunk information
      block.getWorld().refreshChunk(block.getChunk().getX(), block.getChunk().getZ());
      air.remove(location);       
      // notify others - and myself
View Full Code Here

          degenerationList.remove(player); // remove player from list
          return;
        }
       
        // get original data
        BlockState oldState = keeper.checkedBlock.getState();

        keeper.checkedBlock.setType(Material.AIR); // block dissolves into thin air

        // update chunk information
        keeper.checkedBlock.getWorld().refreshChunk(keeper.checkedBlock.getChunk().getX(), keeper.checkedBlock.getChunk().getZ());
View Full Code Here

    Location location = getRandomEntry();
    //System.out.println("Tick FloorDissolveWorker " + location);
    if (location != null) {
      Block block = location.getBlock();
      // get old data
      BlockState oldState = block.getState();
      // dissolve to air
      block.setType(Material.AIR);
      // update chunk information
      block.getWorld().refreshChunk(block.getChunk().getX(), block.getChunk().getZ());
      nonAir.remove(location);       
View Full Code Here

     */
    private void createPortal(GlowPlayer player, GlowBlock center) {
        List<BlockState> blocks = new ArrayList<>(9);
        for (int i = -1; i <= 1; i++) {
            for (int j = -1; j <= 1; j++) {
                BlockState state = center.getRelative(i, 0, j).getState();
                state.setType(Material.ENDER_PORTAL);
                blocks.add(state);
            }
        }
        if (!EventFactory.callEvent(new EntityCreatePortalEvent(player, blocks, PortalType.ENDER)).isCancelled()) {
            for (BlockState state : blocks) {
                state.update(true);
            }
        }
    }
View Full Code Here

        setTypes(0, 0);
    }

    @Override
    public boolean canPlaceOn() {
        final BlockState state = delegate.getBlockState(loc.getBlock().getRelative(BlockFace.DOWN).getLocation());
        return state.getType() == Material.GRASS || state.getType() == Material.DIRT;
    }
View Full Code Here

        setHeight(random.nextInt(2) + random.nextInt(3) + 6);
    }

    @Override
    public boolean canPlaceOn() {
        final BlockState state = delegate.getBlockState(loc.getBlock().getRelative(BlockFace.DOWN).getLocation());
        return state.getType() == Material.GRASS || state.getType() == Material.DIRT;
    }
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.