Adds tons of changes to messages
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
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 <p>The string to match to a material</p>
|
||||
* @return <p>The material matching the string, or null if not found</p>
|
||||
*/
|
||||
public static Material matchMaterial(String input) {
|
||||
return Material.matchMaterial(input.replace("-", "_"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to find the enchantment matching the given input string
|
||||
*
|
||||
* @param input <p>The string to match to an enchantment</p>
|
||||
* @return <p>The enchantment matching the string, or null if not found</p>
|
||||
*/
|
||||
public static Enchantment matchEnchantment(String input) {
|
||||
return Enchantment.getByKey(NamespacedKey.minecraft(input.replace("-", "_")));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user