Package org.bukkit

Examples of org.bukkit.Material


          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 cart 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


   
    private static int getTypeId(String item) {
        if (item.matches("(-)?[0-9]*")) {
            return Integer.parseInt(item);
        }
        Material m = Enums.getEnumFromString(Material.class, item);
        return (m != null ? m.getId() : 0);
    }
View Full Code Here

    public float getCost(BlockSource source, PathPoint point) {

        // TODO: Understand cost weight :D

        Vector pos = point.getVector();
        Material above = source.getMaterialAt(pos.clone().add(UP));
        Material below = source.getMaterialAt(pos.clone().add(DOWN));
        Material in = source.getMaterialAt(pos);

        // Discourage walking up a Z level
        if (point.getVector().getBlockY() > npc.getEntity().getLocation().getBlockY())
            return 5f;
View Full Code Here

    }

    @Override
    public PassableState isPassable(BlockSource source, PathPoint point) {
        Vector pos = point.getVector();
        Material above = source.getMaterialAt(pos.clone().add(UP));
        Material below = source.getMaterialAt(pos.clone().add(DOWN));
        Material in = source.getMaterialAt(pos);
        if (!below.isBlock() || !canStandOn(below)) {
            return PassableState.UNPASSABLE;
        }
        if (!canStandIn(above) || !canStandIn(in)) {
            return PassableState.UNPASSABLE;
View Full Code Here

        int amt = amount.asInt();
        switch (stat.getType()) {

            case BLOCK:
            case ITEM:
                Material mat = material.getMaterial();
                switch (act) {
                    case ADD:
                        for (dPlayer player : players.filter(dPlayer.class))
                            player.incrementStatistic(stat, mat, amt);
                        break;
View Full Code Here

        return hookingEvents;
    }

    @Override
    public int resolveItem(String name) {
        Material mat = Material.matchMaterial(name);
        return mat == null ? 0 : mat.getId();
    }
View Full Code Here

   * @return
   */
  public static int getStackCount(final Inventory inventory, final ItemStack reference) {
    if (inventory == null) return 0;
    if (reference == null) return getFreeSlots(inventory);
    final Material mat = reference.getType();
    final int durability = reference.getDurability();
    final ItemStack[] contents = inventory.getContents();
    int count = 0;
    for (int i = 0; i < contents.length; i++){
      final ItemStack stack = contents[i];
View Full Code Here

        try{
            return Integer.parseInt(content);
        }
        catch(NumberFormatException e){}
        try{
            Material mat = Material.matchMaterial(prepareMatchMaterial(content));
            if (mat != null) {
              return mat.getId();
            }
        }
        catch (Exception e) {}
        return null;
    }
View Full Code Here

     */
  public void readMaterialFromList(final String path, final Collection<Material> target) {
    final List<String> content = getStringList(path);
    if (content == null || content.isEmpty()) return;
    for (final String entry : content){
      final Material mat = parseMaterial(entry);
      if (mat == null){
        LogUtil.logWarning("[NoCheatPlus] Bad material entry (" + path +"): " + entry);
      }
      else{
        target.add(mat);
View Full Code Here

     * @param stack
     * @return True if the check is failed.
     */
    public static final boolean checkIllegalEnchantments(final Player player, final ItemStack stack){
        if (stack == null) return false;
        final Material type = stack.getType();
        // Fastest checks first.
        // TODO: Make stuff configurable.
        if (type == Material.WRITTEN_BOOK){
            final Map<Enchantment, Integer> enchantments = stack.getEnchantments();
            if (enchantments != null && !enchantments.isEmpty() && instance.isEnabled(player)){
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.