Guest User

Untitled

a guest
Nov 20th, 2021
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1.     public static TWDItem getCustomItemFromConfig(String name) {
  2.         FileConfiguration fileConfiguration = Main.getInstance().getConfigManager().getCustomItems();
  3.         String displayName = fileConfiguration.getString("CustomItems." + name + ".Name");
  4.         Material material = Material.matchMaterial(fileConfiguration.getString("CustomItems." + name + ".Material").toUpperCase());
  5.         System.out.println(fileConfiguration == null);
  6.         System.out.println(fileConfiguration.getString("CustomItems." + name + ".Material") == null);
  7.         System.out.println(name);
  8.         System.out.println(material);
  9.         List<String> lore = fileConfiguration.getStringList("CustomItems." + name + ".Lore");
  10.         int tier = fileConfiguration.getInt("CustomItems." + name + ".Tier");
  11.  
  12.         ItemStack itemStack = new ItemStack(material);
  13.         ItemMeta itemMeta = itemStack.getItemMeta(); {
  14.             itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName));
  15.             List<String> translatedLore = new ArrayList<>();
  16.             lore.forEach(entry -> translatedLore.add(ChatColor.translateAlternateColorCodes('&', entry)));
  17.             itemMeta.setLore(translatedLore);
  18.         }
  19.         itemStack.setItemMeta(itemMeta);
  20.  
  21.         return new TWDItem(itemStack, tier);
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment