diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-06-25 23:27:34 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2021-06-25 23:27:34 -0400 |
commit | 6e2a26294383a67691d837dbbdd00adffbe70a80 (patch) | |
tree | a308b1168a79d2d3f65342bd27a845f917d979ae /src/main/java/me/Danker/utils | |
parent | 5c7c3d0f5ca04df48c2b8f054a662300e9f0d14b (diff) | |
download | SkyblockMod-6e2a26294383a67691d837dbbdd00adffbe70a80.tar.gz SkyblockMod-6e2a26294383a67691d837dbbdd00adffbe70a80.tar.bz2 SkyblockMod-6e2a26294383a67691d837dbbdd00adffbe70a80.zip |
Fix issues with skill features
Diffstat (limited to 'src/main/java/me/Danker/utils')
-rw-r--r-- | src/main/java/me/Danker/utils/Utils.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java index 4acee7f..b828146 100644 --- a/src/main/java/me/Danker/utils/Utils.java +++ b/src/main/java/me/Danker/utils/Utils.java @@ -2,6 +2,7 @@ package me.Danker.utils; import me.Danker.DankersSkyblockMod; import me.Danker.features.GoldenEnchants; +import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import net.minecraft.block.Block; @@ -574,6 +575,7 @@ public class Utils { int number = 0; for (int i = 0; i < text.length(); i++) { + if (!romanNumerals.containsKey(text.charAt(i))) continue; int roman = romanNumerals.get(text.charAt(i)); if (i != text.length() - 1 && roman < romanNumerals.get(text.charAt(i + 1))) { @@ -586,6 +588,7 @@ public class Utils { return number; } + return -1; } @@ -593,4 +596,22 @@ public class Utils { return DankersSkyblockMod.miningLevel != -1; } + public static int initializeSkill(ItemStack skillStack, String configValue) { + int level = -1; + + if (skillStack != null) { + String display = skillStack.getDisplayName(); + if (display.startsWith("§a")) { + if (display.contains(" ")) { + level = Utils.getIntFromString(display.substring(display.indexOf(" ") + 1), true); + } else { + level = 0; + } + } + } + + ConfigHandler.writeIntConfig("skills", configValue, level); + return level; + } + } |