如何将字符串转换为(自定义类型)附魔?以下代码警报“类型不匹配:无法从字符串转换为附魔”
String s = "DAMAGE_ALL.2";
String[] enchantINFO = s.split(".");
Enchantment enchantTYPE = enchantINFO[0]; //TODO Type mismatch: cannot convert from String to Enchantment
int enchantLVL = enchantINFO[1];
player.getItemInHand().addEnchantment( enchantTYPE , enchantLVL );