From 159c512a9fd2fd77ff49236eb361a82078f30947 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Mon, 28 Nov 2011 03:41:40 +0000 Subject: [PATCH] Added Enchantment.values() for retrieving all enchantments By: Nathan Adams --- .../main/java/org/bukkit/enchantments/Enchantment.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java b/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java index 69615817bb..646334fc45 100644 --- a/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/paper-api/src/main/java/org/bukkit/enchantments/Enchantment.java @@ -226,4 +226,13 @@ public abstract class Enchantment { public static Enchantment getByName(String name) { return byName.get(name); } + + /** + * Gets an array of all the registered {@link Enchantment}s + * + * @return Array of enchantments + */ + public static Enchantment[] values() { + return byId.values().toArray(new Enchantment[byId.size()]); + } }