From 8310ff1d171bfdec3de2a822134e91c16fd6bf51 Mon Sep 17 00:00:00 2001 From: My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> Date: Thu, 17 Dec 2020 14:09:43 -0500 Subject: Expand Notify Slayer Slain to include bows and items with abilities --- src/main/java/me/Danker/DankersSkyblockMod.java | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index dfe8a9c..902f4cf 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -2933,6 +2933,32 @@ public class DankersSkyblockMod if (ToggleCommand.lividDaggerToggled && item.getDisplayName().contains("Livid Dagger")) { event.setCanceled(true); } + if (ToggleCommand.notifySlayerSlainToggled) { + if (ScoreboardHandler.getSidebarLines().stream().anyMatch(x->ScoreboardHandler.cleanSB(x).contains("Boss slain!"))) { + if (ScoreboardHandler.getSidebarLines().stream().anyMatch(x->{ + String line = ScoreboardHandler.cleanSB(x); + return Arrays.stream(new String[]{"Howling Cave", "Ruins", "Graveyard", "Coal Mine", "Spider's Den"}).anyMatch(line::contains); + })) { + if (item.getItem() == Items.bow) { + Utils.createTitle(EnumChatFormatting.RED + "Boss slain!", 2); + } else if (Utils.hasRightClickAbility(item)) { + List lore = Utils.getItemLore(item); + + int abilityLine = -1; + for (int i = 0; i < lore.size(); i++) { + String line = StringUtils.stripControlCodes(lore.get(i)); + if (line.startsWith("Item Ability:")) abilityLine = i; + if (abilityLine != -1 && i > abilityLine) { + if (line.toLowerCase().contains("damage")) { + Utils.createTitle(EnumChatFormatting.RED + "Boss slain!", 2); + break; + } + } + } + } + } + } + } } if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) { -- cgit