33import io .papermc .paper .enchantments .EnchantmentRarity ;
44import net .kyori .adventure .text .Component ;
55import org .bukkit .NamespacedKey ;
6+ import org .bukkit .Registry ;
67import org .bukkit .enchantments .Enchantment ;
78import org .bukkit .enchantments .EnchantmentTarget ;
89import org .bukkit .entity .EntityCategory ;
1516import java .util .Set ;
1617
1718public class EnchantGlow extends Enchantment {
19+
20+ private final NamespacedKey key ;
21+
1822 public EnchantGlow (@ NotNull NamespacedKey key ) {
19- super ( key ) ;
23+ this . key = key ;
2024 }
2125
2226 @ Override
@@ -74,6 +78,16 @@ public boolean isDiscoverable() {
7478 return false ;
7579 }
7680
81+ @ Override
82+ public int getMinModifiedCost (int level ) {
83+ return 0 ;
84+ }
85+
86+ @ Override
87+ public int getMaxModifiedCost (int level ) {
88+ return 0 ;
89+ }
90+
7791 @ Override
7892 public @ NotNull EnchantmentRarity getRarity () {
7993 return EnchantmentRarity .COMMON ;
@@ -97,19 +111,24 @@ public float getDamageIncrease(int level, @NotNull EntityCategory entityCategory
97111 public static EnchantGlow instance = null ;
98112
99113 public static void registerFakeGlow (ParallelUtils puPlugin ) {
100- try {
101- Field f = Enchantment .class .getDeclaredField ("acceptingNew" );
102- f .setAccessible (true );
103- f .set (null , true );
104- } catch (Exception e ) {
105- e .printStackTrace ();
106- }
114+ // try {
115+ // Field f = Enchantment.class.getDeclaredField("acceptingNew");
116+ // f.setAccessible(true);
117+ // f.set(null, true);
118+ // } catch (Exception e) {
119+ // e.printStackTrace();
120+ // }
107121
108122 try {
109123 instance = new EnchantGlow (new NamespacedKey (puPlugin , "glow" ));
110- Enchantment . registerEnchantment ( instance );
124+
111125 } catch (Exception e ) {
112126 e .printStackTrace ();
113127 }
114128 }
129+
130+ @ Override
131+ public @ NotNull NamespacedKey getKey () {
132+ return key ;
133+ }
115134}
0 commit comments