Solved Get Minecraft enchantment id from spigot enchantment

Discussion in 'Spigot Plugin Development' started by weeryan17, Feb 17, 2020.

  1. So I need to get the minecraft id of an enchantment from a spigot enchantment. From what I see the spigot Enchantment class doesn't have any sort of way to get the minecraft key out of it without using a big if else statement. I looked at this on the java doc and see no reference to the minecraft id https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html. I see reference to a named key, but that doesn't contain way to convert from spigot to minecraft as far as i can tell.
     
  2. Enchantment implements Keyed.

    So Enchantment#getKey() should work well.
    I do not see an issue.
    NamespacedKey#toString() returns a String like that: "minecraft:efficiency"
     
  3. Yegh I'm a derp.Sorry about that