Auto grab enchant names for enchanted: list using /cpg

This commit is contained in:
TinyTank800 2024-01-20 11:13:45 -08:00
parent 336190f071
commit 06c30c018d

View File

@ -462,9 +462,12 @@ public class ItemCreation {
} }
file.set("panels." + panelName + ".item." + i + ".stack", cont.getAmount()); file.set("panels." + panelName + ".item." + i + ".stack", cont.getAmount());
if(!cont.getEnchantments().isEmpty()){ if(!cont.getEnchantments().isEmpty()){
List<String> enchantments = new ArrayList<>(); Map<Enchantment, Integer> enchantments = cont.getEnchantments();
enchantments.add("true"); List<String> newEnchantments = new ArrayList<>();
file.set("panels." + panelName + ".item." + i + ".enchanted", enchantments); for(Enchantment enchantment : enchantments.keySet()){
newEnchantments.add(enchantment.getKey().getKey() + " " + enchantments.get(enchantment));
}
file.set("panels." + panelName + ".item." + i + ".enchanted", newEnchantments);
} }
file.set("panels." + panelName + ".item." + i + ".name", Objects.requireNonNull(cont.getItemMeta()).getDisplayName()); file.set("panels." + panelName + ".item." + i + ".name", Objects.requireNonNull(cont.getItemMeta()).getDisplayName());
file.set("panels." + panelName + ".item." + i + ".lore", Objects.requireNonNull(cont.getItemMeta()).getLore()); file.set("panels." + panelName + ".item." + i + ".lore", Objects.requireNonNull(cont.getItemMeta()).getLore());