Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static TWDItem getCustomItemFromConfig(String name) {
- FileConfiguration fileConfiguration = Main.getInstance().getConfigManager().getCustomItems();
- String displayName = fileConfiguration.getString("CustomItems." + name + ".Name");
- Material material = Material.matchMaterial(fileConfiguration.getString("CustomItems." + name + ".Material").toUpperCase());
- System.out.println(fileConfiguration == null);
- System.out.println(fileConfiguration.getString("CustomItems." + name + ".Material") == null);
- System.out.println(name);
- System.out.println(material);
- List<String> lore = fileConfiguration.getStringList("CustomItems." + name + ".Lore");
- int tier = fileConfiguration.getInt("CustomItems." + name + ".Tier");
- ItemStack itemStack = new ItemStack(material);
- ItemMeta itemMeta = itemStack.getItemMeta(); {
- itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName));
- List<String> translatedLore = new ArrayList<>();
- lore.forEach(entry -> translatedLore.add(ChatColor.translateAlternateColorCodes('&', entry)));
- itemMeta.setLore(translatedLore);
- }
- itemStack.setItemMeta(itemMeta);
- return new TWDItem(itemStack, tier);
- }
Advertisement
Add Comment
Please, Sign In to add comment