11package me .zort .configurationlib .configuration .bukkit ;
22
33import lombok .Getter ;
4- import lombok .RequiredArgsConstructor ;
54import me .zort .configurationlib .*;
6- import me .zort .configurationlib .configuration .bukkit .adapter .ItemStackAdapter ;
5+ import me .zort .configurationlib .configuration .bukkit .adapter .DefaultItemAdapter ;
76import me .zort .configurationlib .util .Colorizer ;
87import me .zort .configurationlib .util .ItemValidator ;
98import me .zort .configurationlib .util .NodeTypeToken ;
109import me .zort .configurationlib .util .Placeholders ;
1110import org .apache .commons .lang .ArrayUtils ;
1211import org .bukkit .Bukkit ;
1312import org .bukkit .Material ;
14- import org .bukkit .NamespacedKey ;
1513import org .bukkit .configuration .ConfigurationSection ;
1614import org .bukkit .enchantments .Enchantment ;
1715import org .bukkit .inventory .ItemFlag ;
1816import org .bukkit .inventory .ItemStack ;
1917import org .bukkit .inventory .meta .ItemMeta ;
2018import org .bukkit .inventory .meta .SkullMeta ;
21- import org .jetbrains .annotations .NotNull ;
2219import org .jetbrains .annotations .Nullable ;
2320
2421import java .lang .reflect .Field ;
@@ -42,7 +39,7 @@ public BukkitSectionNode(@Nullable SectionNode<ConfigurationSection> parent, Con
4239 init ();
4340
4441 if (parent == null ) {
45- registerAdapter (ItemStack .class , new ItemStackAdapter ());
42+ registerAdapter (ItemStack .class , new DefaultItemAdapter ());
4643 }
4744 }
4845
@@ -181,7 +178,8 @@ public ItemStack getAsItem(Placeholders placeholders) {
181178 }
182179 if (section .contains ("enchantments" )) {
183180 for (String key : section .getConfigurationSection ("enchantments" ).getKeys (false )) {
184- Enchantment enchantment = Enchantment .getByKey (NamespacedKey .minecraft (key .toLowerCase ()));
181+ //Enchantment enchantment = Enchantment.getByKey(NamespacedKey.minecraft(key.toLowerCase()));
182+ Enchantment enchantment = Enchantment .getByName (key .toUpperCase ());
185183 if (enchantment == null ) {
186184 continue ;
187185 }
@@ -248,13 +246,4 @@ private static int verMajor() {
248246 return Integer .parseInt (verString );
249247 }
250248
251- private static class DefaultItemDeserializer implements NodeDeserializer <ItemStack , ConfigurationSection > {
252-
253- @ Override
254- public ItemStack deserialize (@ NotNull ItemStack deserializeInto , NodeContext <Node <ConfigurationSection >, ConfigurationSection > context , Placeholders placeholders ) {
255- return ((BukkitSectionNode ) context .getNode ()).getAsItem (placeholders );
256- }
257-
258- }
259-
260249}
0 commit comments