Examples of ItemMeta


Examples of org.bukkit.inventory.meta.ItemMeta

            }
          } else {
            ci.addUnsafeEnchantment(ench, lvl);
          }
    }
    ItemMeta tool;
    if (ci.hasItemMeta())
      tool = ci.getItemMeta();
    else
      tool = Bukkit.getItemFactory().getItemMeta(ci.getType());
    tool.setLore(tier.getLore());
    List<String> list = new ArrayList<String>();
    if (plugin.getConfig().getBoolean("Lore.Enabled", true)
        && (plugin.getSingleRandom().nextInt(10000) <= plugin
            .getSettings().getLoreChance())) {
      for (int i = 0; i < plugin.getConfig().getInt("Lore.EnhanceAmount",
          2); i++)
        if (plugin.getItemAPI().isArmor(mat)) {
          list.add(plugin.defenselore.get(plugin.getSingleRandom()
              .nextInt(plugin.defenselore.size())));

        } else if (plugin.getItemAPI().isTool(mat)) {
          list.add(plugin.offenselore.get(plugin.getSingleRandom()
              .nextInt(plugin.offenselore.size())));
        }
    }
    tool.setLore(list);
    ci.setItemMeta(tool);
    return ci;
  }
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

            }
          } else {
            tool.addUnsafeEnchantment(ench, lvl);
          }
    }
    ItemMeta meta;
    if (tool.hasItemMeta())
      meta = tool.getItemMeta();
    else
      meta = Bukkit.getItemFactory().getItemMeta(tool.getType());
    meta.setDisplayName(tier.getColor() + name(tool.getType()));
    if (plugin.getConfig().getBoolean("Lore.Enabled", true)
        && (plugin.getSingleRandom().nextInt(100) <= plugin
            .getSettings().getLoreChance())
        && !tier.getColor().equals(ChatColor.MAGIC)) {
      for (int i = 0; i < plugin.getConfig().getInt("Lore.EnhanceAmount",
          2); i++)
        if (plugin.getItemAPI().isArmor(tool.getType())) {
          list.add(colorPicker()
              + plugin.defenselore.get(plugin.getSingleRandom()
                  .nextInt(plugin.defenselore.size())));

        } else if (plugin.getItemAPI().isTool(tool.getType())) {
          list.add(colorPicker()
              + plugin.offenselore.get(plugin.getSingleRandom()
                  .nextInt(plugin.offenselore.size())));
        }
    }
    meta.setLore(list);
    tool.setItemMeta(meta);
    return tool;
  }
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

            }
          } else {
            tool.addUnsafeEnchantment(ench, lvl);
          }
    }
    ItemMeta meta;
    if (tool.hasItemMeta())
      meta = tool.getItemMeta();
    else
      meta = Bukkit.getItemFactory().getItemMeta(tool.getType());
    if (plugin.getConfig().getBoolean("Lore.Enabled", true)
        && (plugin.getSingleRandom().nextInt(10000) <= plugin
            .getSettings().getLoreChance())
        && !tier.getColor().equals(ChatColor.MAGIC)) {
      for (int i = 0; i < plugin.getConfig().getInt("Lore.EnhanceAmount",
          2); i++)
        if (plugin.getItemAPI().isArmor(mat)) {
          list.add(colorPicker()
              + plugin.defenselore.get(plugin.getSingleRandom()
                  .nextInt(plugin.defenselore.size())));
        } else if (plugin.getItemAPI().isTool(mat)) {
          list.add(colorPicker()
              + plugin.offenselore.get(plugin.getSingleRandom()
                  .nextInt(plugin.offenselore.size())));
        }
    }
    meta.setLore(list);
    tool.setItemMeta(meta);
    if (plugin.getItemAPI().isLeather(tool.getType())) {
      LeatherArmorMeta lam = (LeatherArmorMeta) tool.getItemMeta();
      lam.setColor(Color.fromRGB(plugin.getSingleRandom().nextInt(255),
          plugin.getSingleRandom().nextInt(255), plugin
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

            }
          } else {
            tool.addUnsafeEnchantment(ench, lvl);
          }
    }
    ItemMeta meta;
    if (tool.hasItemMeta())
      meta = tool.getItemMeta();
    else
      meta = Bukkit.getItemFactory().getItemMeta(tool.getType());
    if (plugin.getConfig().getBoolean("Lore.Enabled", true)
        && (plugin.getSingleRandom().nextInt(10000) <= plugin
            .getSettings().getLoreChance())
        && !tier.getColor().equals(ChatColor.MAGIC)) {
      for (int i = 0; i < plugin.getConfig().getInt("Lore.EnhanceAmount",
          2); i++)
        if (plugin.getItemAPI().isArmor(mat)) {
          list.add(colorPicker()
              + plugin.defenselore.get(plugin.getSingleRandom()
                  .nextInt(plugin.defenselore.size())));

        } else if (plugin.getItemAPI().isTool(mat)) {
          list.add(colorPicker()
              + plugin.offenselore.get(plugin.getSingleRandom()
                  .nextInt(plugin.offenselore.size())));
        }
    }
    meta.setLore(list);
    tool.setItemMeta(meta);
    if (plugin.getItemAPI().isLeather(tool.getType())) {
      LeatherArmorMeta lam = (LeatherArmorMeta) tool.getItemMeta();
      lam.setColor(Color.fromRGB(plugin.getSingleRandom().nextInt(255),
          plugin.getSingleRandom().nextInt(255), plugin
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

            }
          } else {
            tool.addUnsafeEnchantment(ench, lvl);
          }
    }
    ItemMeta meta = tool.getItemMeta();
    if (plugin.getConfig().getBoolean("Lore.Enabled", true)
        && (plugin.getSingleRandom().nextInt(10000) <= plugin
            .getSettings().getLoreChance())
        && !tier.getColor().equals(ChatColor.MAGIC)) {
      for (int i = 0; i < plugin.getConfig().getInt("Lore.EnhanceAmount",
          2); i++)
        if (plugin.getItemAPI().isArmor(tool.getType())) {
          list.add(plugin.defenselore.get(plugin.getSingleRandom()
              .nextInt(plugin.defenselore.size())));

        } else if (plugin.getItemAPI().isTool(tool.getType())) {
          list.add(plugin.offenselore.get(plugin.getSingleRandom()
              .nextInt(plugin.offenselore.size())));
        }
    }
    meta.setLore(list);
    tool.setItemMeta(meta);
    if (plugin.getItemAPI().isLeather(tool.getType())) {
      LeatherArmorMeta lam = (LeatherArmorMeta) tool.getItemMeta();
      lam.setColor(Color.fromRGB(plugin.getSingleRandom().nextInt(255),
          plugin.getSingleRandom().nextInt(255), plugin
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

          || player.getItemInHand().getType().equals(Material.AIR)) {
        sender.sendMessage(ChatColor.RED + "Not enough arguments.");
        return true;
      }
      ItemStack tool = player.getItemInHand();
      ItemMeta meta = tool.getItemMeta();
      if (args[1].equalsIgnoreCase("lore")) {
        if (args[2].equalsIgnoreCase("clear")) {
          meta.setLore(null);
          tool.setItemMeta(meta);
          player.sendMessage(ChatColor.GREEN
              + "Cleared the lore for the item!");
          return true;
        }
        String lore = combineSplit(2, args);
        lore = ChatColor.translateAlternateColorCodes(
            "&".toCharArray()[0], lore);
        meta.setLore(Arrays.asList(lore.split(",")));
        tool.setItemMeta(meta);
        player.sendMessage(ChatColor.GREEN
            + "Set the lore for the item!");
        return true;
      } else if (args[1].equalsIgnoreCase("name")) {
        if (args[2].equalsIgnoreCase("clear")) {
          tool.getItemMeta().setDisplayName(null);
          player.sendMessage(ChatColor.GREEN
              + "Cleared the name for the item!");
          return true;
        }
        String name = combineSplit(2, args);
        name = ChatColor.translateAlternateColorCodes(
            "&".toCharArray()[0], name);
        meta.setDisplayName(name);
        tool.setItemMeta(meta);
        player.sendMessage(ChatColor.GREEN
            + "Set the name for the item!");
        return true;
      } else if (args[1].equalsIgnoreCase("enchant")) {
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

      }
    List<String> effects = new ArrayList<String>();
    for (ItemStack tool : toolSet) {
      if (!tool.hasItemMeta())
        continue;
      ItemMeta meta = tool.getItemMeta();
      if ((!meta.hasLore() || meta.getLore() == null)
          || meta.getLore().isEmpty())
        continue;
      for (String string : meta.getLore()) {
        string = ChatColor.stripColor(string).replace("%", "");
        if (!DiabloDrops.getInstance().defenselore.contains(string)
            && !DiabloDrops.getInstance().offenselore
                .contains(string))
          continue;
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

  public String getNameOfSet(final LivingEntity entity) {
    ItemStack his = entity.getEquipment().getHelmet();
    if (his == null)
      return null;
    if (his.hasItemMeta()) {
      ItemMeta meta = his.getItemMeta();
      if (meta.getDisplayName() != null) {
        String[] splits = ChatColor.stripColor(meta.getDisplayName())
            .split(" ");
        return splits[0];
      }
    }
    return null;
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

  public String getNameOfSet(Player player) {
    ItemStack his = player.getInventory().getHelmet();
    if (his == null)
      return null;
    if (his.hasItemMeta()) {
      ItemMeta meta = his.getItemMeta();
      if (meta.getDisplayName() != null) {
        String[] splits = ChatColor.stripColor(meta.getDisplayName())
            .split(" ");
        return splits[0];
      }
    }
    return null;
View Full Code Here

Examples of org.bukkit.inventory.meta.ItemMeta

    Set<ItemStack> sis = new HashSet<ItemStack>();
    sis.add(cis);
    sis.add(lis);
    sis.add(bis);
    if (his.hasItemMeta()) {
      ItemMeta meta = his.getItemMeta();
      String potentialSet = "";
      if (meta.getDisplayName() != null) {
        String[] splits = ChatColor.stripColor(meta.getDisplayName())
            .split(" ");
        potentialSet = splits[0];
        for (ItemStack is : sis) {
          ItemMeta ism = is.getItemMeta();
          if (ism != null) {
            if (ism.getDisplayName() != null) {
              String[] splits1 = ChatColor.stripColor(
                  ism.getDisplayName()).split(" ");
              if (!splits1[0].equalsIgnoreCase(potentialSet))
                return false;
            }
          }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.