Package org.bukkit

Examples of org.bukkit.Material


      // If we came from a vertical rail and need to move onto a slope
      // Vertical -> Slope UP
      RailTracker railTracker = member.getRailTracker();
      if (railTracker.getLastRailType() == RailType.VERTICAL) {
        IntVector3 nextPos = pos.add(railTracker.getLastLogic().getDirection());
        Material type = WorldUtil.getBlockType(world, nextPos.x, nextPos.y, nextPos.z);
        int data = WorldUtil.getBlockData(world, nextPos);
        if (this.isRail(type, data)) {
          // Check that the direction of the rail is correct
          Rails rails = CommonUtil.tryCast(BlockUtil.getData(type, data), Rails.class);
          BlockFace lastDirection = railTracker.getLastLogic().getDirection();
View Full Code Here


    this.spawnItemDrops = node.get("spawnItemDrops", this.spawnItemDrops);
    this.exitOffset = node.get("exitOffset", this.exitOffset);
    this.exitYaw = node.get("exitYaw", this.exitYaw);
    this.exitPitch = node.get("exitPitch", this.exitPitch);
    for (String blocktype : node.getList("blockBreakTypes", String.class)) {
      Material mat = ParseUtil.parseMaterial(blocktype, null);
      if (mat != null) {
        this.blockBreakTypes.add(mat);
      }
    }
  }
View Full Code Here

    config.addHeader("allowedBlockBreakTypes", "Players with the admin block break permission can use any type");
    config.addHeader("allowedBlockBreakTypes", "Others have to use one from this list");
    allowedBlockBreakTypes.clear();
    if (config.contains("allowedBlockBreakTypes")) {
      for (String value : config.getList("allowedBlockBreakTypes", String.class)) {
        Material type = ParseUtil.parseMaterial(value, null);
        if (type != null) allowedBlockBreakTypes.add(type);
      }
    } else {
      allowedBlockBreakTypes.add(Material.CROPS);
      allowedBlockBreakTypes.add(Material.LOG);
View Full Code Here

   * @return True to allow default logic to continue, False to suppress it
   */
  public boolean onRightClick(Block clickedBlock, Player player, ItemStack heldItem, long clickInterval) {
    // Handle interaction with minecart or rails onto another Block
    if (MaterialUtil.ISMINECART.get(heldItem) || Util.ISTCRAIL.get(heldItem)) {
      Material type = clickedBlock == null ? Material.AIR : clickedBlock.getType();
      if (Util.ISTCRAIL.get(type)) {
        if (MaterialUtil.ISMINECART.get(heldItem)) {
          // Handle the interaction with rails while holding a minecart
          // Place a TrainCart/Minecart on top of the rails, and handles permissions
          return handleMinecartPlacement(player, clickedBlock, type);
View Full Code Here

  }

  @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
  public void onBlockPhysics(BlockPhysicsEvent event) {
    final Block block = event.getBlock();
    final Material type = block.getType();
    if (Util.ISTCRAIL.get(type)) {
      if (!Util.isSupported(block)) {
        // No valid supporting block - clear the active signs of this rails
        onRailsBreak(block);
      } else if (updateRails(block)) {
View Full Code Here

  public static Block getRailsFromSign(Block signblock) {
    if (signblock == null) {
      return null;
    }

    final Material type = signblock.getType();
    final Block mainBlock;
    if (type == Material.WALL_SIGN) {
      mainBlock = BlockUtil.getAttachedBlock(signblock);
    } else if (type == Material.SIGN_POST) {
      mainBlock = signblock;
View Full Code Here

   * @param block to check
   * @param face to check
   * @return True if supported, False if not
   */
  public static boolean isSupportedFace(Block block, BlockFace face) {
    Material type = block.getType();
    if (MaterialUtil.ISSOLID.get(type)) {
      return true;
    }
    // Special block types that only support one face at a time
    int rawData = MaterialUtil.getRawData(block);
View Full Code Here

  }

  @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
  public void onBlockPhysics(BlockPhysicsEvent event) {
    final Block block = event.getBlock();
    final Material type = block.getType();
    if (MaterialUtil.ISSIGN.get(type)) {
      if (Util.isSupported(block)) {
        // Check for potential redstone changes
        updateRedstonePower(block);
      } else {
View Full Code Here

  @EventHandler(priority = EventPriority.HIGHEST)
  public void onBlockRedstoneChange(BlockRedstoneEvent event) {
    if (TrainCarts.isWorldDisabled(event)) {
      return;
    }
    Material type = event.getBlock().getType();
    if (BlockUtil.isType(type, Material.LEVER)) {
      Block up = event.getBlock().getRelative(BlockFace.UP);
      Block down = event.getBlock().getRelative(BlockFace.DOWN);
      if (MaterialUtil.ISSIGN.get(up)) {
        updateRedstonePower(up, event.getNewCurrent() > 0);
View Full Code Here

          boolean lastIsBool = ParseUtil.isBool(args[args.length - 1]);
          if (lastIsBool) asBreak = ParseUtil.parseBool(args[args.length - 1]);
          int count = lastIsBool ? args.length - 1 : args.length;
          Set<Material> mats = new HashSet<Material>();
          for (int i = 0; i < count; i++) {
            Material mat = ParseUtil.parseMaterial(args[i], null);
            if (mat != null) {
              if (p.hasPermission("train.command.break.admin") || TrainCarts.canBreak(mat)) {
                mats.add(mat);
              } else {
                p.sendMessage(ChatColor.RED + "You are not allowed to make this train break '" + mat.toString() + "'!");
              }
            }
          }
          if (mats.isEmpty()) {
            p.sendMessage(ChatColor.RED + "Failed to find possible and allowed block types in the list given.");
View Full Code Here

TOP

Related Classes of org.bukkit.Material

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.