Skip to content

Commit

Permalink
Added support for registering enchantment aliases without reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Sep 13, 2020
1 parent fde0665 commit e79c3b2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Essentials/src/com/earth2me/essentials/Enchantments.java
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,18 @@ public static Set<Entry<String, Enchantment>> entrySet() {
public static Set<String> keySet() {
return ENCHANTMENTS.keySet();
}

public static void registerEnchantment(String name, Enchantment enchantment) {
if(ENCHANTMENTS.containsKey(name) || ALIASENCHANTMENTS.containsKey(name))
return;

ENCHANTMENTS.put(name, enchantment);
}

public static void registerAlias(String name, Enchantment enchantment) {
if(ENCHANTMENTS.containsKey(name) || ALIASENCHANTMENTS.containsKey(name) || !ENCHANTMENTS.containsValue(enchantment))
return;

ALIASENCHANTMENTS.put(name, enchantment);
}
}

0 comments on commit e79c3b2

Please sign in to comment.