diff options
author | bowser0000 <bowser0000@gmail.com> | 2022-01-06 18:35:16 -0500 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2022-01-06 18:35:16 -0500 |
commit | f2cf64f5b1a4894a1e6056efaafff165e41071e2 (patch) | |
tree | 3ae6bfd3987ae7529d73632737e20c987d62cc5e /src | |
parent | dda83961a0922b5753c7d4dd3e239a925d3afa7a (diff) | |
download | SkyblockMod-f2cf64f5b1a4894a1e6056efaafff165e41071e2.tar.gz SkyblockMod-f2cf64f5b1a4894a1e6056efaafff165e41071e2.tar.bz2 SkyblockMod-f2cf64f5b1a4894a1e6056efaafff165e41071e2.zip |
Actually fix dungeon coins spent
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/me/Danker/DankersSkyblockMod.java | 7 | ||||
-rw-r--r-- | src/main/java/me/Danker/events/ChestSlotClickedEvent.java | 8 | ||||
-rw-r--r-- | src/main/java/me/Danker/features/loot/CatacombsTracker.java | 15 |
3 files changed, 10 insertions, 20 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 91f561a..d1d2d10 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -486,11 +486,8 @@ public class DankersSkyblockMod { if (slot == null) return; ItemStack item = slot.getStack(); String inventoryName = inventory.getDisplayName().getUnformattedText(); - if (item == null) { - if (MinecraftForge.EVENT_BUS.post(new ChestSlotClickedEvent(chest, inventory, inventoryName, slot))) event.setCanceled(true); - } else { - if (MinecraftForge.EVENT_BUS.post(new ChestSlotClickedEvent(chest, inventory, inventoryName, slot, item))) event.setCanceled(true); - } + + if (MinecraftForge.EVENT_BUS.post(new ChestSlotClickedEvent(chest, inventory, inventoryName, slot, item))) event.setCanceled(true); } } } diff --git a/src/main/java/me/Danker/events/ChestSlotClickedEvent.java b/src/main/java/me/Danker/events/ChestSlotClickedEvent.java index 5e4702c..452979e 100644 --- a/src/main/java/me/Danker/events/ChestSlotClickedEvent.java +++ b/src/main/java/me/Danker/events/ChestSlotClickedEvent.java @@ -23,12 +23,4 @@ public class ChestSlotClickedEvent extends Event { this.item = item; } - public ChestSlotClickedEvent(GuiChest chest, IInventory inventory, String inventoryName, Slot slot) { - this.chest = chest; - this.inventory = inventory; - this.inventoryName = inventoryName; - this.slot = slot; - item = null; - } - } diff --git a/src/main/java/me/Danker/features/loot/CatacombsTracker.java b/src/main/java/me/Danker/features/loot/CatacombsTracker.java index 86770d6..c4b9634 100644 --- a/src/main/java/me/Danker/features/loot/CatacombsTracker.java +++ b/src/main/java/me/Danker/features/loot/CatacombsTracker.java @@ -188,7 +188,7 @@ public class CatacombsTracker { public void onChat(ClientChatReceivedEvent event) { String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); - if (!Utils.inSkyblock) return; + if (!Utils.inDungeons) return; if (event.type == 2) return; if (message.contains(" Team Score: ") && message.contains("(S+)")) { @@ -492,17 +492,17 @@ public class CatacombsTracker { @SubscribeEvent public void onSlotClick(ChestSlotClickedEvent event) { + if (!Utils.inDungeons) return; + ItemStack item = event.item; if (event.inventoryName.endsWith(" Chest") && item != null) { if (item.getDisplayName().contains("Open Reward Chest")) { - List<String> tooltip = item.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips); + List<String> tooltip = item.getTooltip(Minecraft.getMinecraft().thePlayer, false); for (String lineUnclean : tooltip) { String line = StringUtils.stripControlCodes(lineUnclean); - if (line.contains("FREE")) { - continue; - } else if (line.contains(" Coins") && !line.contains("NOTE:")) { - int coinsSpent = Integer.parseInt(line.substring(0, line.indexOf(" ")).replaceAll(",", "")); + if (line.contains(" Coins") && !line.contains("NOTE:")) { + int coinsSpent = Integer.parseInt(line.replaceAll("[^\\d]", "")); List<String> scoreboard = ScoreboardHandler.getSidebarLines(); for (String s : scoreboard) { @@ -541,9 +541,10 @@ public class CatacombsTracker { masterCoinsSpentSession += coinsSpent; ConfigHandler.writeDoubleConfig("catacombs", "masterCoins", masterCoinsSpent); } + break; } - break; } + break; } } } else if (item.getDisplayName().contains("Reroll Chest")) { |