diff options
Diffstat (limited to 'src/main/java/me/Danker/features')
21 files changed, 1437 insertions, 226 deletions
diff --git a/src/main/java/me/Danker/features/ArachneESP.java b/src/main/java/me/Danker/features/ArachneESP.java index c78c385..1848a9b 100644 --- a/src/main/java/me/Danker/features/ArachneESP.java +++ b/src/main/java/me/Danker/features/ArachneESP.java @@ -30,19 +30,10 @@ public class ArachneESP { arachne = null; } - public boolean inSpidersDen(List<String> scoreboard) { - for (String s : scoreboard) { - if (ScoreboardHandler.cleanSB(s).contains("Spiders Den")) { - return true; - } - } - return false; - } - @SubscribeEvent public void onChat(ClientChatReceivedEvent event) { if (!Utils.inSkyblock) return; - if (!inSpidersDen(ScoreboardHandler.getSidebarLines())) return; + if (!Utils.tabLocation.equals("Spider's Den")) return; String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); if (message.contains("Something is awakening")){ arachneActive = true; diff --git a/src/main/java/me/Danker/features/AutoAcceptReparty.java b/src/main/java/me/Danker/features/AutoAcceptReparty.java new file mode 100644 index 0000000..a89b30b --- /dev/null +++ b/src/main/java/me/Danker/features/AutoAcceptReparty.java @@ -0,0 +1,33 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import net.minecraft.client.Minecraft; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class AutoAcceptReparty { + + String partyLeader = null; + long lastDisband = 0; + + @SubscribeEvent(receiveCanceled = true) + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (ToggleCommand.autoAcceptReparty) { + String[] split = message.split("\\s"); + + if (message.contains("has disbanded the party!")) { + lastDisband = System.currentTimeMillis() / 1000; + partyLeader = split[0].contains("[") ? split[1] : split[0]; + } else if (message.contains("has invited you to join their party!")) { + String inviter = split[1].contains("[") ? split[2] : split[1]; + if (inviter.equals(partyLeader) && System.currentTimeMillis() / 1000 - lastDisband <= 120) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/party accept " + partyLeader); + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/AutoDisplay.java b/src/main/java/me/Danker/features/AutoDisplay.java index 182c0b4..89b1750 100644 --- a/src/main/java/me/Danker/features/AutoDisplay.java +++ b/src/main/java/me/Danker/features/AutoDisplay.java @@ -6,6 +6,7 @@ import me.Danker.handlers.ConfigHandler; import me.Danker.handlers.ScoreboardHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -37,6 +38,9 @@ public class AutoDisplay { } else if (sCleaned.contains("Revenant Horror")) { LootDisplay.display = "zombie"; found = true; + } else if (sCleaned.contains("Voidgloom Seraph")) { + LootDisplay.display = "enderman"; + found = true; } else if (sCleaned.contains("The Mist")){ LootDisplay.display = "ghost"; found = true; @@ -65,6 +69,16 @@ public class AutoDisplay { if (hotbarItem.getDisplayName().contains("Ancestral Spade")) { LootDisplay.display = "mythological"; found = true; + break; + } else if (hotbarItem.getItem() == Items.fishing_rod) { + List<String> lore = hotbarItem.getTooltip(player, mc.gameSettings.advancedItemTooltips); + for (int j = lore.size() - 1; j >= 0; j--) { // reverse + if (lore.get(j).contains("FISHING ROD")) { + LootDisplay.display = "fishing"; + found = true; + break; + } + } } } if (!found) LootDisplay.display = "off"; diff --git a/src/main/java/me/Danker/features/ColouredNames.java b/src/main/java/me/Danker/features/ColouredNames.java new file mode 100644 index 0000000..cba327a --- /dev/null +++ b/src/main/java/me/Danker/features/ColouredNames.java @@ -0,0 +1,119 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.event.entity.player.PlayerEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class ColouredNames { + + public static List<String> users = new ArrayList<>(); + public static final EnumChatFormatting[] RAINBOW_COLOURS = new EnumChatFormatting[]{EnumChatFormatting.RED, EnumChatFormatting.GOLD, EnumChatFormatting.YELLOW, EnumChatFormatting.GREEN, EnumChatFormatting.AQUA, EnumChatFormatting.BLUE, EnumChatFormatting.DARK_PURPLE}; + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + if (!ToggleCommand.customColouredNames || !Utils.inSkyblock || event.type != 0) return; + + for (String user : users) { + if (event.message.getFormattedText().contains(user)) { + event.message = replaceChat(event.message, user); + } + } + } + + @SubscribeEvent + public void onTooltip(ItemTooltipEvent event) { + if (!ToggleCommand.customColouredNames || !Utils.inSkyblock) return; + + for (String user : users) { + for (int i = 0; i < event.toolTip.size(); i++) { + if (event.toolTip.get(i).contains(user)) { + event.toolTip.set(i, replaceName(event.toolTip.get(i), user, getColourFromName(user))); + } + } + } + } + + @SubscribeEvent + public void onRenderNametag(PlayerEvent.NameFormat event) { + if (!ToggleCommand.customColouredNames || !Utils.inSkyblock) return; + + if (users.contains(event.username)) { + event.displayname = replaceName(event.displayname, event.username, getColourFromName(event.username)); + } + } + + @SubscribeEvent + public void onRenderLiving(RenderLivingEvent.Specials.Pre<EntityLivingBase> event) { + if (!ToggleCommand.customColouredNames || !Utils.inSkyblock) return; + + Entity entity = event.entity; + if (entity.hasCustomName()) { + for (String user : users) { + if (entity.getCustomNameTag().contains(user)) { + entity.setCustomNameTag(replaceName(entity.getCustomNameTag(), user, getColourFromName(user))); + } + } + } + } + + // https://github.com/SteveKunG/SkyBlockcatia/blob/1.8.9/src/main/java/com/stevekung/skyblockcatia/utils/SupporterUtils.java#L53 + public static String replaceName(String text, String name, String colour) { + String namePattern = "(?:(?:\\u00a7[0-9a-fbr])\\B(?:" + name + ")\\b)|(?:\\u00a7[rb]" + name + "\\u00a7r)|\\b" + name + "\\b"; + Matcher prevColourMat = Pattern.compile("(?:.*(?:(?<colour>\\u00a7[0-9a-fbr])" + name + ")\\b.*)").matcher(text); + + if (prevColourMat.matches()) { + if (colour.equals("§z")) { + StringBuilder rainbowName = new StringBuilder(); + for (int i = 0; i < name.length(); i++) { + rainbowName.append(RAINBOW_COLOURS[i % 7]).append(name.charAt(i)); + } + return text.replaceAll(namePattern, rainbowName + prevColourMat.group("colour")); + } + return text.replaceAll(namePattern, colour + name + prevColourMat.group("colour")); + } + + if (colour.equals("§z")) { + StringBuilder rainbowName = new StringBuilder(); + for (int i = 0; i < name.length(); i++) { + rainbowName.append(RAINBOW_COLOURS[i % 7]).append(name.charAt(i)); + } + return text.replaceAll(namePattern, rainbowName.toString() + EnumChatFormatting.WHITE); + } + return text.replaceAll(namePattern, colour + name + EnumChatFormatting.WHITE); + } + + // https://github.com/Moulberry/Hychat/blob/master/src/main/java/io/github/moulberry/hychat/util/TextProcessing.java#L23 + public static IChatComponent replaceChat(IChatComponent component, String user) { + IChatComponent newComponent; + ChatComponentText text = (ChatComponentText) component; + + newComponent = new ChatComponentText(replaceName(text.getUnformattedTextForChat(), user, getColourFromName(user))); + newComponent.setChatStyle(text.getChatStyle().createShallowCopy()); + + for (IChatComponent sibling : text.getSiblings()) { + newComponent.appendSibling(replaceChat(sibling, user)); + } + + return newComponent; + } + + public static String getColourFromName(String name) { + return "§" + DankersSkyblockMod.data.get("colourednames").getAsJsonObject().get(name).getAsString(); + } + +} diff --git a/src/main/java/me/Danker/features/CrystalHollowWaypoints.java b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java new file mode 100644 index 0000000..37f709a --- /dev/null +++ b/src/main/java/me/Danker/features/CrystalHollowWaypoints.java @@ -0,0 +1,193 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.handlers.ScoreboardHandler; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.event.ClickEvent; +import net.minecraft.util.*; +import net.minecraft.world.World; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.List; + +public class CrystalHollowWaypoints { + + public static List<Waypoint> waypoints = new ArrayList<>(); + + static boolean khazad = false; + static boolean fairy = false; + static boolean temple = false; + static boolean guardian = false; + static boolean divan = false; + static boolean corleone = false; + static boolean king = false; + static boolean queen = false; + static boolean city = false; + static boolean nucleus = false; + static boolean shop = false; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer player = mc.thePlayer; + World world = mc.theWorld; + + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.crystalAutoWaypoints && Utils.tabLocation.equals("Crystal Hollows") && world != null) { + boolean found = false; + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + + if (!nucleus) { + nucleus = true; + waypoints.add(new Waypoint("Crystal Nucleus", new BlockPos(512, 110, 512))); + } + + for (String s : scoreboard) { + String sCleaned = ScoreboardHandler.cleanSB(s); + if (!khazad && sCleaned.contains("Khazad-d")) { + khazad = found = true; + waypoints.add(new Waypoint("Khazad-dûm", player.getPosition())); + } else if (!fairy && sCleaned.contains("Fairy Grotto")) { + fairy = found = true; + waypoints.add(new Waypoint("Fairy Grotto", player.getPosition())); + } else if (!temple && sCleaned.contains("Jungle Temple")) { + temple = found = true; + waypoints.add(new Waypoint("Jungle Temple", player.getPosition())); + } else if (!divan && sCleaned.contains("Mines of Divan")) { + divan = found = true; + waypoints.add(new Waypoint("Mines of Divan", player.getPosition())); + } else if (!queen && sCleaned.contains("Goblin Queen's Den")) { + queen = found = true; + waypoints.add(new Waypoint("Goblin Queen's Den", player.getPosition())); + } else if (!city && sCleaned.contains("Lost Precursor City")) { + city = found = true; + waypoints.add(new Waypoint("Lost Precursor City", player.getPosition())); + } + + if (found) break; + } + + if (!found) { + AxisAlignedBB scan = new AxisAlignedBB(player.getPosition().add(-15, -15, -15), player.getPosition().add(15, 15, 15)); + List<EntityArmorStand> entities = world.getEntitiesWithinAABB(EntityArmorStand.class, scan); + + for (EntityArmorStand entity : entities) { + if (entity.hasCustomName()) { + if (!king && entity.getCustomNameTag().endsWith("King Yolkar")) { + king = found = true; + waypoints.add(new Waypoint("King Yolkar", entity.getPosition())); + } else if (!corleone && entity.getCustomNameTag().endsWith("Boss Corleone")) { + corleone = found = true; + waypoints.add(new Waypoint("Boss Corleone", entity.getPosition())); + } else if (!guardian && entity.getCustomNameTag().contains("Key Guardian")) { + guardian = found = true; + waypoints.add(new Waypoint("Key Guardian", entity.getPosition())); + } else if (!shop && entity.getCustomNameTag().contains("Odawa")) { + shop = found = true; + waypoints.add(new Waypoint("Odawa", entity.getPosition())); + } + } + } + } + + if (found && ToggleCommand.crystalHollowWaypoints) { + Waypoint latest = waypoints.get(waypoints.size() - 1); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Added " + latest.location + " @ " + latest.getPos())); + } + } + } + } + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + + /* examples + $SBECHWP:Mines of Divan@-673,117,426 + $SBECHWP:Khazad-dûm@-292,63,281\nFairy Grotto@-216,110,400\njungle temple@-525,110,395\nJungle Temple@-493,101,425\nMines of Divan@-673,117,426 + */ + if (ToggleCommand.crystalHollowWaypoints && Utils.tabLocation.equals("Crystal Hollows")) { + if (!message.contains(player.getName()) && (message.contains(": $DSMCHWP:") || message.contains(": $SBECHWP:"))) { + ChatComponentText add = new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " [ADD]\n"); + add.setChatStyle(add.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/dsmaddcrystalhollowwaypoints " + message.substring(message.lastIndexOf(":") + 1)))); + + new Thread(() -> { + try { + Thread.sleep(10); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + player.addChatMessage(new ChatComponentText("\n" + DankersSkyblockMod.MAIN_COLOUR + "DSM/SBE Crystal Hollows waypoints found. Click to add.\n").appendSibling(add)); + }).start(); + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.crystalHollowWaypoints && Utils.tabLocation.equals("Crystal Hollows")) { + for (Waypoint waypoint : waypoints) { + if (waypoint.toggled) Utils.draw3DWaypointString(waypoint, event.partialTicks); + } + } + } + + @SubscribeEvent + public void onWorldChange(WorldEvent.Load event) { + waypoints.clear(); + khazad = false; + fairy = false; + temple = false; + guardian = false; + divan = false; + corleone = false; + king = false; + queen = false; + city = false; + nucleus = false; + shop = false; + } + + public static class Waypoint { + + public String location; + public BlockPos pos; + public boolean toggled; + + public Waypoint(String location, BlockPos pos) { + this.location = location; + this.pos = pos; + this.toggled = true; + } + + public String getFormattedWaypoint() { + return location + "@" + pos.getX() + "," + pos.getY() + "," + pos.getZ(); + } + + public String getDistance(EntityPlayer player) { + return Math.round(player.getDistance(pos.getX(), pos.getY(), pos.getZ())) + "m"; + } + + public String getPos() { + return pos.getX() + ", " + pos.getY() + ", " + pos.getZ(); + } + + public void toggle() { + toggled = !toggled; + } + + } + +} diff --git a/src/main/java/me/Danker/features/CustomMusic.java b/src/main/java/me/Danker/features/CustomMusic.java index 4b1f6bb..4891fe3 100644 --- a/src/main/java/me/Danker/features/CustomMusic.java +++ b/src/main/java/me/Danker/features/CustomMusic.java @@ -20,19 +20,44 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import javax.sound.sampled.*; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.List; +import java.util.Random; public class CustomMusic { static boolean cancelNotes; - static boolean prevInDungeonBossRoom = false; - public static boolean inDungeonBossRoom = false; public static Song dungeonboss; public static int dungeonbossVolume; public static Song bloodroom; public static int bloodroomVolume; public static Song dungeon; public static int dungeonVolume; + public static Song hub; + public static int hubVolume; + public static Song island; + public static int islandVolume; + public static Song dungeonHub; + public static int dungeonHubVolume; + public static Song farmingIslands; + public static int farmingIslandsVolume; + public static Song goldMine; + public static int goldMineVolume; + public static Song deepCaverns; + public static int deepCavernsVolume; + public static Song dwarvenMines; + public static int dwarvenMinesVolume; + public static Song crystalHollows; + public static int crystalHollowsVolume; + public static Song spidersDen; + public static int spidersDenVolume; + public static Song blazingFortress; + public static int blazingFortressVolume; + public static Song end; + public static int endVolume; + public static Song park; + public static int parkVolume; + @SubscribeEvent public void onWorldChange(WorldEvent.Load event) { @@ -47,26 +72,63 @@ public class CustomMusic { EntityPlayerSP player = mc.thePlayer; World world = mc.theWorld; if (DankersSkyblockMod.tickAmount % 10 == 0) { - if (ToggleCommand.dungeonBossMusic && Utils.inDungeons && world != null && player != null) { - prevInDungeonBossRoom = inDungeonBossRoom; - List<String> scoreboard = ScoreboardHandler.getSidebarLines(); - if (scoreboard.size() > 2) { - String firstLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 1)); - String secondLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 2)); - if (firstLine.contains("30,30") || // F1 - firstLine.contains("30,125") || // F2 - firstLine.contains("30,225") || // F3 - secondLine.contains("- Healthy") || // F3 - firstLine.contains("30,344") || // F4 - firstLine.contains("livid") || // F5 - firstLine.contains("sadan") || // F6 - firstLine.contains("necron")) { // F7 - - inDungeonBossRoom = true; - if (!prevInDungeonBossRoom) { - dungeonboss.start(); + if (world != null && player != null) { + if (Utils.inDungeons) { + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + if (scoreboard.size() > 2) { + String firstLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 1)); + String secondLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 2)); + if (firstLine.contains("30,30") || // F1 + firstLine.contains("30,125") || // F2 + firstLine.contains("30,225") || // F3 + secondLine.contains("- Healthy") || // F3 + firstLine.contains("30,344") || // F4 + firstLine.contains("livid") || // F5 + firstLine.contains("sadan") || // F6 + firstLine.contains("necron")) { // F7 + + if (ToggleCommand.dungeonBossMusic) dungeonboss.start(); + } + } + } else { + switch (Utils.tabLocation) { + case "Hub": + if (ToggleCommand.hubMusic) hub.start(); + break; + case "Private World": + if (ToggleCommand.islandMusic) island.start(); + break; + case "Dungeon Hub": + if (ToggleCommand.dungeonHubMusic) dungeonHub.start(); + break; + case "The Farming Islands": + if (ToggleCommand.farmingIslandsMusic) farmingIslands.start(); + break; + case "Gold Mine": + if (ToggleCommand.goldMineMusic) goldMine.start(); + break; + case "Deep Caverns": + if (ToggleCommand.deepCavernsMusic) deepCaverns.start(); + break; + case "Dwarven Mines": + if (ToggleCommand.dwarvenMinesMusic) dwarvenMines.start(); + break; + case "Crystal Hollows": + if (ToggleCommand.crystalHollowsMusic) crystalHollows.start(); + break; + case "Spider's Den": + if (ToggleCommand.spidersDenMusic) spidersDen.start(); + break; + case "Blazing Fortress": + if (ToggleCommand.blazingFortressMusic) blazingFortress.start(); + break; + case "The End": + if (ToggleCommand.endMusic) end.start(); + break; + case "The Park": + if (ToggleCommand.parkMusic) park.start(); + break; } - } } } } @@ -89,8 +151,9 @@ public class CustomMusic { dungeonboss.stop(); bloodroom.stop(); dungeon.stop(); - } else if (ToggleCommand.bloodRoomMusic && message.contains("The BLOOD DOOR has been opened!")) { - bloodroom.start(); + } else if (message.contains("The BLOOD DOOR has been opened!")) { + dungeon.stop(); + if (ToggleCommand.bloodRoomMusic) bloodroom.start(); } } } @@ -109,46 +172,74 @@ public class CustomMusic { reset(); - File dungeonBossFile = new File(directory + "/dungeonboss.wav"); - System.out.println("dungeonboss.wav exists?: " + dungeonBossFile.exists()); - dungeonboss = new Song(dungeonBossFile, dungeonbossVolume); - - File bloodRoomFile = new File(directory + "/bloodroom.wav"); - System.out.println("bloodroom.wav exists?: " + bloodRoomFile.exists()); - bloodroom = new Song(bloodRoomFile, bloodroomVolume); - - File dungeonFile = new File(directory + "/dungeon.wav"); - System.out.println("dungeon.wav exists?: " + dungeonFile.exists()); - dungeon = new Song(dungeonFile, dungeonVolume); + dungeonboss = new Song(directory, "dungeonboss", dungeonbossVolume); + bloodroom = new Song(directory, "bloodroom", bloodroomVolume); + dungeon = new Song(directory, "dungeon", dungeonVolume); + hub = new Song(directory, "hub", hubVolume); + island = new Song(directory, "island", hubVolume); + dungeonHub = new Song(directory, "dungeonhub", dungeonHubVolume); + farmingIslands = new Song(directory, "farmingislands", farmingIslandsVolume); + goldMine = new Song(directory, "goldmine", goldMineVolume); + deepCaverns = new Song(directory, "deepcaverns", deepCavernsVolume); + dwarvenMines = new Song(directory, "dwarvenmines", dwarvenMinesVolume); + crystalHollows = new Song(directory, "crystalhollows", crystalHollowsVolume); + spidersDen = new Song(directory, "spidersden", spidersDenVolume); + blazingFortress = new Song(directory, "blazingfortress", blazingFortressVolume); + end = new Song(directory, "end", endVolume); + park = new Song(directory, "park", parkVolume); } public static void reset() { if (dungeonboss != null) dungeonboss.stop(); if (bloodroom != null) bloodroom.stop(); if (dungeon != null) dungeon.stop(); + if (hub != null) hub.stop(); + if (island != null) island.stop(); + if (dungeonHub != null) dungeonHub.stop(); + if (farmingIslands != null) farmingIslands.stop(); + if (goldMine != null) goldMine.stop(); + if (deepCaverns != null) deepCaverns.stop(); + if (dwarvenMines != null) dwarvenMines.stop(); + if (crystalHollows != null) crystalHollows.stop(); + if (spidersDen != null) spidersDen.stop(); + if (blazingFortress != null) blazingFortress.stop(); + if (end != null) end.stop(); + if (park != null) park.stop(); } public static class Song { public Clip music; + private final List<Clip> playlist = new ArrayList<>(); - public Song(File file, int volume) throws IOException, UnsupportedAudioFileException, LineUnavailableException { - if (file.exists()) { - music = AudioSystem.getClip(); - AudioInputStream ais = AudioSystem.getAudioInputStream(file); - music.open(ais); + public Song(File directory, String songName, int volume) throws IOException, UnsupportedAudioFileException, LineUnavailableException { + File[] files = directory.listFiles(); + if (files != null) { + for (File file : files) { + if (!file.isDirectory() && file.getName().matches(songName + "\\d*(?:\\.wav)?\\.wav")) { // .wav.wav moment + Clip music = AudioSystem.getClip(); + AudioInputStream ais = AudioSystem.getAudioInputStream(file); + music.open(ais); + playlist.add(music); + System.out.println("Added " + file.getName() + " to " + songName + " playlist."); + } + } + } + + setVolume(volume); - setVolume(volume); + if (playlist.size() > 0) { + music = playlist.get(0); } } public void start() { - reset(); - if (music != null) { + if (music != null && !music.isRunning()) { + reset(); + shuffle(); cancelNotes = true; music.setMicrosecondPosition(0); music.start(); - music.loop(Clip.LOOP_CONTINUOUSLY); } } @@ -157,21 +248,25 @@ public class CustomMusic { if (music != null) music.stop(); } + public void shuffle() { + if (playlist.size() > 0) music = playlist.get(new Random().nextInt(playlist.size())); + } + public boolean setVolume(int volume) { - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - if (music == null) return false; + if (playlist.size() < 1) return false; if (volume <= 0 || volume > 100) { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; if (player != null) player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Volume can only be set between 0% and 100%.")); return false; } float decibels = (float) (20 * Math.log(volume / 100.0)); - FloatControl control = (FloatControl) music.getControl(FloatControl.Type.MASTER_GAIN); - if (decibels <= control.getMinimum() || decibels >= control.getMaximum()) { - return false; + for (Clip music : playlist) { + FloatControl control = (FloatControl) music.getControl(FloatControl.Type.MASTER_GAIN); + if (decibels <= control.getMinimum() || decibels >= control.getMaximum()) return false; + control.setValue(decibels); } - control.setValue(decibels); return true; } diff --git a/src/main/java/me/Danker/features/EndOfFarmAlert.java b/src/main/java/me/Danker/features/EndOfFarmAlert.java new file mode 100644 index 0000000..ecbf3ee --- /dev/null +++ b/src/main/java/me/Danker/features/EndOfFarmAlert.java @@ -0,0 +1,40 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +public class EndOfFarmAlert { + + static boolean alerted = false; + public static double min = -78.5; + public static double max = 79.5; + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + if (DankersSkyblockMod.tickAmount % 10 == 0) { + if (ToggleCommand.endOfFarmAlert && Utils.isInScoreboard("Your Island")) { + double x = player.posX; + double z = player.posZ; + + if (x <= min || x >= max || z <= min || z >= max) { + if (!alerted) { + alerted = true; + Utils.createTitle(EnumChatFormatting.RED + "END OF FARM", 1); + } + } else { + alerted = false; + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/GemstonesLore.java b/src/main/java/me/Danker/features/GemstonesLore.java new file mode 100644 index 0000000..dfae746 --- /dev/null +++ b/src/main/java/me/Danker/features/GemstonesLore.java @@ -0,0 +1,77 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class GemstonesLore { + + static Map<String, EnumChatFormatting> gemstoneColours = new HashMap<>(); + + public static void init() { + gemstoneColours.put("Amber", EnumChatFormatting.GOLD); + gemstoneColours.put("Sapphire", EnumChatFormatting.AQUA); + gemstoneColours.put("Jasper", EnumChatFormatting.LIGHT_PURPLE); + gemstoneColours.put("Amethyst", EnumChatFormatting.DARK_PURPLE); + gemstoneColours.put("Topaz", EnumChatFormatting.YELLOW); + gemstoneColours.put("Jade", EnumChatFormatting.GREEN); + gemstoneColours.put("Ruby", EnumChatFormatting.RED); + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void onTooltip(ItemTooltipEvent event) { + if (!Utils.inSkyblock) return; + if (event.toolTip == null) return; + + ItemStack item = event.itemStack; + if (ToggleCommand.gemstoneLore) { + if (item.hasTagCompound()) { + NBTTagCompound tags = item.getSubCompound("ExtraAttributes", false); + if (tags != null) { + if (tags.hasKey("gems")) { + NBTTagCompound gems = tags.getCompoundTag("gems"); + Set<String> set = gems.getKeySet(); + + if (set.size() == 0) return; + + int index = Minecraft.getMinecraft().gameSettings.advancedItemTooltips ? 4 : 2; + + event.toolTip.add(event.toolTip.size() - index, ""); + event.toolTip.add(event.toolTip.size() - index, "Gemstones Applied:"); + + for (String gem : set) { + char last = gem.charAt(gem.length() - 1); + if (!Character.isDigit(last)) continue; + + String gemstone = " " + Utils.capitalizeString(gems.getString(gem)) + " "; + if (gem.startsWith("UNIVERSAL_")) { + gemstone += Utils.capitalizeString(gems.getString(gem + "_gem")); + } else { + gemstone += Utils.capitalizeString(gem.substring(0, gem.indexOf("_"))); + } + + for (String colour : gemstoneColours.keySet()) { + if (gemstone.contains(colour)) { + gemstone = gemstoneColours.get(colour) + gemstone; + } + } + + event.toolTip.add(event.toolTip.size() - index, gemstone); + } + } + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/GiantHPDisplay.java b/src/main/java/me/Danker/features/GiantHPDisplay.java new file mode 100644 index 0000000..456ba0a --- /dev/null +++ b/src/main/java/me/Danker/features/GiantHPDisplay.java @@ -0,0 +1,73 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.ScoreboardHandler; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.util.StringUtils; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +public class GiantHPDisplay { + + static Pattern f6GiantPattern = Pattern.compile("(Jolly Pink Giant|L\\.A\\.S\\.R\\.|The Diamond Giant|Bigfoot).*"); + static List<Entity> giants = new ArrayList<>(); + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + World world = Minecraft.getMinecraft().theWorld; + if (DankersSkyblockMod.tickAmount % 20 == 0) { + if (ToggleCommand.giantHP && Utils.inDungeons && world != null) { + giants.clear(); + List<String> scoreboard = ScoreboardHandler.getSidebarLines(); + String firstLine = ScoreboardHandler.cleanSB(scoreboard.get(scoreboard.size() - 1)); + + if (firstLine.contains("sadan")) { + List<Entity> entities = world.getLoadedEntityList(); + + for (Entity entity : entities) { + String name = StringUtils.stripControlCodes(entity.getName()); + if (f6GiantPattern.matcher(name).find()) { + giants.add(entity); + } + } + } else if (firstLine.contains("138,30") || firstLine.contains("354,66") || firstLine.contains("138,66")) { + List<Entity> entities = world.getLoadedEntityList(); + + for (Entity entity : entities) { + if (entity.getName().contains("Giant ")) { + giants.add(entity); + } + } + } + } + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.giantHP && Utils.inDungeons && giants.size() > 0) { + StringBuilder sb = new StringBuilder(); + + for (Entity giant : giants) { + if (!giant.isDead) sb.append(Utils.removeBold(giant.getDisplayName().getFormattedText())).append("\n"); + } + + new TextRenderer(Minecraft.getMinecraft(), sb.toString(), MoveCommand.giantHPXY[0], MoveCommand.giantHPXY[1], ScaleCommand.giantHPScale); + } + } + +} diff --git a/src/main/java/me/Danker/features/HidePetCandy.java b/src/main/java/me/Danker/features/HidePetCandy.java new file mode 100644 index 0000000..8ef28d2 --- /dev/null +++ b/src/main/java/me/Danker/features/HidePetCandy.java @@ -0,0 +1,26 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class HidePetCandy { + + @SubscribeEvent + public void onTooltip(ItemTooltipEvent event) { + if (!Utils.inSkyblock) return; + if (event.toolTip == null) return; + + if (ToggleCommand.hidePetCandy) { + for (int i = 0; i < event.toolTip.size(); i++) { + if (event.toolTip.get(i).endsWith("Pet Candy Used")) { + event.toolTip.remove(i); + event.toolTip.remove(i); + break; + } + } + } + } + +} diff --git a/src/main/java/me/Danker/features/HighlightSkeletonMasters.java b/src/main/java/me/Danker/features/HighlightSkeletonMasters.java new file mode 100644 index 0000000..f97699c --- /dev/null +++ b/src/main/java/me/Danker/features/HighlightSkeletonMasters.java @@ -0,0 +1,42 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import me.Danker.utils.Utils; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.event.RenderLivingEvent; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.ArrayList; +import java.util.List; + +public class HighlightSkeletonMasters { + + static List<Entity> skeletonMasters = new ArrayList<>(); + public static int SKELETON_MASTER_COLOUR; + + @SubscribeEvent + public void onRenderEntity(RenderLivingEvent.Pre<EntityLivingBase> event) { + if (ToggleCommand.highlightSkeletonMasters && event.entity instanceof EntitySkeleton && Utils.inDungeons) { + ItemStack helmet = event.entity.getCurrentArmor(3); + if (helmet != null && helmet.getDisplayName().endsWith("Skeleton Master Helmet")) { + skeletonMasters.add(event.entity); + } + } + } + + @SubscribeEvent + public void onWorldRender(RenderWorldLastEvent event) { + if (ToggleCommand.highlightSkeletonMasters) { + for (Entity skeletonMaster : skeletonMasters) { + if (!skeletonMaster.isDead) + Utils.draw3DBox(skeletonMaster.getEntityBoundingBox(), SKELETON_MASTER_COLOUR, event.partialTicks); + } + skeletonMasters.clear(); + } + } + +} diff --git a/src/main/java/me/Danker/features/Skill50Display.java b/src/main/java/me/Danker/features/Skill50Display.java index 3b73cf9..54afb3a 100644 --- a/src/main/java/me/Danker/features/Skill50Display.java +++ b/src/main/java/me/Danker/features/Skill50Display.java @@ -1,5 +1,6 @@ package me.Danker.features; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; @@ -7,6 +8,7 @@ import me.Danker.events.RenderOverlay; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -30,8 +32,8 @@ public class Skill50Display { String[] actionBarSections = event.message.getUnformattedText().split(" {3,}"); for (String section : actionBarSections) { - if (section.contains("+") && section.contains("/") && section.contains("(")) { - if (ToggleCommand.skill50DisplayToggled && !section.contains("Runecrafting")) { + if (ToggleCommand.skill50DisplayToggled && section.contains("+") && section.contains("(") && section.contains(")") && !section.contains("Runecrafting")) { + if (section.contains("/")) { String xpGained = section.substring(section.indexOf("+"), section.indexOf("(") - 1); double currentXp = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); int limit; @@ -43,13 +45,56 @@ public class Skill50Display { limit = 50; totalXp = 55172425; } - int previousXp = Utils.getPastXpEarned(Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")), limit); + + int nextLevelXp; + String nextLevelXpString = section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", ""); + if (nextLevelXpString.contains("k")) { + nextLevelXp = (int) (Double.parseDouble(nextLevelXpString.substring(0, nextLevelXpString.indexOf("k"))) * 1000); + } else { + nextLevelXp = Integer.parseInt(nextLevelXpString); + } + + int previousXp = Utils.getPastXpEarned(nextLevelXp, limit); double percentage = Math.floor(((currentXp + previousXp) / totalXp) * 10000D) / 100D; NumberFormat nf = NumberFormat.getNumberInstance(Locale.US); skillTimer = SKILL_TIME; showSkill = true; skillText = SKILL_50_COLOUR + xpGained + " (" + nf.format(currentXp + previousXp) + "/" + nf.format(totalXp) + ") " + percentage + "%"; + } else { + if (!Utils.skillsInitialized()) { + return; + } + + String xpGained = section.substring(section.indexOf("+"), section.indexOf("(") - 1); + double percentage = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("%"))); + int level = 1; + if (section.contains("Farming")) { + level = DankersSkyblockMod.farmingLevel; + } else if (section.contains("Mining")) { + level = DankersSkyblockMod.miningLevel; + } else if (section.contains("Combat")) { + level = DankersSkyblockMod.combatLevel; + } else if (section.contains("Foraging")) { + level = DankersSkyblockMod.foragingLevel; + } else if (section.contains("Fishing")) { + level = DankersSkyblockMod.fishingLevel; + } else if (section.contains("Enchanting")) { + level = DankersSkyblockMod.enchantingLevel; + } else if (section.contains("Alchemy")) { + level = DankersSkyblockMod.alchemyLevel; + } else if (section.contains("Carpentry")) { + level = DankersSkyblockMod.carpentryLevel; + } + + double currentXp = Utils.getTotalXpEarned(level, percentage); + int totalXp = section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining") || section.contains("Combat") ? 111672425 : 55172425; + double percentageTo50 = Math.floor((currentXp / totalXp) * 10000D) / 100D; + + NumberFormat nf = NumberFormat.getNumberInstance(Locale.US); + skillTimer = SKILL_TIME; + showSkill = true; + skillText = SKILL_50_COLOUR + xpGained + " (" + nf.format(currentXp) + "/" + nf.format(totalXp) + ") " + percentageTo50 + "%"; } } } @@ -69,6 +114,11 @@ public class Skill50Display { @SubscribeEvent public void renderPlayerInfo(RenderOverlay event) { + if (!Utils.skillsInitialized() && Utils.inSkyblock) { + new TextRenderer(Minecraft.getMinecraft(), EnumChatFormatting.RED + "Please open the skill menu to use skill features.", MoveCommand.skill50XY[0], MoveCommand.skill50XY[0], ScaleCommand.skill50Scale); + return; + } + if (showSkill) { new TextRenderer(Minecraft.getMinecraft(), skillText, MoveCommand.skill50XY[0], MoveCommand.skill50XY[1], ScaleCommand.skill50Scale); } diff --git a/src/main/java/me/Danker/features/SkillTracker.java b/src/main/java/me/Danker/features/SkillTracker.java index 60eb632..9438b3d 100644 --- a/src/main/java/me/Danker/features/SkillTracker.java +++ b/src/main/java/me/Danker/features/SkillTracker.java @@ -52,78 +52,114 @@ public class SkillTracker { String[] actionBarSections = event.message.getUnformattedText().split(" {3,}"); for (String section : actionBarSections) { - if (section.contains("+") && section.contains("/") && section.contains("(")) { - if (!section.contains("Runecrafting") && !section.contains("Carpentry")) { - if (ToggleCommand.autoSkillTrackerToggled && System.currentTimeMillis() / 1000 - timeSinceGained <= 2) { - if (skillStopwatch.isStarted() && skillStopwatch.isSuspended()) { - skillStopwatch.resume(); - } else if (!skillStopwatch.isStarted()) { - skillStopwatch.start(); - } + if (section.contains("+") && section.contains("(") && section.contains(")") && !section.contains("Runecrafting") && !section.contains("Carpentry")) { + if (ToggleCommand.autoSkillTrackerToggled && System.currentTimeMillis() / 1000 - timeSinceGained <= 2) { + if (skillStopwatch.isStarted() && skillStopwatch.isSuspended()) { + skillStopwatch.resume(); + } else if (!skillStopwatch.isStarted()) { + skillStopwatch.start(); } - timeSinceGained = System.currentTimeMillis() / 1000; + } + timeSinceGained = System.currentTimeMillis() / 1000; + + String skill = section.substring(section.indexOf(" ") + 1, section.lastIndexOf(" ")); + double totalXP; + if (section.contains("/")) { int limit = section.contains("Farming") || section.contains("Enchanting") || section.contains("Mining") || section.contains("Combat") ? 60 : 50; double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); - int xpToLevelUp = Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")); + + int xpToLevelUp; + String nextLevelXpString = section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", ""); + if (nextLevelXpString.contains("k")) { + xpToLevelUp = (int) (Double.parseDouble(nextLevelXpString.substring(0, nextLevelXpString.indexOf("k"))) * 1000); + } else { + xpToLevelUp = Integer.parseInt(nextLevelXpString); + } + xpLeft = xpToLevelUp - currentXP; int previousXP = Utils.getPastXpEarned(xpToLevelUp, limit); - double totalXP = currentXP + previousXP; - - String skill = section.substring(section.indexOf(" ") + 1, section.lastIndexOf(" ")); - switch (skill) { - case "Farming": - lastSkill = "Farming"; - if (farmingXP != 0) { - if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) farmingXPGained += totalXP - farmingXP; - } - farmingXP = totalXP; - break; - case "Mining": - lastSkill = "Mining"; - if (miningXP != 0) { - if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) miningXPGained += totalXP - miningXP; - } - miningXP = totalXP; - break; - case "Combat": - lastSkill = "Combat"; - if (combatXP != 0) { - if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) combatXPGained += totalXP - combatXP; - } - combatXP = totalXP; - break; - case "Foraging": - lastSkill = "Foraging"; - if (foragingXP != 0) { - if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) foragingXPGained += totalXP - foragingXP; - } - foragingXP = totalXP; - break; - case "Fishing": - lastSkill = "Fishing"; - if (fishingXP != 0) { - if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) fishingXPGained += totalXP - fishingXP; - } - fishingXP = totalXP; - break; - case "Enchanting": - lastSkill = "Enchanting"; - if (enchantingXP != 0) { - if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) enchantingXPGained += totalXP - enchantingXP; - } - enchantingXP = totalXP; - break; - case "Alchemy": - lastSkill = "Alchemy"; - if (alchemyXP != 0) { - if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) alchemyXPGained += totalXP - alchemyXP; - } - alchemyXP = totalXP; - break; - default: - System.err.println("Unknown skill."); + totalXP = currentXP + previousXP; + } else { + if (!Utils.skillsInitialized()) { + return; } + + int level = 1; + if (section.contains("Farming")) { + level = DankersSkyblockMod.farmingLevel; + } else if (section.contains("Mining")) { + level = DankersSkyblockMod.miningLevel; + } else if (section.contains("Combat")) { + level = DankersSkyblockMod.combatLevel; + } else if (section.contains("Foraging")) { + level = DankersSkyblockMod.foragingLevel; + } else if (section.contains("Fishing")) { + level = DankersSkyblockMod.fishingLevel; + } else if (section.contains("Enchanting")) { + level = DankersSkyblockMod.enchantingLevel; + } else if (section.contains("Alchemy")) { + level = DankersSkyblockMod.alchemyLevel; + } else if (section.contains("Carpentry")) { + level = DankersSkyblockMod.carpentryLevel; + } + + totalXP = Utils.getTotalXpEarned(level, Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("%")))); + xpLeft = Utils.getTotalXpEarned(level + 1, 0) - totalXP; + } + + switch (skill) { + case "Farming": + lastSkill = "Farming"; + if (farmingXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) farmingXPGained += totalXP - farmingXP; + } + farmingXP = totalXP; + break; + case "Mining": + lastSkill = "Mining"; + if (miningXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) miningXPGained += totalXP - miningXP; + } + miningXP = totalXP; + break; + case "Combat": + lastSkill = "Combat"; + if (combatXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) combatXPGained += totalXP - combatXP; + } + combatXP = totalXP; + break; + case "Foraging": + lastSkill = "Foraging"; + if (foragingXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) foragingXPGained += totalXP - foragingXP; + } + foragingXP = totalXP; + break; + case "Fishing": + lastSkill = "Fishing"; + if (fishingXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) fishingXPGained += totalXP - fishingXP; + } + fishingXP = totalXP; + break; + case "Enchanting": + lastSkill = "Enchanting"; + if (enchantingXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) enchantingXPGained += totalXP - enchantingXP; + } + enchantingXP = totalXP; + break; + case "Alchemy": + lastSkill = "Alchemy"; + if (alchemyXP != 0) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) alchemyXPGained += totalXP - alchemyXP; + } + alchemyXP = totalXP; + break; + default: + System.err.println("Unknown skill."); } } } @@ -132,6 +168,11 @@ public class SkillTracker { @SubscribeEvent public void renderPlayerInfo(RenderOverlay event) { if (showSkillTracker && Utils.inSkyblock) { + if (!Utils.skillsInitialized()) { + new TextRenderer(Minecraft.getMinecraft(), EnumChatFormatting.RED + "Please open the skill menu to use skill features.", MoveCommand.skillTrackerXY[0], MoveCommand.skillTrackerXY[0], ScaleCommand.skillTrackerScale); + return; + } + int xpPerHour; double xpToShow = 0; switch (lastSkill) { @@ -196,12 +237,8 @@ public class SkillTracker { @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { - if (event.gui instanceof GuiChest) { - if (ToggleCommand.autoSkillTrackerToggled) { - if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) { - skillStopwatch.suspend(); - } - } + if (event.gui instanceof GuiChest && ToggleCommand.autoSkillTrackerToggled && skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) { + skillStopwatch.suspend(); } } diff --git a/src/main/java/me/Danker/features/SlayerESP.java b/src/main/java/me/Danker/features/SlayerESP.java index 522e696..3629474 100644 --- a/src/main/java/me/Danker/features/SlayerESP.java +++ b/src/main/java/me/Danker/features/SlayerESP.java @@ -26,6 +26,7 @@ public class SlayerESP { static Entity zombie = null; static Entity spider = null; static Entity wolf = null; + static Entity enderman = null; static boolean slayerActive = false; static boolean slayerStarted = false; public static int SLAYER_COLOUR; @@ -35,6 +36,7 @@ public class SlayerESP { zombie = null; spider = null; wolf = null; + enderman = null; } @SubscribeEvent @@ -45,7 +47,7 @@ public class SlayerESP { World world = Minecraft.getMinecraft().theWorld; if (world == null) return; if (!slayerStarted) return; - if (zombie != null || spider != null || wolf != null) { + if (zombie != null || spider != null || wolf != null || enderman != null) { return; } slayerActive = true; @@ -66,8 +68,10 @@ public class SlayerESP { } else if (e.getName().contains("Sven Packmaster")) { wolf = e; return; + } else if (e.getName().contains("Voidgloom Seraph")) { + enderman = e; + return; } - } break; } @@ -88,6 +92,7 @@ public class SlayerESP { zombie = null; spider = null; wolf = null; + enderman = null; } } @@ -113,6 +118,11 @@ public class SlayerESP { Utils.draw3DBox(aabb, SLAYER_COLOUR, event.partialTicks); return; } + if (enderman != null) { + AxisAlignedBB aabb = new AxisAlignedBB(enderman.posX - 0.5, enderman.posY - 3, enderman.posZ - 0.5, enderman.posX + 0.5, enderman.posY, enderman.posZ + 0.5); + Utils.draw3DBox(aabb, SLAYER_COLOUR, event.partialTicks); + return; + } } } diff --git a/src/main/java/me/Danker/features/TetherDisplay.java b/src/main/java/me/Danker/features/TetherDisplay.java new file mode 100644 index 0000000..363b90f --- /dev/null +++ b/src/main/java/me/Danker/features/TetherDisplay.java @@ -0,0 +1,60 @@ +package me.Danker.features; + +import me.Danker.DankersSkyblockMod; +import me.Danker.commands.MoveCommand; +import me.Danker.commands.ScaleCommand; +import me.Danker.commands.ToggleCommand; +import me.Danker.events.RenderOverlay; +import me.Danker.handlers.TextRenderer; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import java.util.ArrayList; +import java.util.List; + +public class TetherDisplay { + + static List<String> playersInRadius = new ArrayList<>(); + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + if (event.phase != TickEvent.Phase.START) return; + + Minecraft mc = Minecraft.getMinecraft(); + EntityPlayer player = mc.thePlayer; + World world = mc.theWorld; + if (DankersSkyblockMod.tickAmount % 10 == 0) { + if (ToggleCommand.teammatesInRadius && Utils.inDungeons && player != null && world != null) { + playersInRadius.clear(); + List<EntityPlayer> teammates = world.getEntitiesWithinAABB(EntityOtherPlayerMP.class, new AxisAlignedBB(player.posX - 30, player.posY - 30, player.posZ - 30, player.posX + 30, player.posY + 30, player.posZ + 30)); + + for (EntityPlayer teammate : teammates) { + if (Utils.isRealPlayer(teammate) && !teammate.isInvisible() && player.getDistanceToEntity(teammate) <= 30F) { + playersInRadius.add(teammate.getDisplayName().getSiblings().get(0).getFormattedText()); + } + } + } + } + } + + @SubscribeEvent + public void renderPlayerInfo(RenderOverlay event) { + if (ToggleCommand.teammatesInRadius && Utils.inDungeons) { + String teammates; + if (playersInRadius.size() > 0) { + teammates = String.join("\n", playersInRadius); + } else { + teammates = EnumChatFormatting.RED + "NONE"; + } + new TextRenderer(Minecraft.getMinecraft(), EnumChatFormatting.AQUA + "Teammates In Radius:\n" + teammates, MoveCommand.teammatesInRadiusXY[0], MoveCommand.teammatesInRadiusXY[1], ScaleCommand.teammatesInRadiusScale); + } + } + +} diff --git a/src/main/java/me/Danker/features/loot/LootDisplay.java b/src/main/java/me/Danker/features/loot/LootDisplay.java index cd34da7..07a784a 100644 --- a/src/main/java/me/Danker/features/loot/LootDisplay.java +++ b/src/main/java/me/Danker/features/loot/LootDisplay.java @@ -213,6 +213,7 @@ public class LootDisplay { dropsText = EnumChatFormatting.GOLD + "Revs Killed:\n" + EnumChatFormatting.GREEN + "Revenant Flesh:\n" + + EnumChatFormatting.GREEN + "Revenant Viscera:\n" + EnumChatFormatting.BLUE + "Foul Flesh:\n" + EnumChatFormatting.DARK_GREEN + "Pestilence Runes:\n" + EnumChatFormatting.WHITE + "Smite VI Books:\n" + @@ -227,6 +228,7 @@ public class LootDisplay { EnumChatFormatting.AQUA + "Bosses Since RNG:"; countText = EnumChatFormatting.GOLD + nf.format(LootTracker.zombieRevs) + "\n" + EnumChatFormatting.GREEN + nf.format(LootTracker.zombieRevFlesh) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.zombieRevViscera) + "\n" + EnumChatFormatting.BLUE + drop20 + "\n" + EnumChatFormatting.DARK_GREEN + LootTracker.zombiePestilences + "\n" + EnumChatFormatting.WHITE + LootTracker.zombieBooks + "\n" + @@ -259,6 +261,7 @@ public class LootDisplay { dropsText = EnumChatFormatting.GOLD + "Revs Killed:\n" + EnumChatFormatting.GREEN + "Revenant Flesh:\n" + + EnumChatFormatting.GREEN + "Revenant Viscera:\n" + EnumChatFormatting.BLUE + "Foul Flesh:\n" + EnumChatFormatting.DARK_GREEN + "Pestilence Runes:\n" + EnumChatFormatting.WHITE + "Smite VI Books:\n" + @@ -273,6 +276,7 @@ public class LootDisplay { EnumChatFormatting.AQUA + "Bosses Since RNG:"; countText = EnumChatFormatting.GOLD + nf.format(LootTracker.zombieRevsSession) + "\n" + EnumChatFormatting.GREEN + nf.format(LootTracker.zombieRevFleshSession) + "\n" + + EnumChatFormatting.GREEN + nf.format(LootTracker.zombieRevVisceraSession) + "\n" + EnumChatFormatting.BLUE + drop20 + "\n" + EnumChatFormatting.DARK_GREEN + LootTracker.zombiePestilencesSession + "\n" + EnumChatFormatting.WHITE + LootTracker.zombieBooksSession + "\n" + @@ -286,6 +290,126 @@ public class LootDisplay { EnumChatFormatting.AQUA + timeBetween + "\n" + EnumChatFormatting.AQUA + bossesBetween; break; + case "enderman": + if (LootTracker.endermanTime == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.endermanTime, timeNow); + } + if (LootTracker.endermanBosses == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.endermanBosses); + } + if (ToggleCommand.slayerCountTotal) { + drop20 = nf.format(LootTracker.endermanTAP); + } else { + drop20 = nf.format(LootTracker.endermanTAPDrops) + " times"; + } + + dropsText = EnumChatFormatting.GOLD + "Voidglooms Killed:\n" + + EnumChatFormatting.DARK_GRAY + "Null Spheres:\n" + + EnumChatFormatting.DARK_PURPLE + "Arrow Poison:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Endersnake Runes:\n" + + EnumChatFormatting.DARK_GREEN + "Summoning Eyes:\n" + + EnumChatFormatting.AQUA + "Mana Steal Books:\n" + + EnumChatFormatting.BLUE + "Transmission Tuners:\n" + + EnumChatFormatting.YELLOW + "Null Atoms:\n" + + EnumChatFormatting.AQUA + "Espresso Machines:\n" + + EnumChatFormatting.WHITE + "Smarty Pants Books:\n" + + EnumChatFormatting.LIGHT_PURPLE + "End Runes:\n" + + EnumChatFormatting.RED + "Blood Chalices:\n" + + EnumChatFormatting.RED + "Sinful Dice:\n" + + EnumChatFormatting.DARK_PURPLE + "Artifact Upgrader:\n" + + EnumChatFormatting.DARK_PURPLE + "Enderman Skins:\n" + + EnumChatFormatting.GRAY + "Enchant Runes:\n" + + EnumChatFormatting.GOLD + "Etherwarp Mergers:\n" + + EnumChatFormatting.GOLD + "Judgement Cores:\n" + + EnumChatFormatting.RED + "Ender Slayer Books:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.endermanVoidglooms) + "\n" + + EnumChatFormatting.DARK_GRAY + nf.format(LootTracker.endermanNullSpheres) + "\n" + + EnumChatFormatting.DARK_PURPLE + drop20 + "\n" + + EnumChatFormatting.LIGHT_PURPLE + LootTracker.endermanEndersnakes + "\n" + + EnumChatFormatting.DARK_GREEN + LootTracker.endermanSummoningEyes + "\n" + + EnumChatFormatting.AQUA + LootTracker.endermanManaBooks + "\n" + + EnumChatFormatting.BLUE + LootTracker.endermanTuners + "\n" + + EnumChatFormatting.YELLOW + LootTracker.endermanAtoms + "\n" + + EnumChatFormatting.AQUA + LootTracker.endermanEspressoMachines + "\n" + + EnumChatFormatting.WHITE + LootTracker.endermanSmartyBooks + "\n" + + EnumChatFormatting.LIGHT_PURPLE + LootTracker.endermanEndRunes + "\n" + + EnumChatFormatting.RED + LootTracker.endermanChalices + "\n" + + EnumChatFormatting.RED + LootTracker.endermanDice + "\n" + + EnumChatFormatting.DARK_PURPLE + LootTracker.endermanArtifacts + "\n" + + EnumChatFormatting.DARK_PURPLE + LootTracker.endermanSkins + "\n" + + EnumChatFormatting.GRAY + LootTracker.endermanEnchantRunes + "\n" + + EnumChatFormatting.GOLD + LootTracker.endermanMergers + "\n" + + EnumChatFormatting.GOLD + LootTracker.endermanCores + "\n" + + EnumChatFormatting.RED + LootTracker.endermanEnderBooks + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; + case "enderman_session": + if (LootTracker.endermanTimeSession == -1) { + timeBetween = "Never"; + } else { + timeBetween = Utils.getTimeBetween(LootTracker.endermanTimeSession, timeNow); + } + if (LootTracker.endermanBossesSession == -1) { + bossesBetween = "Never"; + } else { + bossesBetween = nf.format(LootTracker.endermanBossesSession); + } + if (ToggleCommand.slayerCountTotal) { + drop20 = nf.format(LootTracker.endermanTAPSession); + } else { + drop20 = nf.format(LootTracker.endermanTAPDropsSession) + " times"; + } + + dropsText = EnumChatFormatting.GOLD + "Voidglooms Killed:\n" + + EnumChatFormatting.DARK_GRAY + "Null Spheres:\n" + + EnumChatFormatting.DARK_PURPLE + "Arrow Poison:\n" + + EnumChatFormatting.LIGHT_PURPLE + "Endersnake Runes:\n" + + EnumChatFormatting.DARK_GREEN + "Summoning Eyes:\n" + + EnumChatFormatting.AQUA + "Mana Steal Books:\n" + + EnumChatFormatting.BLUE + "Transmission Tuners:\n" + + EnumChatFormatting.YELLOW + "Null Atoms:\n" + + EnumChatFormatting.AQUA + "Espresso Machines:\n" + + EnumChatFormatting.WHITE + "Smarty Pants Books:\n" + + EnumChatFormatting.LIGHT_PURPLE + "End Runes:\n" + + EnumChatFormatting.RED + "Blood Chalices:\n" + + EnumChatFormatting.RED + "Sinful Dice:\n" + + EnumChatFormatting.DARK_PURPLE + "Artifact Upgrader:\n" + + EnumChatFormatting.DARK_PURPLE + "Enderman Skins:\n" + + EnumChatFormatting.GRAY + "Enchant Runes:\n" + + EnumChatFormatting.GOLD + "Etherwarp Mergers:\n" + + EnumChatFormatting.GOLD + "Judgement Cores:\n" + + EnumChatFormatting.RED + "Ender Slayer Books:\n" + + EnumChatFormatting.AQUA + "Time Since RNG:\n" + + EnumChatFormatting.AQUA + "Bosses Since RNG:"; + countText = EnumChatFormatting.GOLD + nf.format(LootTracker.endermanVoidgloomsSession) + "\n" + + EnumChatFormatting.DARK_GRAY + nf.format(LootTracker.endermanNullSpheresSession) + "\n" + + EnumChatFormatting.DARK_PURPLE + drop20 + "\n" + + EnumChatFormatting.LIGHT_PURPLE + LootTracker.endermanEndersnakesSession + "\n" + + EnumChatFormatting.DARK_GREEN + LootTracker.endermanSummoningEyesSession + "\n" + + EnumChatFormatting.AQUA + LootTracker.endermanManaBooksSession + "\n" + + EnumChatFormatting.BLUE + LootTracker.endermanTunersSession + "\n" + + EnumChatFormatting.YELLOW + LootTracker.endermanAtomsSession + "\n" + + EnumChatFormatting.AQUA + LootTracker.endermanEspressoMachinesSession + "\n" + + EnumChatFormatting.WHITE + LootTracker.endermanSmartyBooksSession + "\n" + + EnumChatFormatting.LIGHT_PURPLE + LootTracker.endermanEndRunesSession + "\n" + + EnumChatFormatting.RED + LootTracker.endermanChalicesSession + "\n" + + EnumChatFormatting.RED + LootTracker.endermanDiceSession + "\n" + + EnumChatFormatting.DARK_PURPLE + LootTracker.endermanArtifactsSession + "\n" + + EnumChatFormatting.DARK_PURPLE + LootTracker.endermanSkinsSession + "\n" + + EnumChatFormatting.GRAY + LootTracker.endermanEnchantRunesSession + "\n" + + EnumChatFormatting.GOLD + LootTracker.endermanMergersSession + "\n" + + EnumChatFormatting.GOLD + LootTracker.endermanCoresSession + "\n" + + EnumChatFormatting.RED + LootTracker.endermanEnderBooksSession + "\n" + + EnumChatFormatting.AQUA + timeBetween + "\n" + + EnumChatFormatting.AQUA + bossesBetween; + break; case "fishing": if (LootTracker.empTime == -1) { timeBetween = "Never"; diff --git a/src/main/java/me/Danker/features/loot/LootTracker.java b/src/main/java/me/Danker/features/loot/LootTracker.java index 7919366..58f5a54 100644 --- a/src/main/java/me/Danker/features/loot/LootTracker.java +++ b/src/main/java/me/Danker/features/loot/LootTracker.java @@ -47,6 +47,7 @@ public class LootTracker { // Zombie public static int zombieRevs; public static int zombieRevFlesh; + public static int zombieRevViscera; public static int zombieFoulFlesh; public static int zombieFoulFleshDrops; public static int zombiePestilences; @@ -60,6 +61,29 @@ public class LootTracker { public static int zombieWardenHearts; public static double zombieTime; public static int zombieBosses; + // Enderman + public static int endermanVoidglooms; + public static int endermanNullSpheres; + public static int endermanTAP; + public static int endermanTAPDrops; + public static int endermanEndersnakes; + public static int endermanSummoningEyes; + public static int endermanManaBooks; + public static int endermanTuners; + public static int endermanAtoms; + public static int endermanEspressoMachines; + public static int endermanSmartyBooks; + public static int endermanEndRunes; + public static int endermanChalices; + public static int endermanDice; + public static int endermanArtifacts; + public static int endermanSkins; + public static int endermanMergers; + public static int endermanCores; + public static int endermanEnchantRunes; + public static int endermanEnderBooks; + public static double endermanTime; + public static int endermanBosses; // Fishing public static int seaCreatures; @@ -184,9 +208,7 @@ public class LootTracker { public static int voltas = 0; public static int plasmas = 0; public static int ghostlyBoots = 0; - // public static double ghostsTimeSpent = -1; - - + // public static double ghostsTimeSpent = -1; // Single sessions (No config saves) // Wolf @@ -218,6 +240,7 @@ public class LootTracker { // Zombie public static int zombieRevsSession = 0; public static int zombieRevFleshSession = 0; + public static int zombieRevVisceraSession = 0; public static int zombieFoulFleshSession = 0; public static int zombieFoulFleshDropsSession = 0; public static int zombiePestilencesSession = 0; @@ -231,6 +254,29 @@ public class LootTracker { public static int zombieWardenHeartsSession = 0; public static double zombieTimeSession = -1; public static int zombieBossesSession = -1; + // Enderman + public static int endermanVoidgloomsSession = 0; + public static int endermanNullSpheresSession = 0; + public static int endermanTAPSession = 0; + public static int endermanTAPDropsSession = 0; + public static int endermanEndersnakesSession = 0; + public static int endermanSummoningEyesSession = 0; + public static int endermanManaBooksSession = 0; + public static int endermanTunersSession = 0; + public static int endermanAtomsSession = 0; + public static int endermanEspressoMachinesSession = 0; + public static int endermanSmartyBooksSession = 0; + public static int endermanEndRunesSession = 0; + public static int endermanChalicesSession = 0; + public static int endermanDiceSession = 0; + public static int endermanArtifactsSession = 0; + public static int endermanSkinsSession = 0; + public static int endermanMergersSession = 0; + public static int endermanCoresSession = 0; + public static int endermanEnchantRunesSession = 0; + public static int endermanEnderBooksSession = 0; + public static double endermanTimeSession = -1; + public static int endermanBossesSession = -1; // Fishing public static int seaCreaturesSession = 0; @@ -355,8 +401,7 @@ public class LootTracker { public static int voltaSession = 0; public static int plasmaSession = 0; public static int ghostlyBootsSession = 0; - // public static double ghostsSecondsSinceStarts = 0; - + // public static double ghostsSecondsSinceStarts = 0; static double checkItemsNow = 0; static double itemsChecked = 0; @@ -365,7 +410,6 @@ public class LootTracker { public void onChat(ClientChatReceivedEvent event) { String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); - if (!Utils.inSkyblock) return; if (event.type == 2) return; if (message.contains(":")) return; @@ -373,8 +417,7 @@ public class LootTracker { boolean wolfRNG = false; boolean spiderRNG = false; boolean zombieRNG = false; - - + boolean endermanRNG = false; // Slayer tracker // T6 books @@ -409,9 +452,13 @@ public class LootTracker { } ConfigHandler.writeIntConfig("wolf", "svens", wolfSvens); ConfigHandler.writeIntConfig("wolf", "bossRNG", wolfBosses); - } else if (message.contains("RARE DROP! (Hamster Wheel)")) { + } else if (message.contains("RARE DROP! (") && message.contains("Hamster Wheel)")) { + int amount = getAmountfromMessage(message); + wolfWheels += amount; + wolfWheelsSession += amount; wolfWheelsDrops++; wolfWheelsDropsSession++; + ConfigHandler.writeIntConfig("wolf", "wheel", wolfWheels); ConfigHandler.writeIntConfig("wolf", "wheelDrops", wolfWheelsDrops); } else if (message.contains("VERY RARE DROP! (") && message.contains(" Spirit Rune I)")) { // Removing the unicode here *should* fix rune drops not counting wolfSpirits++; @@ -452,9 +499,13 @@ public class LootTracker { } ConfigHandler.writeIntConfig("spider", "tarantulas", spiderTarantulas); ConfigHandler.writeIntConfig("spider", "bossRNG", spiderBosses); - } else if (message.contains("RARE DROP! (Toxic Arrow Poison)")) { + } else if (message.contains("RARE DROP! (") && message.contains("Toxic Arrow Poison)")) { + int amount = getAmountfromMessage(message); + spiderTAP += amount; + spiderTAPSession += amount; spiderTAPDrops++; spiderTAPDropsSession++; + ConfigHandler.writeIntConfig("spider", "tap", spiderTAP); ConfigHandler.writeIntConfig("spider", "tapDrops", spiderTAPDrops); } else if (message.contains("VERY RARE DROP! (") && message.contains(" Bite Rune I)")) { spiderBites++; @@ -493,9 +544,18 @@ public class LootTracker { } ConfigHandler.writeIntConfig("zombie", "revs", zombieRevs); ConfigHandler.writeIntConfig("zombie", "bossRNG", zombieBosses); - } else if (message.contains("RARE DROP! (Foul Flesh)")) { + } else if (message.contains("RARE DROP! (") && message.contains("Revenant Viscera)")) { + int amount = getAmountfromMessage(message); + zombieRevViscera += amount; + zombieRevVisceraSession += amount; + ConfigHandler.writeIntConfig("zombie", "revViscera", zombieRevViscera); + } else if (message.contains("RARE DROP! (") && message.contains("Foul Flesh)")) { + int amount = getAmountfromMessage(message); + zombieFoulFlesh += amount; + zombieFoulFleshSession += amount; zombieFoulFleshDrops++; zombieFoulFleshDropsSession++; + ConfigHandler.writeIntConfig("zombie", "foulFlesh", zombieFoulFlesh); ConfigHandler.writeIntConfig("zombie", "foulFleshDrops", zombieFoulFleshDrops); } else if (message.contains("VERY RARE DROP! (Revenant Catalyst)")) { zombieRevCatas++; @@ -533,12 +593,109 @@ public class LootTracker { zombieShardsSession++; ConfigHandler.writeIntConfig("zombie", "shard", zombieShards); if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.RED + "SHARD OF THE SHREDDED!", 5); - } else if (message.contains("INSANE DROP! (Warden Heart)")) { + } else if (message.contains("INSANE DROP! (Warden Heart)") || message.contains("CRAZY RARE DROP! (Warden Heart)")) { zombieRNG = true; zombieWardenHearts++; zombieWardenHeartsSession++; ConfigHandler.writeIntConfig("zombie", "heart", zombieWardenHearts); if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.RED + "WARDEN HEART!", 5); + } else if (message.contains(" Enderman Slayer LVL ")) { + endermanVoidglooms++; + endermanVoidgloomsSession++; + if (endermanBosses != -1) { + endermanBosses++; + } + if (endermanBossesSession != -1) { + endermanBossesSession++; + } + ConfigHandler.writeIntConfig("enderman", "voidglooms", endermanVoidglooms); + ConfigHandler.writeIntConfig("enderman", "bossRNG", endermanBosses); + } else if (message.contains("RARE DROP! (") && message.contains("Twilight Arrow Poison)")) { + int amount = getAmountfromMessage(message); + endermanTAP += amount; + endermanTAPSession += amount; + endermanTAPDrops++; + endermanTAPDropsSession++; + ConfigHandler.writeIntConfig("enderman", "tap", endermanTAP); + ConfigHandler.writeIntConfig("enderman", "tapDrops", endermanTAPDrops); + } else if (message.contains("VERY RARE DROP! (") && message.contains(" Endersnake Rune I)")) { + endermanEndersnakes++; + endermanEndersnakesSession++; + ConfigHandler.writeIntConfig("enderman", "endersnakes", endermanEndersnakes); + } else if (message.contains("VERY RARE DROP! (Summoning Eye)")) { + endermanSummoningEyes++; + endermanSummoningEyesSession++; + ConfigHandler.writeIntConfig("enderman", "summoningEyes", endermanSummoningEyes); + } else if (message.contains("VERY RARE DROP! (Mana Steal I)")) { + endermanManaBooks++; + endermanManaBooksSession++; + ConfigHandler.writeIntConfig("enderman", "manaBooks", endermanManaBooks); + } else if (message.contains("VERY RARE DROP! (Transmission Tuner)")) { + endermanTuners++; + endermanTunersSession++; + ConfigHandler.writeIntConfig("enderman", "tuners", endermanTuners); + } else if (message.contains("VERY RARE DROP! (Null Atom)")) { + endermanAtoms++; + endermanAtomsSession++; + ConfigHandler.writeIntConfig("enderman", "atoms", endermanAtoms); + } else if (message.contains("CRAZY RARE DROP! (Pocket Espresso Machine)")) { + endermanRNG = true; + endermanEspressoMachines++; + endermanEspressoMachinesSession++; + ConfigHandler.writeIntConfig("enderman", "espressoMachines", endermanEspressoMachines); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.AQUA + "POCKET ESPRESSO MACHINE!", 3); + } else if (message.contains("VERY RARE DROP! (Smarty Pants I)")) { + endermanSmartyBooks++; + endermanSmartyBooksSession++; + ConfigHandler.writeIntConfig("enderman", "smartyBooks", endermanSmartyBooks); + } else if (message.contains("VERY RARE DROP! (") && message.contains(" End Rune I)")) { + endermanEndRunes++; + endermanEndRunesSession++; + ConfigHandler.writeIntConfig("enderman", "endRunes", endermanEndRunes); + } else if (message.contains("CRAZY RARE DROP! (Handy Blood Chalice)")) { + endermanRNG = true; + endermanChalices++; + endermanChalicesSession++; + ConfigHandler.writeIntConfig("enderman", "chalices", endermanChalices); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.RED + "HANDY BLOOD CHALICE!", 3); + } else if (message.contains("VERY RARE DROP! (Sinful Dice)")) { + endermanDice++; + endermanDiceSession++; + ConfigHandler.writeIntConfig("enderman", "dice", endermanDice); + } else if (message.contains("CRAZY RARE DROP! (Exceedingly Rare Ender Artifact Upgrader)")) { + endermanRNG = true; + endermanArtifacts++; + endermanArtifactsSession++; + ConfigHandler.writeIntConfig("enderman", "artifacts", endermanArtifacts); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "ENDER ARTIFACT UPGRADER!", 3); + } else if (message.contains("CRAZY RARE DROP! (Void Conqueror Enderman Skin)")) { + endermanRNG = true; + endermanSkins++; + endermanSkinsSession++; + ConfigHandler.writeIntConfig("enderman", "skins", endermanSkins); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "ENDERMAN SKIN!", 3); + } else if (message.contains("VERY RARE DROP! (Etherwarp Merger)")) { + endermanMergers++; + endermanMergersSession++; + ConfigHandler.writeIntConfig("enderman", "mergers", endermanMergers); + } else if (message.contains("CRAZY RARE DROP! (Judgement Core)")) { + endermanRNG = true; + endermanCores++; + endermanCoresSession++; + ConfigHandler.writeIntConfig("enderman", "cores", endermanCores); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "JUDGEMENT CORE!", 5); + } else if (message.contains("CRAZY RARE DROP! (") && message.contains(" Enchant Rune I)")) { + endermanRNG = true; + endermanEnchantRunes++; + endermanEnchantRunesSession++; + ConfigHandler.writeIntConfig("enderman", "enchantRunes", endermanEnchantRunes); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GRAY + "ENCHANT RUNE!", 3); + } else if (message.contains("INSANE DROP! (Ender Slayer VII)") || message.contains("CRAZY RARE DROP! (Ender Slayer VII)")) { + endermanRNG = true; + endermanEnderBooks++; + endermanEnderBooksSession++; + ConfigHandler.writeIntConfig("enderman", "enderBooks", endermanEnderBooks); + if (ToggleCommand.rngesusAlerts) Utils.createTitle(EnumChatFormatting.RED + "ENDER SLAYER VII!", 3); } if (wolfRNG) { @@ -565,6 +722,14 @@ public class LootTracker { ConfigHandler.writeDoubleConfig("zombie", "timeRNG", zombieTime); ConfigHandler.writeIntConfig("zombie", "bossRNG", 0); } + if (endermanRNG) { + endermanTime = System.currentTimeMillis() / 1000; + endermanBosses = 0; + endermanTimeSession = System.currentTimeMillis() / 1000; + endermanBossesSession = 0; + ConfigHandler.writeDoubleConfig("enderman", "timeRNG", endermanTime); + ConfigHandler.writeIntConfig("enderman", "bossRNG", 0); + } // Fishing tracker if (message.contains("GOOD CATCH!")) { @@ -1017,7 +1182,7 @@ public class LootTracker { ghostlyBootsSession++; ConfigHandler.writeIntConfig("ghosts", "ghostlyBoots", ghostlyBoots); } - if (message.contains("Bag of Cash")) { + if (message.contains("The ghost's death materialized ")) { bagOfCashs++; bagOfCashSession++; ConfigHandler.writeIntConfig("ghosts", "bagOfCash", bagOfCashs); @@ -1095,34 +1260,26 @@ public class LootTracker { // If Hypixel lags and scoreboard doesn't update if (cleanedLine.contains("Boss slain!") || cleanedLine.contains("Slay the boss!")) { int itemTeeth = Utils.getItems("Wolf Tooth"); - int itemWheels = Utils.getItems("Hamster Wheel"); int itemWebs = Utils.getItems("Tarantula Web"); - int itemTAP = Utils.getItems("Toxic Arrow Poison"); int itemRev = Utils.getItems("Revenant Flesh"); - int itemFoul = Utils.getItems("Foul Flesh"); + int itemNullSphere = Utils.getItems("Null Sphere"); // If no items, are detected, allow check again. Should fix items not being found - if (itemTeeth + itemWheels + itemWebs + itemTAP + itemRev + itemFoul > 0) { + if (itemTeeth + itemWebs + itemRev + itemNullSphere > 0) { itemsChecked = System.currentTimeMillis() / 1000; wolfTeeth += itemTeeth; - wolfWheels += itemWheels; spiderWebs += itemWebs; - spiderTAP += itemTAP; zombieRevFlesh += itemRev; - zombieFoulFlesh += itemFoul; + endermanNullSpheres += itemNullSphere; wolfTeethSession += itemTeeth; - wolfWheelsSession += itemWheels; spiderWebsSession += itemWebs; - spiderTAPSession += itemTAP; zombieRevFleshSession += itemRev; - zombieFoulFleshSession += itemFoul; + endermanNullSpheresSession += itemNullSphere; ConfigHandler.writeIntConfig("wolf", "teeth", wolfTeeth); - ConfigHandler.writeIntConfig("wolf", "wheel", wolfWheels); ConfigHandler.writeIntConfig("spider", "web", spiderWebs); - ConfigHandler.writeIntConfig("spider", "tap", spiderTAP); ConfigHandler.writeIntConfig("zombie", "revFlesh", zombieRevFlesh); - ConfigHandler.writeIntConfig("zombie", "foulFlesh", zombieFoulFlesh); + ConfigHandler.writeIntConfig("enderman", "nullSpheres", endermanNullSpheres); } } } @@ -1159,5 +1316,13 @@ public class LootTracker { ConfigHandler.writeIntConfig("fishing", "empSC", empSCs); ConfigHandler.writeIntConfig("fishing", "yetiSC", yetiSCs); } + + public int getAmountfromMessage(String message) { + if (message.charAt(message.indexOf("(") + 1) == 'x') { + return Integer.parseInt(message.substring(message.indexOf("(") + 1, message.indexOf("x"))); + } else { + return 1; + } + } } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java index 7ff7e7a..eb9e268 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/CreeperSolver.java @@ -78,7 +78,13 @@ public class CreeperSolver { public void onWorldRender(RenderWorldLastEvent event) { if (ToggleCommand.creeperToggled && drawCreeperLines && !creeperLines.isEmpty()) { for (int i = 0; i < creeperLines.size(); i++) { - Utils.draw3DLine(creeperLines.get(i)[0], creeperLines.get(i)[1], CREEPER_COLOURS[i % 10], 2, true, event.partialTicks); + Vec3 pos1 = creeperLines.get(i)[0]; + Vec3 pos2 = creeperLines.get(i)[1]; + int colour = CREEPER_COLOURS[i % 10]; + + if (ToggleCommand.creeperLinesToggled) Utils.draw3DLine(pos1, pos2, colour, 2, true, event.partialTicks); + Utils.drawFilled3DBox(new AxisAlignedBB(pos1.xCoord - 0.51, pos1.yCoord - 0.51, pos1.zCoord - 0.51, pos1.xCoord + 0.51, pos1.yCoord + 0.51, pos1.zCoord + 0.51), colour, true, true, event.partialTicks); + Utils.drawFilled3DBox(new AxisAlignedBB(pos2.xCoord - 0.51, pos2.yCoord - 0.51, pos2.zCoord - 0.51, pos2.xCoord + 0.51, pos2.yCoord + 0.51, pos2.zCoord + 0.51), colour, true, true, event.partialTicks); } } } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java index b537198..6f02982 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/LividSolver.java @@ -5,7 +5,6 @@ import me.Danker.commands.MoveCommand; import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; import me.Danker.events.RenderOverlay; -import me.Danker.handlers.ScoreboardHandler; import me.Danker.handlers.TextRenderer; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; @@ -39,18 +38,7 @@ public class LividSolver { World world = Minecraft.getMinecraft().theWorld; if (DankersSkyblockMod.tickAmount % 20 == 0) { if (ToggleCommand.lividSolverToggled && Utils.inDungeons && !foundLivid && world != null) { - boolean inF5 = false; - - List<String> scoreboard = ScoreboardHandler.getSidebarLines(); - for (String s : scoreboard) { - String sCleaned = ScoreboardHandler.cleanSB(s); - if (sCleaned.contains("The Catacombs (F5)")) { - inF5 = true; - break; - } - } - - if (inF5) { + if (Utils.isInScoreboard("The Catacombs (F5)")) { List<Entity> loadedLivids = new ArrayList<>(); List<Entity> entities = world.getLoadedEntityList(); for (Entity entity : entities) { diff --git a/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java index 8f7de95..500c8eb 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/ThreeManSolver.java @@ -1,5 +1,6 @@ package me.Danker.features.puzzlesolvers; +import com.google.gson.JsonArray; import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.utils.Utils; @@ -16,6 +17,7 @@ import java.util.List; public class ThreeManSolver { + // Hard coded solutions if api call fails static String[] riddleSolutions = {"The reward is not in my chest!", "At least one of them is lying, and the reward is not in", "My chest doesn't have the reward. We are all telling the truth", "My chest has the reward and I'm telling the truth", "The reward isn't in any of our chests", "Both of them are telling the truth."}; @@ -33,33 +35,22 @@ public class ThreeManSolver { if (!Utils.inDungeons) return; if (ToggleCommand.threeManToggled && message.contains("[NPC]")) { - for (String solution : riddleSolutions) { - if (message.contains(solution)) { - Minecraft mc = Minecraft.getMinecraft(); - String npcName = message.substring(message.indexOf("]") + 2, message.indexOf(":")); - mc.thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ANSWER_COLOUR + EnumChatFormatting.BOLD + StringUtils.stripControlCodes(npcName) + DankersSkyblockMod.MAIN_COLOUR + " has the blessing.")); - if (riddleChest == null) { - List<Entity> entities = mc.theWorld.getLoadedEntityList(); - for (Entity entity : entities) { - if (entity == null || !entity.hasCustomName()) continue; - if (entity.getCustomNameTag().contains(npcName)) { - BlockPos npcLocation = new BlockPos(entity.posX, 69, entity.posZ); - if (mc.theWorld.getBlockState(npcLocation.north()).getBlock() == Blocks.chest) { - riddleChest = npcLocation.north(); - } else if (mc.theWorld.getBlockState(npcLocation.east()).getBlock() == Blocks.chest) { - riddleChest = npcLocation.east(); - } else if (mc.theWorld.getBlockState(npcLocation.south()).getBlock() == Blocks.chest) { - riddleChest = npcLocation.south(); - } else if (mc.theWorld.getBlockState(npcLocation.west()).getBlock() == Blocks.chest) { - riddleChest = npcLocation.west(); - } else { - System.out.print("Could not find correct riddle chest."); - } - break; - } - } + if (DankersSkyblockMod.data != null && DankersSkyblockMod.data.has("threeman")) { + JsonArray riddleSolutions = DankersSkyblockMod.data.get("threeman").getAsJsonArray(); + + for (int i = 0; i < riddleSolutions.size(); i++) { + String solution = riddleSolutions.get(i).getAsString(); + if (message.contains(solution)) { + answer(message); + break; + } + } + } else { + for (String solution : riddleSolutions) { + if (message.contains(solution)) { + answer(message); + break; } - break; } } } @@ -72,4 +63,32 @@ public class ThreeManSolver { } } + public static void answer(String message) { + Minecraft mc = Minecraft.getMinecraft(); + String npcName = message.substring(message.indexOf("]") + 2, message.indexOf(":")); + mc.thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ANSWER_COLOUR + EnumChatFormatting.BOLD + StringUtils.stripControlCodes(npcName) + DankersSkyblockMod.MAIN_COLOUR + " has the blessing.")); + + if (riddleChest == null) { + List<Entity> entities = mc.theWorld.getLoadedEntityList(); + for (Entity entity : entities) { + if (entity == null || !entity.hasCustomName()) continue; + if (entity.getCustomNameTag().contains(npcName)) { + BlockPos npcLocation = new BlockPos(entity.posX, 69, entity.posZ); + if (mc.theWorld.getBlockState(npcLocation.north()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.north(); + } else if (mc.theWorld.getBlockState(npcLocation.east()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.east(); + } else if (mc.theWorld.getBlockState(npcLocation.south()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.south(); + } else if (mc.theWorld.getBlockState(npcLocation.west()).getBlock() == Blocks.chest) { + riddleChest = npcLocation.west(); + } else { + System.out.print("Could not find correct riddle chest."); + } + break; + } + } + } + } + } diff --git a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java index 9adc555..dd2c23e 100644 --- a/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java +++ b/src/main/java/me/Danker/features/puzzlesolvers/TriviaSolver.java @@ -1,5 +1,9 @@ package me.Danker.features.puzzlesolvers; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import me.Danker.DankersSkyblockMod; import me.Danker.commands.ToggleCommand; import me.Danker.utils.Utils; import net.minecraft.util.ChatComponentText; @@ -9,16 +13,21 @@ import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; public class TriviaSolver { static Map<String, String[]> triviaSolutions = new HashMap<>(); static String[] triviaAnswers = null; + static JsonArray triviaAnswersJson = null; public static String TRIVIA_WRONG_ANSWER_COLOUR; public static void init() { + // Hard coded solutions if api call fails triviaSolutions.put("What is the status of The Watcher?", new String[]{"Stalker"}); triviaSolutions.put("What is the status of Bonzo?", new String[]{"New Necromancer"}); triviaSolutions.put("What is the status of Scarf?", new String[]{"Apprentice Necromancer"}); @@ -30,11 +39,10 @@ public class TriviaSolver { triviaSolutions.put("What is the status of Goldor?", new String[]{"Wither Soldier"}); triviaSolutions.put("What is the status of Storm?", new String[]{"Elementalist"}); triviaSolutions.put("What is the status of Necron?", new String[]{"Wither Lord"}); - triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"222 Fairy Souls"}); + triviaSolutions.put("How many total Fairy Souls are there?", new String[]{"227 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Spider's Den?", new String[]{"19 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The End?", new String[]{"12 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in The Barn?", new String[]{"7 Fairy Souls"}); - triviaSolutions.put("How many Fairy Souls are there in Mushroom Desert?", new String[]{"8 Fairy Souls"}); + triviaSolutions.put("How many Fairy Souls are there in The Farming Islands?", new String[]{"20 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Blazing Fortress?", new String[]{"19 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in The Park?", new String[]{"11 Fairy Souls"}); triviaSolutions.put("How many Fairy Souls are there in Jerry's Workshop?", new String[]{"5 Fairy Souls"}); @@ -65,35 +73,76 @@ public class TriviaSolver { if (event.type == 2) return; if (ToggleCommand.oruoToggled) { - if (message.contains("What SkyBlock year is it?")) { - double currentTime = System.currentTimeMillis() /1000L; + if (DankersSkyblockMod.data != null && DankersSkyblockMod.data.has("trivia")) { + if (message.contains("What SkyBlock year is it?")) { + double currentTime = System.currentTimeMillis() / 1000L; - double diff = Math.floor(currentTime - 1560276000); + double diff = Math.floor(currentTime - 1560276000); - int year = (int) (diff / 446400 + 1); - triviaAnswers = new String[]{"Year " + year}; - } else { - for (String question : triviaSolutions.keySet()) { - if (message.contains(question)) { - triviaAnswers = triviaSolutions.get(question); - break; + int year = (int) (diff / 446400 + 1); + triviaAnswersJson = new JsonArray(); + triviaAnswersJson.add(new JsonPrimitive("Year " + year)); + } else { + JsonObject triviaSolutions = DankersSkyblockMod.data.get("trivia").getAsJsonObject(); + + List<String> triviaSolutionsList = triviaSolutions.entrySet().stream() + .map(Map.Entry::getKey) + .collect(Collectors.toCollection(ArrayList::new)); + for (String question : triviaSolutionsList) { + if (message.contains(question)) { + triviaAnswersJson = triviaSolutions.get(question).getAsJsonArray(); + break; + } } } - } - // Set wrong answers to red and remove click events - if (triviaAnswers != null && (message.contains("ⓐ") || message.contains("ⓑ") || message.contains("ⓒ"))) { - boolean isSolution = false; - for (String solution : triviaAnswers) { - if (message.contains(solution)) { - isSolution = true; - break; + // Set wrong answers to red and remove click events + if (triviaAnswersJson != null && (message.contains("ⓐ") || message.contains("ⓑ") || message.contains("ⓒ"))) { + boolean isSolution = false; + for (int i = 0; i < triviaAnswersJson.size(); i++) { + String solution = triviaAnswersJson.get(i).getAsString(); + if (message.contains(solution)) { + isSolution = true; + break; + } + } + if (!isSolution) { + char letter = message.charAt(5); + String option = message.substring(6); + event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + TRIVIA_WRONG_ANSWER_COLOUR + option); + } + } + } else { + if (message.contains("What SkyBlock year is it?")) { + double currentTime = System.currentTimeMillis() / 1000L; + + double diff = Math.floor(currentTime - 1560276000); + + int year = (int) (diff / 446400 + 1); + triviaAnswers = new String[]{"Year " + year}; + } else { + for (String question : triviaSolutions.keySet()) { + if (message.contains(question)) { + triviaAnswers = triviaSolutions.get(question); + break; + } } } - if (!isSolution) { - char letter = message.charAt(5); - String option = message.substring(6); - event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + TRIVIA_WRONG_ANSWER_COLOUR + option); + + // Set wrong answers to red and remove click events + if (triviaAnswers != null && (message.contains("ⓐ") || message.contains("ⓑ") || message.contains("ⓒ"))) { + boolean isSolution = false; + for (String solution : triviaAnswers) { + if (message.contains(solution)) { + isSolution = true; + break; + } + } + if (!isSolution) { + char letter = message.charAt(5); + String option = message.substring(6); + event.message = new ChatComponentText(" " + EnumChatFormatting.GOLD + letter + TRIVIA_WRONG_ANSWER_COLOUR + option); + } } } } |