diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-09-08 20:23:48 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-09-08 20:23:48 -0400 |
commit | 0016be3161a6d33bdd8d74d1552b3f3d76c51818 (patch) | |
tree | d7a124edb141bbda657dcfa9b60365d609f88f3c | |
parent | a29cfb42db5da544f8445f56acb3742e396d8dee (diff) | |
download | SkyblockMod-0016be3161a6d33bdd8d74d1552b3f3d76c51818.tar.gz SkyblockMod-0016be3161a6d33bdd8d74d1552b3f3d76c51818.tar.bz2 SkyblockMod-0016be3161a6d33bdd8d74d1552b3f3d76c51818.zip |
Fix /scg crashing with pet colours
-rw-r--r-- | src/main/java/me/Danker/TheMod.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index ec2dedf..7a1f219 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -1649,11 +1649,12 @@ public class TheMod if (ToggleCommand.petColoursToggled && event.gui instanceof GuiChest) { GuiChest inventory = (GuiChest) event.gui; List<Slot> invSlots = inventory.inventorySlots.inventorySlots; + Pattern petPattern = Pattern.compile("\\[Lvl [\\d]{1,3}]"); for (Slot slot : invSlots) { ItemStack item = slot.getStack(); if (item == null) continue; String name = item.getDisplayName(); - if (name.contains("[Lvl ")) { + if (petPattern.matcher(StringUtils.stripControlCodes(name)).find()) { if (name.endsWith("aHealer") || name.endsWith("aMage") || name.endsWith("aBerserk") || name.endsWith("aArcher") || name.endsWith("aTank")) continue; int colour; int petLevel = Integer.parseInt(item.getDisplayName().substring(item.getDisplayName().indexOf(" ") + 1, item.getDisplayName().indexOf("]"))); |