Writes a lot of code necessary for the scrapper
Adds the classes necessary for the new scrapper Partly implements some scrapper functionality Restructures some classes to reduce code duplication Moves some classes to make some classes easier to find Adds a bunch of TODOs where things have an unfinished implementation
This commit is contained in:
@ -3,6 +3,8 @@ package net.knarcraft.blacksmith.util;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* A helper class for parsing input into proper object types
|
||||
@ -19,7 +21,7 @@ public final class InputParsingHelper {
|
||||
* @param input <p>The input to check</p>
|
||||
* @return <p>True if the value is empty</p>
|
||||
*/
|
||||
public static boolean isEmpty(String input) {
|
||||
public static boolean isEmpty(@Nullable String input) {
|
||||
return input == null || input.equalsIgnoreCase("null") || input.equals("\"\"") ||
|
||||
input.isBlank() || input.equals("-1");
|
||||
}
|
||||
@ -30,7 +32,7 @@ public final class InputParsingHelper {
|
||||
* @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) {
|
||||
public static @Nullable Material matchMaterial(@NotNull String input) {
|
||||
return Material.matchMaterial(input.replace("-", "_"));
|
||||
}
|
||||
|
||||
@ -40,7 +42,7 @@ public final class InputParsingHelper {
|
||||
* @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) {
|
||||
public static @Nullable Enchantment matchEnchantment(@NotNull String input) {
|
||||
try {
|
||||
return Enchantment.getByKey(NamespacedKey.minecraft(
|
||||
input.replace("-", "_").replace(" ", "_").toLowerCase()));
|
||||
@ -56,7 +58,7 @@ public final class InputParsingHelper {
|
||||
* @param input <p>The input to RegExIfy</p>
|
||||
* @return <p>The converted input</p>
|
||||
*/
|
||||
public static String regExIfy(String input) {
|
||||
public static @NotNull String regExIfy(@NotNull String input) {
|
||||
return input.replace("*", ".*").toUpperCase().replace("-", "_");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user