diff --git a/src/main/java/me/hsgamer/bettergui/util/SlotUtil.java b/src/main/java/me/hsgamer/bettergui/util/SlotUtil.java index 42f94188..1c866db5 100644 --- a/src/main/java/me/hsgamer/bettergui/util/SlotUtil.java +++ b/src/main/java/me/hsgamer/bettergui/util/SlotUtil.java @@ -1,5 +1,8 @@ package me.hsgamer.bettergui.util; +import me.hsgamer.hscore.common.Validate; + +import java.math.BigDecimal; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -69,10 +72,9 @@ public static Stream generateSlots(String input) { } } - try { - return Stream.of(Integer.parseInt(input)); - } catch (Exception ignored) { - return Stream.empty(); - } + return Validate.getNumber(input) + .map(BigDecimal::intValue) + .map(Stream::of) + .orElseGet(Stream::empty); } }