Package valorless.rarespawns.utils
Interface EnchantmentParser
public interface EnchantmentParser
Utility for parsing Bukkit
Enchantment instances from string identifiers.
Uses Enchantment.getByName(String) for broad version compatibility.
Note: getByName is deprecated in modern Bukkit versions; prefer NamespacedKey-based
lookups when available. This helper preserves legacy behavior used by configs.
-
Method Summary
-
Method Details
-
Parse
Parses an enchantment by its configured name.Delegates to
Enchantment.getByName(String)and wraps invalid input by throwingInvalidEnchantmentwith a descriptive message.- Parameters:
enchant- the enchantment name as used in configuration (e.g., "SHARPNESS")- Returns:
- the resolved
Enchantment - Throws:
InvalidEnchantment- if the provided name does not map to a known enchantment
-