From b1907920642c1955e245ab72ef2b2997553a4f56 Mon Sep 17 00:00:00 2001 From: Oth3r <68134921+Oth3r@users.noreply.github.com> Date: Mon, 16 Jun 2025 20:30:38 -0500 Subject: [PATCH] switch to otterlib Num utility --- .../java/one/oth3r/sit/file/ServerConfig.java | 4 +- src/main/java/one/oth3r/sit/utl/Utl.java | 40 ------------------- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/src/main/java/one/oth3r/sit/file/ServerConfig.java b/src/main/java/one/oth3r/sit/file/ServerConfig.java index 842572c..8a36ad3 100644 --- a/src/main/java/one/oth3r/sit/file/ServerConfig.java +++ b/src/main/java/one/oth3r/sit/file/ServerConfig.java @@ -5,10 +5,10 @@ import com.google.gson.JsonSyntaxException; import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import net.minecraft.util.Hand; +import one.oth3r.otterlib.base.Num; import one.oth3r.otterlib.file.CustomFile; import one.oth3r.otterlib.file.FileSettings; import one.oth3r.sit.utl.Data; -import one.oth3r.sit.utl.Utl; import org.jetbrains.annotations.NotNull; import java.io.File; @@ -370,7 +370,7 @@ public class ServerConfig implements CustomFile { // skip if not the right size if (split.length < 3 || split.length > 4) continue; // if the other entries aren't correct, skip - if (!Utl.Num.isNum(split[2])) continue; + if (!Num.isNum(split[2])) continue; // make the block states list if possible ArrayList blockstates = new ArrayList<>(); diff --git a/src/main/java/one/oth3r/sit/utl/Utl.java b/src/main/java/one/oth3r/sit/utl/Utl.java index ea2fc19..d39a95a 100644 --- a/src/main/java/one/oth3r/sit/utl/Utl.java +++ b/src/main/java/one/oth3r/sit/utl/Utl.java @@ -60,46 +60,6 @@ public class Utl { return Data.getSitEntities().values().stream().noneMatch(entity -> entity.getBlockPos().equals(pos)); } - public static class Num { - - public static boolean isInt(String string) { - try { - Integer.parseInt(string); - } catch (NumberFormatException nfe) { - return false; - } - return true; - } - - public static Integer toInt(String s) { - // return an int no matter what - try { - return Integer.parseInt(s); - } catch (NumberFormatException e) { - try { - return (int) Double.parseDouble(s); - } catch (NumberFormatException e2) { - return 0; - } - } - } - - public static boolean isNum(String s) { - // checks if int or a double - try { - Integer.parseInt(s); - return true; - } catch (NumberFormatException e1) { - try { - Double.parseDouble(s); - return true; - } catch (NumberFormatException e2) { - return false; - } - } - } - } - public static final double HALF_BLOCK = 0.5; public static final double CARPET = 0.062;