package net.knarcraft.blacksmith.util; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; /** * A helper class for parsing input into proper object types */ public final class InputParsingHelper { private InputParsingHelper() { } /** * Tries to find the material matching the given input string * * @param input

The string to match to a material

* @return

The material matching the string, or null if not found

*/ public static Material matchMaterial(String input) { return Material.matchMaterial(input.replace("-", "_")); } /** * Tries to find the enchantment matching the given input string * * @param input

The string to match to an enchantment

* @return

The enchantment matching the string, or null if not found

*/ public static Enchantment matchEnchantment(String input) { return Enchantment.getByKey(NamespacedKey.minecraft(input.replace("-", "_"))); } }