Package org.bukkit

Examples of org.bukkit.Material


                        if (myKey.contains("-")) {
                            // uses subType
                            subType = ":" + myKey.split("-")[1];
                            myKey = myKey.split("-")[0];
                        }
                        Material material = Material.matchMaterial(myKey);
                        if (material == null) {
                            // try integer method
                            Integer matId = null;
                            try {
                                matId = Integer.decode(myKey);
                            } catch (NumberFormatException e) {}
                            if (matId != null) {
                                material = Material.getMaterial(matId);
                                if (material != null) {
                                    Jobs.getPluginLogger().warning("Job " + jobKey + " " + actionType.getName() + " is using a block by number ID: " + key + "!");
                                    Jobs.getPluginLogger().warning("Please switch to using the Material name instead: "+material.toString()+"!");
                                    Jobs.getPluginLogger().warning("Blocks by number IDs may break in a future release!");
                                }
                            }
                        }
                       
                        if (material != null) {
                            // Break and Place actions MUST be blocks
                            if (actionType == ActionType.BREAK || actionType == ActionType.PLACE) {
                                if (!material.isBlock()) {
                                    Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid " + actionType.getName() + " type property: " + key + "! Material must be a block!");
                                    continue;
                                }
                            }
                            // START HACK
                            /*
                             * Historically, GLOWING_REDSTONE_ORE would ONLY work as REDSTONE_ORE, and putting
                             * GLOWING_REDSTONE_ORE in the configuration would not work.  Unfortunately, this is
                             * completely backwards and wrong.
                             *
                             * To maintain backwards compatibility, all instances of REDSTONE_ORE should normalize
                             * to GLOWING_REDSTONE_ORE, and warn the user to change their configuration.  In the
                             * future this hack may be removed and anybody using REDSTONE_ORE will have their
                             * configurations broken.
                             */
                            if (material == Material.REDSTONE_ORE) {
                                Jobs.getPluginLogger().warning("Job "+jobKey+" is using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE.");
                                Jobs.getPluginLogger().warning("Automatically changing block to GLOWING_REDSTONE_ORE.  Please update your configuration.");
                                Jobs.getPluginLogger().warning("In vanilla minecraft, REDSTONE_ORE changes to GLOWING_REDSTONE_ORE when interacted with.");
                                Jobs.getPluginLogger().warning("In the future, Jobs using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE may fail to work correctly.");
                                material = Material.GLOWING_REDSTONE_ORE;
                            }
                            // END HACK
                           
                            type = material.toString();
                        } else if (actionType == ActionType.KILL) {
                            // check entities
                            EntityType entity = EntityType.fromName(key);
                            if (entity == null) {
                                try {
View Full Code Here


  }

  @EventHandler(priority = EventPriority.LOWEST)
  public void vehicle(PlayerInteractEvent event) {
    if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
      Material clickedMaterial = event.getClickedBlock().getType();
      Player player = event.getPlayer();
      Material materialInHand = player.getItemInHand().getType();
      if (clickedMaterial == Material.RAILS
          || clickedMaterial == Material.POWERED_RAIL
          || clickedMaterial == Material.DETECTOR_RAIL) {
        if (materialInHand == Material.MINECART
            || materialInHand == Material.POWERED_MINECART
View Full Code Here

    } else if (FaceUtil.isAlongZ(dir)) {
      radZ = 0;
    }
    World world = info.getWorld();
    Block m = info.getRails();
    Material type;
    Block w = null;
    for (int x = -radX; x <= radX && w == null; x++) {
      for (int y = -radY; y <= radY && w == null; y++) {
        for (int z = -radZ; z <= radZ && w == null; z++) {
          type = WorldUtil.getBlockType(world, m.getX() + x, m.getY() + y, m.getZ() + z);
View Full Code Here

  @EventHandler(priority = EventPriority.LOWEST)
  public void door(PlayerInteractEvent event) {
    Action action = event.getAction();
    if (action == Action.LEFT_CLICK_BLOCK
        || action == Action.RIGHT_CLICK_BLOCK) {
      Material material = event.getClickedBlock().getType();
      if (material == Material.WOODEN_DOOR
          || material == Material.IRON_DOOR
          || material == Material.IRON_DOOR_BLOCK
          || material == Material.TRAP_DOOR
          || material == Material.FENCE_GATE) {
View Full Code Here

  }

  @EventHandler(priority = EventPriority.LOWEST)
  public void repeater(PlayerInteractEvent event) {
    if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
      Material material = event.getClickedBlock().getType();
      if (material == Material.DIODE_BLOCK_ON
          || material == Material.DIODE_BLOCK_OFF) {
        prevent(event, event.getPlayer(), "repeater,interact");
      }
    }
View Full Code Here

  }

  @EventHandler(priority = EventPriority.LOWEST)
  public void pressureplate(PlayerInteractEvent event) {
    if (event.getAction() == Action.PHYSICAL) {
      Material material = event.getClickedBlock().getType();
      if (material == Material.STONE_PLATE
          || material == Material.WOOD_PLATE) {
        prevent(event, event.getPlayer(), "pressureplate,interact");
      }
    }
View Full Code Here

  ecrire("boucles sur l'inventaire");
  for (int i = 0; i < matos.length; i++)
  {
     
      ecrire("r�cup�ration du type");
      Material huhu = inventaire.getItem(i).getType();

      ecrire("eliminiation du vide");
      if ( ! huhu.name().contains("AIR") )
      {
    ecrire("stockage des donnees");
    String tmp = matos[i].toString().substring(10, matos[i].toString().length() - 1);
    if (i < matos.length - 2) // n'insère pas un | après le dernier élément
        tmp += " | ";
View Full Code Here

        skillContents.add("    " + "    " + "Repair_Material_Quantity: 9");
        skillContents.add("    " + "    " + "Repair_Material_Pretty_Name: Repair Item Name");
        skillContents.add("    " + "    " + "Repair_MinimumLevel: 0");
        skillContents.add("    " + "    " + "Repair_XpMultiplier: 1.0");

        Material material = Material.matchMaterial(materialName);
        short durability = (material == null) ? (short) 9999 : material.getMaxDurability();
        skillContents.add("    " + "    " + "Durability: " + ((durability > 0) ? durability : (short) 9999));
    }
View Full Code Here

        this.salvageables = new HashMap<Material, Salvageable>(salvageablesSize);
    }

    @Override
    public void registerSalvageable(Salvageable salvageable) {
        Material item = salvageable.getItemMaterial();
        salvageables.put(item, salvageable);
    }
View Full Code Here

            String materialName = treasureInfo[0];

            /*
             * Material, Amount, and Data
             */
            Material material;

            if (materialName.contains("POTION")) {
                material = Material.POTION;
            }
            else if (materialName.contains("INK_SACK")) {
                material = Material.INK_SACK;
            }
            else {
                material = Material.matchMaterial(materialName);
            }

            int amount = config.getInt(type + "." + treasureName + ".Amount");
            short data = (treasureInfo.length == 2) ? Byte.valueOf(treasureInfo[1]) : (short) config.getInt(type + "." + treasureName + ".Data");

            if (material == null) {
                reason.add("Invalid material: " + materialName);
            }

            if (amount <= 0) {
                reason.add("Amount of " + treasureName + " must be greater than 0! " + amount);
            }

            if (material != null && material.isBlock() && (data > 127 || data < -128)) {
                reason.add("Data of " + treasureName + " is invalid! " + data);
            }

            /*
             * XP, Drop Chance, and Drop Level
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.