aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/Danker/TheMod.java1155
-rw-r--r--src/main/java/me/Danker/commands/ArmourCommand.java150
-rw-r--r--src/main/java/me/Danker/commands/BankCommand.java115
-rw-r--r--src/main/java/me/Danker/commands/DHelpCommand.java52
-rw-r--r--src/main/java/me/Danker/commands/DisplayCommand.java108
-rw-r--r--src/main/java/me/Danker/commands/GetkeyCommand.java41
-rw-r--r--src/main/java/me/Danker/commands/GuildOfCommand.java116
-rw-r--r--src/main/java/me/Danker/commands/ImportFishingCommand.java233
-rw-r--r--src/main/java/me/Danker/commands/LootCommand.java533
-rw-r--r--src/main/java/me/Danker/commands/MoveCommand.java69
-rw-r--r--src/main/java/me/Danker/commands/PetsCommand.java247
-rw-r--r--src/main/java/me/Danker/commands/ReloadConfigCommand.java36
-rw-r--r--src/main/java/me/Danker/commands/ResetLootCommand.java181
-rw-r--r--src/main/java/me/Danker/commands/ScaleCommand.java70
-rw-r--r--src/main/java/me/Danker/commands/SetkeyCommand.java43
-rw-r--r--src/main/java/me/Danker/commands/SkillsCommand.java334
-rw-r--r--src/main/java/me/Danker/commands/SlayerCommand.java112
-rw-r--r--src/main/java/me/Danker/commands/ToggleCommand.java83
-rw-r--r--src/main/java/me/Danker/handlers/APIHandler.java141
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java347
-rw-r--r--src/main/java/me/Danker/handlers/ScoreboardHandler.java60
-rw-r--r--src/main/java/me/Danker/handlers/TextRenderer.java20
-rw-r--r--src/main/java/me/Danker/utils/Utils.java88
-rw-r--r--src/main/resources/mcmod.info12
24 files changed, 4346 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java
new file mode 100644
index 0000000..b99ac42
--- /dev/null
+++ b/src/main/java/me/Danker/TheMod.java
@@ -0,0 +1,1155 @@
+package me.Danker;
+
+import java.awt.Image;
+import java.awt.SystemTray;
+import java.awt.Toolkit;
+import java.awt.TrayIcon;
+import java.text.NumberFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+import com.google.gson.JsonObject;
+
+import me.Danker.commands.ArmourCommand;
+import me.Danker.commands.BankCommand;
+import me.Danker.commands.DHelpCommand;
+import me.Danker.commands.DisplayCommand;
+import me.Danker.commands.GetkeyCommand;
+import me.Danker.commands.GuildOfCommand;
+import me.Danker.commands.ImportFishingCommand;
+import me.Danker.commands.LootCommand;
+import me.Danker.commands.MoveCommand;
+import me.Danker.commands.PetsCommand;
+import me.Danker.commands.ReloadConfigCommand;
+import me.Danker.commands.ResetLootCommand;
+import me.Danker.commands.ScaleCommand;
+import me.Danker.commands.SetkeyCommand;
+import me.Danker.commands.SkillsCommand;
+import me.Danker.commands.SlayerCommand;
+import me.Danker.commands.ToggleCommand;
+import me.Danker.handlers.APIHandler;
+import me.Danker.handlers.ConfigHandler;
+import me.Danker.handlers.ScoreboardHandler;
+import me.Danker.handlers.TextRenderer;
+import me.Danker.utils.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.event.ClickEvent;
+import net.minecraft.event.ClickEvent.Action;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.ClientCommandHandler;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.client.event.RenderGameOverlayEvent;
+import net.minecraftforge.client.event.sound.PlaySoundEvent;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.EntityJoinWorldEvent;
+import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+import net.minecraftforge.fml.common.FMLCommonHandler;
+import net.minecraftforge.fml.common.Mod;
+import net.minecraftforge.fml.common.Mod.EventHandler;
+import net.minecraftforge.fml.common.event.FMLInitializationEvent;
+import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
+import net.minecraftforge.fml.common.eventhandler.EventPriority;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion;
+
+@Mod(modid = TheMod.MODID, version = TheMod.VERSION, clientSideOnly = true)
+public class TheMod
+{
+ public static final String MODID = "Danker's Skyblock Mod";
+ public static final String VERSION = "1.6.1";
+
+ static double checkItemsNow = 0;
+ static double itemsChecked = 0;
+ public static Map<String, String> t6Enchants = new HashMap<String, String>();
+ public static Pattern pattern = Pattern.compile("");
+ static boolean updateChecked = false;
+ public static int titleTimer = -1;
+ public static boolean showTitle = false;
+ public static String titleText = "";
+
+ @EventHandler
+ public void init(FMLInitializationEvent event)
+ {
+ FMLCommonHandler.instance().bus().register(this);
+ MinecraftForge.EVENT_BUS.register(this);
+
+ final ConfigHandler cf = new ConfigHandler();
+ cf.reloadConfig();
+
+ // For golden enchants
+ t6Enchants.put("Bane of Arthropods VI", EnumChatFormatting.GOLD + "Bane of Arthropods VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Critical VI", EnumChatFormatting.GOLD + "Critical VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Dragon Hunter V", EnumChatFormatting.GOLD + "Dragon Hunter V" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Ender Slayer VI", EnumChatFormatting.GOLD + "Ender Slayer VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Experience IV", EnumChatFormatting.GOLD + "Experience IV" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Giant Killer VI", EnumChatFormatting.GOLD + "Giant Killer VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Life Steal IV", EnumChatFormatting.GOLD + "Life Steal IV" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Looting IV", EnumChatFormatting.GOLD + "Looting IV" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Luck VI", EnumChatFormatting.GOLD + "Luck VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Scavenger IV", EnumChatFormatting.GOLD + "Scavenger IV" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Scavenger V", EnumChatFormatting.GOLD + "Scavenger V" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Sharpness VI", EnumChatFormatting.GOLD + "Sharpness VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Smite VI", EnumChatFormatting.GOLD + "Smite VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Smite VII", EnumChatFormatting.GOLD + "Smite VII" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Vampirism VI", EnumChatFormatting.GOLD + "Vampirism VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Power VI", EnumChatFormatting.GOLD + "Power VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Growth VI", EnumChatFormatting.GOLD + "Growth VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Protection VI", EnumChatFormatting.GOLD + "Protection VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Efficiency VI", EnumChatFormatting.GOLD + "Efficiency VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Angler VI", EnumChatFormatting.GOLD + "Angler VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Caster VI", EnumChatFormatting.GOLD + "Caster VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Frail VI", EnumChatFormatting.GOLD + "Frail VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Luck of the Sea VI", EnumChatFormatting.GOLD + "Luck of the Sea VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Lure VI", EnumChatFormatting.GOLD + "Lure VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Magnet VI", EnumChatFormatting.GOLD + "Magnet VI" + EnumChatFormatting.BLUE);
+ t6Enchants.put("Spiked Hook VI", EnumChatFormatting.GOLD + "Spiked Hook VI" + EnumChatFormatting.BLUE);
+
+ String patternString = "(" + String.join("|", t6Enchants.keySet()) + ")";
+ pattern = Pattern.compile(patternString);
+ }
+
+ @EventHandler
+ public void preInit(final FMLPreInitializationEvent event) {
+ ClientCommandHandler.instance.registerCommand(new ToggleCommand());
+ ClientCommandHandler.instance.registerCommand(new SetkeyCommand());
+ ClientCommandHandler.instance.registerCommand(new GetkeyCommand());
+ ClientCommandHandler.instance.registerCommand(new LootCommand());
+ ClientCommandHandler.instance.registerCommand(new ReloadConfigCommand());
+ ClientCommandHandler.instance.registerCommand(new DisplayCommand());
+ ClientCommandHandler.instance.registerCommand(new MoveCommand());
+ ClientCommandHandler.instance.registerCommand(new SlayerCommand());
+ ClientCommandHandler.instance.registerCommand(new SkillsCommand());
+ ClientCommandHandler.instance.registerCommand(new GuildOfCommand());
+ ClientCommandHandler.instance.registerCommand(new DHelpCommand());
+ ClientCommandHandler.instance.registerCommand(new PetsCommand());
+ ClientCommandHandler.instance.registerCommand(new BankCommand());
+ ClientCommandHandler.instance.registerCommand(new ArmourCommand());
+ ClientCommandHandler.instance.registerCommand(new ImportFishingCommand());
+ ClientCommandHandler.instance.registerCommand(new ResetLootCommand());
+ ClientCommandHandler.instance.registerCommand(new ScaleCommand());
+ }
+
+ // Update checker
+ @SubscribeEvent
+ public void onJoin(EntityJoinWorldEvent event) {
+ if (!updateChecked) {
+ updateChecked = true;
+
+ // MULTI THREAD DRIFTING
+ new Thread(() -> {
+ APIHandler ah = new APIHandler();
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+
+ System.err.println("Checking for updates...");
+ JsonObject latestRelease = ah.getResponse("https://api.github.com/repos/bowser0000/SkyblockMod/releases/latest");
+
+ String latestTag = latestRelease.get("tag_name").getAsString();
+ DefaultArtifactVersion currentVersion = new DefaultArtifactVersion(VERSION);
+ DefaultArtifactVersion latestVersion = new DefaultArtifactVersion(latestTag.substring(1));
+
+ if (currentVersion.compareTo(latestVersion) < 0) {
+ String releaseURL = latestRelease.get("html_url").getAsString();
+
+ ChatComponentText update = new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + " [UPDATE] ");
+ update.setChatStyle(update.getChatStyle().setChatClickEvent(new ClickEvent(Action.OPEN_URL, releaseURL)));
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ex) {
+ System.err.println(ex);
+ }
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + MODID + " is outdated. Please update to " + latestTag + ".\n").appendSibling(update));
+ }
+ }).start();
+ }
+ }
+
+ // It randomly broke, so I had to make it the highest priority
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onChat(ClientChatReceivedEvent event) {
+ final ToggleCommand tc = new ToggleCommand();
+ String message = event.message.getUnformattedText();
+
+ if (message.contains(":")) return;
+
+ if (tc.gpartyToggled) {
+ if (message.contains(" has invited all members of ")) {
+ System.out.println(message);
+ try {
+ final SystemTray tray = SystemTray.getSystemTray();
+ final Image image = Toolkit.getDefaultToolkit().createImage("icon.png");
+ final TrayIcon trayIcon = new TrayIcon(image, "Guild Party Notifier");
+ trayIcon.setImageAutoSize(true);
+ trayIcon.setToolTip("Guild Party Notifier");
+ tray.add(trayIcon);
+ trayIcon.displayMessage("Guild Party", message, TrayIcon.MessageType.INFO);
+ tray.remove(trayIcon);
+ } catch (Exception ex) {
+ System.err.print(ex);
+ }
+ }
+ }
+
+ final LootCommand lc = new LootCommand();
+ final ConfigHandler cf = new ConfigHandler();
+ boolean wolfRNG = false;
+ boolean spiderRNG = false;
+ boolean zombieRNG = false;
+ // T6 books
+ if (message.contains("VERY RARE DROP! (Enchanted Book)") || message.contains("CRAZY RARE DROP! (Enchanted Book)")) {
+ // Loop through scoreboard to see what boss you're doing
+ List<String> scoreboard = ScoreboardHandler.getSidebarLines();
+ for (String s : scoreboard) {
+ String sCleaned = ScoreboardHandler.cleanSB(s);
+ if (sCleaned.contains("Sven Packmaster")) {
+ lc.wolfBooks++;
+ cf.writeIntConfig("wolf", "book", lc.wolfBooks);
+ } else if (sCleaned.contains("Tarantula Broodfather")) {
+ lc.spiderBooks++;
+ cf.writeIntConfig("spider", "book", lc.spiderBooks);
+ } else if (sCleaned.contains("Revenant Horror")) {
+ lc.zombieBooks++;
+ cf.writeIntConfig("zombie", "book", lc.zombieBooks);
+ }
+ }
+ }
+
+ // Wolf
+ if (message.contains("Talk to Maddox to claim your Wolf Slayer XP!")) {
+ lc.wolfSvens++;
+ lc.wolfSvensSession++;
+ if (lc.wolfBosses != -1) {
+ lc.wolfBosses++;
+ }
+ if (lc.wolfBossesSession != -1) {
+ lc.wolfBossesSession++;
+ }
+ cf.writeIntConfig("wolf", "svens", lc.wolfSvens);
+ cf.writeIntConfig("wolf", "bossRNG", lc.wolfBosses);
+ }
+ if (message.contains("RARE DROP! (Hamster Wheel)")) {
+ lc.wolfWheelsDrops++;
+ lc.wolfWheelsDropsSession++;
+ cf.writeIntConfig("wolf", "wheelDrops", lc.wolfWheelsDrops);
+ }
+ // Removing the unicode here *should* fix rune drops not counting
+ if (message.contains("VERY RARE DROP! (") && message.contains(" Spirit Rune I)")) {
+ lc.wolfSpirits++;
+ lc.wolfSpiritsSession++;
+ cf.writeIntConfig("wolf", "spirit", lc.wolfSpirits);
+ }
+ if (message.contains("CRAZY RARE DROP! (Red Claw Egg)")) {
+ wolfRNG = true;
+ lc.wolfEggs++;
+ lc.wolfEggsSession++;
+ cf.writeIntConfig("wolf", "egg", lc.wolfEggs);
+ if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_RED + "RED CLAW EGG!", 3);
+ }
+ if (message.contains("CRAZY RARE DROP! (") && message.contains(" Couture Rune I)")) {
+ wolfRNG = true;
+ lc.wolfCoutures++;
+ lc.wolfCouturesSession++;
+ cf.writeIntConfig("wolf", "couture", lc.wolfCoutures);
+ if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "COUTURE RUNE!", 3);
+ }
+ // How did Skyblock devs even manage to make this item Rename Me
+ if (message.contains("CRAZY RARE DROP! (Grizzly Bait)") || message.contains("CRAZY RARE DROP! (Rename Me)")) {
+ wolfRNG = true;
+ lc.wolfBaits++;
+ lc.wolfBaitsSession++;
+ cf.writeIntConfig("wolf", "bait", lc.wolfBaits);
+ if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.AQUA + "GRIZZLY BAIT!", 3);
+ }
+ if (message.contains("CRAZY RARE DROP! (Overflux Capacitor)")) {
+ wolfRNG = true;
+ lc.wolfFluxes++;
+ lc.wolfFluxesSession++;
+ cf.writeIntConfig("wolf", "flux", lc.wolfFluxes);
+ if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "OVERFLUX CAPACITOR!", 5);
+ }
+
+ // Spider
+ if (message.contains("Talk to Maddox to claim your Spider Slayer XP!")) {
+ lc.spiderTarantulas++;
+ lc.spiderTarantulasSession++;
+ if (lc.spiderBosses != -1) {
+ lc.spiderBosses++;
+ }
+ if (lc.spiderBossesSession != -1) {
+ lc.spiderBossesSession++;
+ }
+ cf.writeIntConfig("spider", "tarantulas", lc.spiderTarantulas);
+ cf.writeIntConfig("spider", "bossRNG", lc.spiderBosses);
+ }
+ if (message.contains("RARE DROP! (Toxic Arrow Poison)")) {
+ lc.spiderTAPDrops++;
+ lc.spiderTAPDropsSession++;
+ cf.writeIntConfig("spider", "tapDrops", lc.spiderTAPDrops);
+ }
+ if (message.contains("VERY RARE DROP! (") && message.contains(" Bite Rune I)")) {
+ lc.spiderBites++;
+ lc.spiderBitesSession++;
+ cf.writeIntConfig("spider", "bite", lc.spiderBites);
+ }
+ if (message.contains("VERY RARE DROP! (Spider Catalyst)")) {
+ lc.spiderCatalysts++;
+ lc.spiderCatalystsSession++;
+ cf.writeIntConfig("spider", "catalyst", lc.spiderCatalysts);
+ }
+ if (message.contains("CRAZY RARE DROP! (Fly Swatter)")) {
+ spiderRNG = true;
+ lc.spiderSwatters++;
+ lc.spiderSwattersSession++;
+ cf.writeIntConfig("spider", "swatter", lc.spiderSwatters);
+ if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.LIGHT_PURPLE + "FLY SWATTER!", 3);
+ }
+ if (message.contains("CRAZY RARE DROP! (Tarantula Talisman")) {
+ spiderRNG = true;
+ lc.spiderTalismans++;
+ lc.spiderTalismansSession++;
+ cf.writeIntConfig("spider", "talisman", lc.spiderTalismans);
+ if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "TARANTULA TALISMAN!", 3);
+ }
+ if (message.contains("CRAZY RARE DROP! (Digested Mosquito)")) {
+ spiderRNG = true;
+ lc.spiderMosquitos++;
+ lc.spiderMosquitosSession++;
+ cf.writeIntConfig("spider", "mosquito", lc.spiderMosquitos);
+ if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "DIGESTED MOSQUITO!", 5);
+ }
+
+ // Zombie
+ if (message.contains("Talk to Maddox to claim your Zombie Slayer XP!")) {
+ lc.zombieRevs++;
+ lc.zombieRevsSession++;
+ if (lc.zombieBosses != -1) {
+ lc.zombieBosses++;
+ }
+ if (lc.zombieBossesSession != 1) {
+ lc.zombieBossesSession++;
+ }
+ cf.writeIntConfig("zombie", "revs", lc.zombieRevs);
+ cf.writeIntConfig("wolf", "bossRNG", lc.zombieBosses);
+ }
+ if (message.contains("RARE DROP! (Foul Flesh)")) {
+ lc.zombieFoulFleshDrops++;
+ lc.zombieFoulFleshDropsSession++;
+ cf.writeIntConfig("zombie", "foulFleshDrops", lc.zombieFoulFleshDrops);
+ }
+ if (message.contains("VERY RARE DROP! (Revenant Catalyst)")) {
+ lc.zombieRevCatas++;
+ lc.zombieRevCatasSession++;
+ cf.writeIntConfig("zombie", "revCatalyst", lc.zombieRevCatas);
+ }
+ if (message.contains("VERY RARE DROP! (") && message.contains(" Pestilence Rune I)")) {
+ lc.zombiePestilences++;
+ lc.zombiePestilencesSession++;
+ cf.writeIntConfig("zombie", "pestilence", lc.zombiePestilences);
+ }
+ if (message.contains("VERY RARE DROP! (Undead Catalyst)")) {
+ lc.zombieUndeadCatas++;
+ lc.zombieUndeadCatasSession++;
+ cf.writeIntConfig("zombie", "undeadCatalyst", lc.zombieUndeadCatas);
+ }
+ if (message.contains("CRAZY RARE DROP! (Beheaded Horror)")) {
+ zombieRNG = true;
+ lc.zombieBeheadeds++;
+ lc.zombieBeheadedsSession++;
+ cf.writeIntConfig("zombie", "beheaded", lc.zombieBeheadeds);
+ if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "BEHEADED HORROR!", 3);
+ }
+ if (message.contains("CRAZY RARE DROP! (") && message.contains(" Snake Rune I)")) {
+ zombieRNG = true;
+ lc.zombieSnakes++;
+ lc.zombieSnakesSession++;
+ cf.writeIntConfig("zombie", "snake", lc.zombieSnakes);
+ if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.DARK_GREEN + "SNAKE RUNE!", 3);
+ }
+ if (message.contains("CRAZY RARE DROP! (Scythe Blade)")) {
+ zombieRNG = true;
+ lc.zombieScythes++;
+ lc.zombieScythesSession++;
+ cf.writeIntConfig("zombie", "scythe", lc.zombieScythes);
+ if (tc.rngesusAlerts) Utils.createTitle(EnumChatFormatting.GOLD + "SCYTHE BLADE!", 5);
+ }
+
+ if (wolfRNG) {
+ lc.wolfTime = System.currentTimeMillis() / 1000;
+ lc.wolfBosses = 0;
+ lc.wolfTimeSession = System.currentTimeMillis() / 1000;
+ lc.wolfBossesSession = 0;
+ cf.writeDoubleConfig("wolf", "timeRNG", lc.wolfTime);
+ cf.writeIntConfig("wolf", "bossRNG", 0);
+ }
+ if (spiderRNG) {
+ lc.spiderTime = System.currentTimeMillis() / 1000;
+ lc.spiderBosses = 0;
+ lc.spiderTimeSession = System.currentTimeMillis() / 1000;
+ lc.spiderBossesSession = 0;
+ cf.writeDoubleConfig("spider", "timeRNG", lc.spiderTime);
+ cf.writeIntConfig("spider", "bossRNG", 0);
+ }
+ if (zombieRNG) {
+ lc.zombieTime = System.currentTimeMillis() / 1000;
+ lc.zombieBosses = 0;
+ lc.zombieTimeSession = System.currentTimeMillis() / 1000;
+ lc.zombieBossesSession = 0;
+ cf.writeDoubleConfig("zombie", "timeRNG", lc.zombieTime);
+ cf.writeIntConfig("zombie", "bossRNG", 0);
+ }
+
+ // Fishing
+ if (message.contains("GOOD CATCH!")) {
+ lc.goodCatches++;
+ lc.goodCatchesSession++;
+ cf.writeIntConfig("fishing", "goodCatch", lc.goodCatches);
+ }
+ if (message.contains("GREAT CATCH!")) {
+ lc.greatCatches++;
+ lc.greatCatchesSession++;
+ cf.writeIntConfig("fishing", "greatCatch", lc.greatCatches);
+ }
+ if (message.contains("You caught a lowly Squid")) {
+ lc.squids++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.squidsSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "squid", lc.squids);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("From the depths of the waters, you've reeled in a Sea Walker")) {
+ lc.seaWalkers++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.seaWalkersSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "seaWalker", lc.seaWalkers);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("Pitch darkness reveals you've caught a")) {
+ lc.nightSquids++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.nightSquidsSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "nightSquid", lc.nightSquids);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("You've stumbled upon a patrolling Sea Guardian")) {
+ lc.seaGuardians++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.seaGuardiansSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "seaGuardian", lc.seaGuardians);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("It looks like you've disrupted the Sea Witch's brewing session. Watch out, she's furious")) {
+ lc.seaWitches++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.seaWitchesSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "seaWitch", lc.seaWitches);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("From the depths of the waters, you've reeled in a Sea Archer")) {
+ lc.seaArchers++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.seaArchersSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "seaArcher", lc.seaArchers);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("The Monster of the Deep emerges from the dark depths")) {
+ lc.monsterOfTheDeeps++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.monsterOfTheDeepsSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "monsterOfDeep", lc.monsterOfTheDeeps);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("You have found a Catfish, don't let it steal your catches")) {
+ lc.catfishes++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.catfishesSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "catfish", lc.catfishes);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("Is this even a fish? It's the Carrot King")) {
+ lc.carrotKings++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.carrotKingsSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "carrotKing", lc.carrotKings);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("Gross! A Sea Leech")) {
+ lc.seaLeeches++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.seaLeechesSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "seaLeech", lc.seaLeeches);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("You've discovered a Guardian Defender of the sea")) {
+ lc.guardianDefenders++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.guardianDefendersSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "guardianDefender", lc.guardianDefenders);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("You have awoken the Deep Sea Protector, prepare for a battle")) {
+ lc.deepSeaProtectors++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.deepSeaProtectorsSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "deepSeaProtector", lc.deepSeaProtectors);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("The Water Hydra has come to test your strength")) {
+ lc.hydras++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.hydrasSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "hydra", lc.hydras);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ increaseEmpSC();
+ }
+ if (message.contains("The Sea Emperor arises from the depths")) {
+ lc.seaEmperors++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.empTime = System.currentTimeMillis() / 1000;
+ lc.empSCs = 0;
+ lc.seaEmperorsSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ lc.empTimeSession = System.currentTimeMillis() / 1000;
+ lc.empSCsSession = 0;
+ cf.writeIntConfig("fishing", "seaEmperor", lc.seaEmperors);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ cf.writeDoubleConfig("fishing", "empTime", lc.empTime);
+ cf.writeIntConfig("fishing", "empSC", lc.empSCs);
+ }
+ // Fishing Winter
+ if (message.contains("Frozen Steve fell into the pond long ago")) {
+ lc.frozenSteves++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.frozenStevesSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "frozenSteve", lc.frozenSteves);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ }
+ if (message.contains("It's a snowman! He looks harmless")) {
+ lc.frostyTheSnowmans++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.frostyTheSnowmansSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "snowman", lc.frostyTheSnowmans);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ }
+ if (message.contains("stole Jerry's Gifts...get them back")) {
+ lc.grinches++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.grinchesSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "grinch", lc.grinches);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ }
+ if (message.contains("What is this creature")) {
+ lc.yetis++;
+ lc.seaCreatures++;
+ lc.fishingMilestone++;
+ lc.yetisSession++;
+ lc.seaCreaturesSession++;
+ lc.fishingMilestoneSession++;
+ cf.writeIntConfig("fishing", "yeti", lc.yetis);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ }
+ }
+
+ @SubscribeEvent
+ public void renderPlayerInfo(final RenderGameOverlayEvent.Post event) {
+ if (event.type != RenderGameOverlayEvent.ElementType.EXPERIENCE) return;
+ final ToggleCommand tc = new ToggleCommand();
+ final MoveCommand moc = new MoveCommand();
+ final DisplayCommand ds = new DisplayCommand();
+
+ if (tc.coordsToggled) {
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+
+ double xDir = (player.rotationYaw % 360 + 360) % 360;
+ if (xDir > 180) xDir -= 360;
+ xDir = (double) Math.round(xDir * 10d) / 10d;
+ double yDir = (double) Math.round(player.rotationPitch * 10d) / 10d;
+
+ String coordText = (int) player.posX + " / " + (int) player.posY + " / " + (int) player.posZ + " (" + xDir + " / " + yDir + ")";
+ new TextRenderer(Minecraft.getMinecraft(), coordText, moc.coordsXY[0], moc.coordsXY[1], ScaleCommand.coordsScale);
+ }
+
+ if (!ds.display.equals("off")) {
+ final LootCommand lc = new LootCommand();
+ String dropsText = "";
+ String countText = "";
+ String timeBetween = "Never";
+ String bossesBetween = "Never";
+ String drop20;
+ double timeNow = System.currentTimeMillis() / 1000;
+ NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US);
+
+ if (ds.display.equals("wolf")) {
+ if (lc.wolfTime == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = lc.getTimeBetween(lc.wolfTime, timeNow);
+ }
+ if (lc.wolfBosses == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(lc.wolfBosses);
+ }
+ if (tc.slayerCountTotal) {
+ drop20 = nf.format(lc.wolfWheels);
+ } else {
+ drop20 = nf.format(lc.wolfWheelsDrops) + " times";
+ }
+
+ dropsText = EnumChatFormatting.GOLD + "Svens Killed:\n" +
+ EnumChatFormatting.GREEN + "Wolf Teeth:\n" +
+ EnumChatFormatting.BLUE + "Hamster Wheels:\n" +
+ EnumChatFormatting.AQUA + "Spirit Runes:\n" +
+ EnumChatFormatting.WHITE + "Critical VI Books:\n" +
+ EnumChatFormatting.DARK_RED + "Red Claw Eggs:\n" +
+ EnumChatFormatting.GOLD + "Couture Runes:\n" +
+ EnumChatFormatting.AQUA + "Grizzly Baits:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Overfluxes:\n" +
+ EnumChatFormatting.AQUA + "Time Since RNG:\n" +
+ EnumChatFormatting.AQUA + "Bosses Since RNG:";
+ countText = EnumChatFormatting.GOLD + nf.format(lc.wolfSvens) + "\n" +
+ EnumChatFormatting.GREEN + nf.format(lc.wolfTeeth) + "\n" +
+ EnumChatFormatting.BLUE + drop20 + "\n" +
+ EnumChatFormatting.AQUA + lc.wolfSpirits + "\n" +
+ EnumChatFormatting.WHITE + lc.wolfBooks + "\n" +
+ EnumChatFormatting.DARK_RED + lc.wolfEggs + "\n" +
+ EnumChatFormatting.GOLD + lc.wolfCoutures + "\n" +
+ EnumChatFormatting.AQUA + lc.wolfBaits + "\n" +
+ EnumChatFormatting.DARK_PURPLE + lc.wolfFluxes + "\n" +
+ EnumChatFormatting.AQUA + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + bossesBetween;
+ } else if (ds.display.equals("wolf_session")) {
+ if (lc.wolfTimeSession == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = lc.getTimeBetween(lc.wolfTimeSession, timeNow);
+ }
+ if (lc.wolfBossesSession == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(lc.wolfBossesSession);
+ }
+ if (tc.slayerCountTotal) {
+ drop20 = nf.format(lc.wolfWheelsSession);
+ } else {
+ drop20 = nf.format(lc.wolfWheelsDropsSession) + " times";
+ }
+
+ dropsText = EnumChatFormatting.GOLD + "Svens Killed:\n" +
+ EnumChatFormatting.GREEN + "Wolf Teeth:\n" +
+ EnumChatFormatting.BLUE + "Hamster Wheels:\n" +
+ EnumChatFormatting.AQUA + "Spirit Runes:\n" +
+ EnumChatFormatting.WHITE + "Critical VI Books:\n" +
+ EnumChatFormatting.DARK_RED + "Red Claw Eggs:\n" +
+ EnumChatFormatting.GOLD + "Couture Runes:\n" +
+ EnumChatFormatting.AQUA + "Grizzly Baits:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Overfluxes:\n" +
+ EnumChatFormatting.AQUA + "Time Since RNG:\n" +
+ EnumChatFormatting.AQUA + "Bosses Since RNG:";
+ countText = EnumChatFormatting.GOLD + nf.format(lc.wolfSvensSession) + "\n" +
+ EnumChatFormatting.GREEN + nf.format(lc.wolfTeethSession) + "\n" +
+ EnumChatFormatting.BLUE + drop20 + "\n" +
+ EnumChatFormatting.AQUA + lc.wolfSpiritsSession + "\n" +
+ EnumChatFormatting.WHITE + lc.wolfBooksSession + "\n" +
+ EnumChatFormatting.DARK_RED + lc.wolfEggsSession + "\n" +
+ EnumChatFormatting.GOLD + lc.wolfCouturesSession + "\n" +
+ EnumChatFormatting.AQUA + lc.wolfBaitsSession + "\n" +
+ EnumChatFormatting.DARK_PURPLE + lc.wolfFluxesSession + "\n" +
+ EnumChatFormatting.AQUA + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + bossesBetween;
+ } else if (ds.display.equals("spider")) {
+ if (lc.spiderTime == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = lc.getTimeBetween(lc.spiderTime, timeNow);
+ }
+ if (lc.spiderBosses == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(lc.spiderBosses);
+ }
+ if (tc.slayerCountTotal) {
+ drop20 = nf.format(lc.spiderTAP);
+ } else {
+ drop20 = nf.format(lc.spiderTAPDrops) + " times";
+ }
+
+ dropsText = EnumChatFormatting.GOLD + "Tarantulas Killed:\n" +
+ EnumChatFormatting.GREEN + "Tarantula Webs:\n" +
+ EnumChatFormatting.DARK_GREEN + "Arrow Poison:\n" +
+ EnumChatFormatting.DARK_GRAY + "Bite Runes:\n" +
+ EnumChatFormatting.WHITE + "Bane VI Books:\n" +
+ EnumChatFormatting.AQUA + "Spider Catalysts:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Tarantula Talismans:\n" +
+ EnumChatFormatting.LIGHT_PURPLE + "Fly Swatters:\n" +
+ EnumChatFormatting.GOLD + "Digested Mosquitos:\n" +
+ EnumChatFormatting.AQUA + "Time Since RNG:\n" +
+ EnumChatFormatting.AQUA + "Bosses Since RNG:";
+ countText = EnumChatFormatting.GOLD + nf.format(lc.spiderTarantulas) + "\n" +
+ EnumChatFormatting.GREEN + nf.format(lc.spiderWebs) + "\n" +
+ EnumChatFormatting.DARK_GREEN + drop20 + "\n" +
+ EnumChatFormatting.DARK_GRAY + lc.spiderBites + "\n" +
+ EnumChatFormatting.WHITE + lc.spiderBooks + "\n" +
+ EnumChatFormatting.AQUA + lc.spiderCatalysts + "\n" +
+ EnumChatFormatting.DARK_PURPLE + lc.spiderTalismans + "\n" +
+ EnumChatFormatting.LIGHT_PURPLE + lc.spiderSwatters + "\n" +
+ EnumChatFormatting.GOLD + lc.spiderMosquitos + "\n" +
+ EnumChatFormatting.AQUA + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + bossesBetween;
+ } else if (ds.display.equals("spider_session")) {
+ if (lc.spiderTimeSession == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = lc.getTimeBetween(lc.spiderTimeSession, timeNow);
+ }
+ if (lc.spiderBossesSession == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(lc.spiderBossesSession);
+ }
+ if (tc.slayerCountTotal) {
+ drop20 = nf.format(lc.spiderTAPSession);
+ } else {
+ drop20 = nf.format(lc.spiderTAPDropsSession) + " times";
+ }
+
+ dropsText = EnumChatFormatting.GOLD + "Tarantulas Killed:\n" +
+ EnumChatFormatting.GREEN + "Tarantula Webs:\n" +
+ EnumChatFormatting.DARK_GREEN + "Arrow Poison:\n" +
+ EnumChatFormatting.DARK_GRAY + "Bite Runes:\n" +
+ EnumChatFormatting.WHITE + "Bane VI Books:\n" +
+ EnumChatFormatting.AQUA + "Spider Catalysts:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Tarantula Talismans:\n" +
+ EnumChatFormatting.LIGHT_PURPLE + "Fly Swatters:\n" +
+ EnumChatFormatting.GOLD + "Digested Mosquitos:\n" +
+ EnumChatFormatting.AQUA + "Time Since RNG:\n" +
+ EnumChatFormatting.AQUA + "Bosses Since RNG:";
+ countText = EnumChatFormatting.GOLD + nf.format(lc.spiderTarantulasSession) + "\n" +
+ EnumChatFormatting.GREEN + nf.format(lc.spiderWebsSession) + "\n" +
+ EnumChatFormatting.DARK_GREEN + drop20 + "\n" +
+ EnumChatFormatting.DARK_GRAY + lc.spiderBitesSession + "\n" +
+ EnumChatFormatting.WHITE + lc.spiderBooksSession + "\n" +
+ EnumChatFormatting.AQUA + lc.spiderCatalystsSession + "\n" +
+ EnumChatFormatting.DARK_PURPLE + lc.spiderTalismansSession + "\n" +
+ EnumChatFormatting.LIGHT_PURPLE + lc.spiderSwattersSession + "\n" +
+ EnumChatFormatting.GOLD + lc.spiderMosquitosSession + "\n" +
+ EnumChatFormatting.AQUA + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + bossesBetween;
+ } else if (ds.display.equals("zombie")) {
+ if (lc.zombieTime == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = lc.getTimeBetween(lc.zombieTime, timeNow);
+ }
+ if (lc.zombieBosses == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(lc.zombieBosses);
+ }
+ if (tc.slayerCountTotal) {
+ drop20 = nf.format(lc.zombieFoulFlesh);
+ } else {
+ drop20 = nf.format(lc.zombieFoulFleshDrops) + " times";
+ }
+
+ dropsText = EnumChatFormatting.GOLD + "Revs Killed:\n" +
+ EnumChatFormatting.GREEN + "Revenant Flesh:\n" +
+ EnumChatFormatting.BLUE + "Foul Flesh:\n" +
+ EnumChatFormatting.DARK_GREEN + "Pestilence Runes:\n" +
+ EnumChatFormatting.WHITE + "Smite VI Books:\n" +
+ EnumChatFormatting.AQUA + "Undead Catalysts:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Beheaded Horrors:\n" +
+ EnumChatFormatting.RED + "Revenant Catalysts:\n" +
+ EnumChatFormatting.DARK_GREEN + "Snake Runes:\n" +
+ EnumChatFormatting.GOLD + "Scythe Blades:\n" +
+ EnumChatFormatting.AQUA + "Time Since RNG:\n" +
+ EnumChatFormatting.AQUA + "Bosses Since RNG:";
+ countText = EnumChatFormatting.GOLD + nf.format(lc.zombieRevs) + "\n" +
+ EnumChatFormatting.GREEN + nf.format(lc.zombieRevFlesh) + "\n" +
+ EnumChatFormatting.BLUE + drop20 + "\n" +
+ EnumChatFormatting.DARK_GREEN + lc.zombiePestilences + "\n" +
+ EnumChatFormatting.WHITE + lc.zombieBooks + "\n" +
+ EnumChatFormatting.AQUA + lc.zombieUndeadCatas + "\n" +
+ EnumChatFormatting.DARK_PURPLE + lc.zombieBeheadeds + "\n" +
+ EnumChatFormatting.RED + lc.zombieRevCatas + "\n" +
+ EnumChatFormatting.DARK_GREEN + lc.zombieSnakes + "\n" +
+ EnumChatFormatting.GOLD + lc.zombieScythes + "\n" +
+ EnumChatFormatting.AQUA + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + bossesBetween;
+ } else if (ds.display.equals("zombie_session")) {
+ if (lc.zombieTimeSession == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = lc.getTimeBetween(lc.zombieTimeSession, timeNow);
+ }
+ if (lc.zombieBossesSession == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(lc.zombieBossesSession);
+ }
+ if (tc.slayerCountTotal) {
+ drop20 = nf.format(lc.zombieFoulFleshSession);
+ } else {
+ drop20 = nf.format(lc.zombieFoulFleshDropsSession) + " times";
+ }
+
+ dropsText = EnumChatFormatting.GOLD + "Revs Killed:\n" +
+ EnumChatFormatting.GREEN + "Revenant Flesh:\n" +
+ EnumChatFormatting.BLUE + "Foul Flesh:\n" +
+ EnumChatFormatting.DARK_GREEN + "Pestilence Runes:\n" +
+ EnumChatFormatting.WHITE + "Smite VI Books:\n" +
+ EnumChatFormatting.AQUA + "Undead Catalysts:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Beheaded Horrors:\n" +
+ EnumChatFormatting.RED + "Revenant Catalysts:\n" +
+ EnumChatFormatting.DARK_GREEN + "Snake Runes:\n" +
+ EnumChatFormatting.GOLD + "Scythe Blades:\n" +
+ EnumChatFormatting.AQUA + "Time Since RNG:\n" +
+ EnumChatFormatting.AQUA + "Bosses Since RNG:";
+ countText = EnumChatFormatting.GOLD + nf.format(lc.zombieRevsSession) + "\n" +
+ EnumChatFormatting.GREEN + nf.format(lc.zombieRevFleshSession) + "\n" +
+ EnumChatFormatting.BLUE + drop20 + "\n" +
+ EnumChatFormatting.DARK_GREEN + lc.zombiePestilencesSession + "\n" +
+ EnumChatFormatting.WHITE + lc.zombieBooksSession + "\n" +
+ EnumChatFormatting.AQUA + lc.zombieUndeadCatasSession + "\n" +
+ EnumChatFormatting.DARK_PURPLE + lc.zombieBeheadedsSession + "\n" +
+ EnumChatFormatting.RED + lc.zombieRevCatasSession + "\n" +
+ EnumChatFormatting.DARK_GREEN + lc.zombieSnakesSession + "\n" +
+ EnumChatFormatting.GOLD + lc.zombieScythes + "\n" +
+ EnumChatFormatting.AQUA + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + bossesBetween;
+ } else if (ds.display.equals("fishing")) {
+ if (lc.empTime == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = lc.getTimeBetween(lc.empTime, timeNow);
+ }
+ if (lc.empSCs == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(lc.empSCs);
+ }
+
+ dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" +
+ EnumChatFormatting.AQUA + "Fishing Milestone:\n" +
+ EnumChatFormatting.GOLD + "Good Catches:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" +
+ EnumChatFormatting.GRAY + "Squids:\n" +
+ EnumChatFormatting.GREEN + "Sea Walkers:\n" +
+ EnumChatFormatting.DARK_GRAY + "Night Squids:\n" +
+ EnumChatFormatting.DARK_AQUA + "Sea Guardians:\n" +
+ EnumChatFormatting.BLUE + "Sea Witches:\n" +
+ EnumChatFormatting.GREEN + "Sea Archers:";
+ countText = EnumChatFormatting.AQUA + nf.format(lc.seaCreatures) + "\n" +
+ EnumChatFormatting.AQUA + nf.format(lc.fishingMilestone) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.goodCatches) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + nf.format(lc.greatCatches) + "\n" +
+ EnumChatFormatting.GRAY + nf.format(lc.squids) + "\n" +
+ EnumChatFormatting.GREEN + nf.format(lc.seaWalkers) + "\n" +
+ EnumChatFormatting.DARK_GRAY + nf.format(lc.nightSquids) + "\n" +
+ EnumChatFormatting.DARK_AQUA + nf.format(lc.seaGuardians) + "\n" +
+ EnumChatFormatting.BLUE + nf.format(lc.seaWitches) + "\n" +
+ EnumChatFormatting.GREEN + nf.format(lc.seaArchers);
+ // Seperated to save vertical space
+ String dropsTextTwo = EnumChatFormatting.GREEN + "Monster of Deeps:\n" +
+ EnumChatFormatting.YELLOW + "Catfishes:\n" +
+ EnumChatFormatting.GOLD + "Carrot Kings:\n" +
+ EnumChatFormatting.GRAY + "Sea Leeches:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Guardian Defenders:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Deep Sea Protectors:\n" +
+ EnumChatFormatting.GOLD + "Hydras:\n" +
+ EnumChatFormatting.GOLD + "Sea Emperors:\n" +
+ EnumChatFormatting.AQUA + "Time Since Emp:\n" +
+ EnumChatFormatting.AQUA + "Creatures Since Emp:";
+ String countTextTwo = EnumChatFormatting.GREEN + nf.format(lc.monsterOfTheDeeps) + "\n" +
+ EnumChatFormatting.YELLOW + nf.format(lc.catfishes) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.carrotKings) + "\n" +
+ EnumChatFormatting.GRAY + nf.format(lc.seaLeeches) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + nf.format(lc.guardianDefenders) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + nf.format(lc.deepSeaProtectors) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.hydras) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.seaEmperors) + "\n" +
+ EnumChatFormatting.AQUA + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + bossesBetween;
+
+ new TextRenderer(Minecraft.getMinecraft(), dropsTextTwo, (int) (moc.displayXY[0] + (145 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale);
+ new TextRenderer(Minecraft.getMinecraft(), countTextTwo, (int) (moc.displayXY[0] + (255 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale);
+ } else if (ds.display.equals("fishing_session")) {
+ if (lc.empTimeSession == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = lc.getTimeBetween(lc.empTimeSession, timeNow);
+ }
+ if (lc.empSCsSession == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(lc.empSCsSession);
+ }
+
+ dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" +
+ EnumChatFormatting.AQUA + "Fishing Milestone:\n" +
+ EnumChatFormatting.GOLD + "Good Catches:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" +
+ EnumChatFormatting.GRAY + "Squids:\n" +
+ EnumChatFormatting.GREEN + "Sea Walkers:\n" +
+ EnumChatFormatting.DARK_GRAY + "Night Squids:\n" +
+ EnumChatFormatting.DARK_AQUA + "Sea Guardians:\n" +
+ EnumChatFormatting.BLUE + "Sea Witches:\n" +
+ EnumChatFormatting.GREEN + "Sea Archers:";
+ countText = EnumChatFormatting.AQUA + nf.format(lc.seaCreaturesSession) + "\n" +
+ EnumChatFormatting.AQUA + nf.format(lc.fishingMilestoneSession) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.goodCatchesSession) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + nf.format(lc.greatCatchesSession) + "\n" +
+ EnumChatFormatting.GRAY + nf.format(lc.squidsSession) + "\n" +
+ EnumChatFormatting.GREEN + nf.format(lc.seaWalkersSession) + "\n" +
+ EnumChatFormatting.DARK_GRAY + nf.format(lc.nightSquidsSession) + "\n" +
+ EnumChatFormatting.DARK_AQUA + nf.format(lc.seaGuardiansSession) + "\n" +
+ EnumChatFormatting.BLUE + nf.format(lc.seaWitchesSession) + "\n" +
+ EnumChatFormatting.GREEN + nf.format(lc.seaArchersSession);
+ // Seperated to save vertical space
+ String dropsTextTwo = EnumChatFormatting.GREEN + "Monster of Deeps:\n" +
+ EnumChatFormatting.YELLOW + "Catfishes:\n" +
+ EnumChatFormatting.GOLD + "Carrot Kings:\n" +
+ EnumChatFormatting.GRAY + "Sea Leeches:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Guardian Defenders:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Deep Sea Protectors:\n" +
+ EnumChatFormatting.GOLD + "Hydras:\n" +
+ EnumChatFormatting.GOLD + "Sea Emperors:\n" +
+ EnumChatFormatting.AQUA + "Time Since Emp:\n" +
+ EnumChatFormatting.AQUA + "Creatures Since Emp:";
+ String countTextTwo = EnumChatFormatting.GREEN + nf.format(lc.monsterOfTheDeepsSession) + "\n" +
+ EnumChatFormatting.YELLOW + nf.format(lc.catfishesSession) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.carrotKingsSession) + "\n" +
+ EnumChatFormatting.GRAY + nf.format(lc.seaLeechesSession) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + nf.format(lc.guardianDefendersSession) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + nf.format(lc.deepSeaProtectorsSession) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.hydrasSession) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.seaEmperorsSession) + "\n" +
+ EnumChatFormatting.AQUA + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + bossesBetween;
+
+ new TextRenderer(Minecraft.getMinecraft(), dropsTextTwo, (int) (moc.displayXY[0] + (145 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale);
+ new TextRenderer(Minecraft.getMinecraft(), countTextTwo, (int) (moc.displayXY[0] + (255 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale);
+ } else if (ds.display.equals("fishing_winter")) {
+ dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" +
+ EnumChatFormatting.AQUA + "Fishing Milestone:\n" +
+ EnumChatFormatting.GOLD + "Good Catches:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" +
+ EnumChatFormatting.AQUA + "Frozen Steves:\n" +
+ EnumChatFormatting.WHITE + "Snowmans:\n" +
+ EnumChatFormatting.DARK_GREEN + "Grinches:\n" +
+ EnumChatFormatting.GOLD + "Yetis:";
+ countText = EnumChatFormatting.AQUA + nf.format(lc.seaCreatures) + "\n" +
+ EnumChatFormatting.AQUA + nf.format(lc.fishingMilestone) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.goodCatches) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + nf.format(lc.greatCatches) + "\n" +
+ EnumChatFormatting.AQUA + nf.format(lc.frozenSteves) + "\n" +
+ EnumChatFormatting.WHITE + nf.format(lc.frostyTheSnowmans) + "\n" +
+ EnumChatFormatting.DARK_GREEN + nf.format(lc.grinches) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.yetis);
+ } else if (ds.display.equals("fishing_winter_session")) {
+ dropsText = EnumChatFormatting.AQUA + "Creatures Caught:\n" +
+ EnumChatFormatting.AQUA + "Fishing Milestone:\n" +
+ EnumChatFormatting.GOLD + "Good Catches:\n" +
+ EnumChatFormatting.DARK_PURPLE + "Great Catches:\n" +
+ EnumChatFormatting.AQUA + "Frozen Steves:\n" +
+ EnumChatFormatting.WHITE + "Snowmans:\n" +
+ EnumChatFormatting.DARK_GREEN + "Grinches:\n" +
+ EnumChatFormatting.GOLD + "Yetis:";
+ countText = EnumChatFormatting.AQUA + nf.format(lc.seaCreaturesSession) + "\n" +
+ EnumChatFormatting.AQUA + nf.format(lc.fishingMilestoneSession) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.goodCatchesSession) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + nf.format(lc.greatCatchesSession) + "\n" +
+ EnumChatFormatting.AQUA + nf.format(lc.frozenStevesSession) + "\n" +
+ EnumChatFormatting.WHITE + nf.format(lc.frostyTheSnowmansSession) + "\n" +
+ EnumChatFormatting.DARK_GREEN + nf.format(lc.grinchesSession) + "\n" +
+ EnumChatFormatting.GOLD + nf.format(lc.yetisSession);
+ } else {
+ ConfigHandler cf = new ConfigHandler();
+
+ System.out.println("Display was an unknown value, turning off.");
+ ds.display = "off";
+ cf.writeStringConfig("misc", "display", "off");
+ }
+ new TextRenderer(Minecraft.getMinecraft(), dropsText, moc.displayXY[0], moc.displayXY[1], ScaleCommand.displayScale);
+ new TextRenderer(Minecraft.getMinecraft(), countText, (int) (moc.displayXY[0] + (110 * ScaleCommand.displayScale)), moc.displayXY[1], ScaleCommand.displayScale);
+ }
+
+ if (showTitle) {
+ Utils.drawTitle(titleText);
+ }
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onSound(final PlaySoundEvent event) {
+ if (event.name.equals("note.pling")) {
+ // Don't check twice within 3 seconds
+ checkItemsNow = System.currentTimeMillis() / 1000;
+ if (checkItemsNow - itemsChecked < 3) return;
+
+ final ScoreboardHandler sc = new ScoreboardHandler();
+ List<String> scoreboard = sc.getSidebarLines();
+
+ for (String line : scoreboard) {
+ String cleanedLine = sc.cleanSB(line);
+ // If Hypixel lags and scoreboard doesn't update
+ if (cleanedLine.contains("Boss slain!") || cleanedLine.contains("Slay the boss!")) {
+ final LootCommand lc = new LootCommand();
+ final ConfigHandler cf = new ConfigHandler();
+
+ 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");
+
+ // If no items, are detected, allow check again. Should fix items not being found
+ if (itemTeeth + itemWheels + itemWebs + itemTAP + itemRev + itemFoul > 0) {
+ itemsChecked = System.currentTimeMillis() / 1000;
+ lc.wolfTeeth += itemTeeth;
+ lc.wolfWheels += itemWheels;
+ lc.spiderWebs += itemWebs;
+ lc.spiderTAP += itemTAP;
+ lc.zombieRevFlesh += itemRev;
+ lc.zombieFoulFlesh += itemFoul;
+ lc.wolfTeethSession += itemTeeth;
+ lc.wolfWheelsSession += itemWheels;
+ lc.spiderWebsSession += itemWebs;
+ lc.spiderTAPSession += itemTAP;
+ lc.zombieRevFleshSession += itemRev;
+ lc.zombieFoulFleshSession += itemFoul;
+
+ cf.writeIntConfig("wolf", "teeth", lc.wolfTeeth);
+ cf.writeIntConfig("wolf", "wheel", lc.wolfWheels);
+ cf.writeIntConfig("spider", "web", lc.spiderWebs);
+ cf.writeIntConfig("spider", "tap", lc.spiderTAP);
+ cf.writeIntConfig("zombie", "revFlesh", lc.zombieRevFlesh);
+ cf.writeIntConfig("zombie", "foulFlesh", lc.zombieFoulFlesh);
+ }
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onTooltip(ItemTooltipEvent event) {
+ final ToggleCommand tc = new ToggleCommand();
+
+ if (event.toolTip == null) return;
+ if (tc.goldenToggled) {
+ for (int i = 0; i < event.toolTip.size(); i++) {
+ event.toolTip.set(i, Utils.returnGoldenEnchants(event.toolTip.get(i)));
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onTick(TickEvent.ClientTickEvent event) {
+ if (titleTimer >= 0) {
+ if (titleTimer == 0) {
+ showTitle = false;
+ }
+ titleTimer--;
+ }
+ }
+
+ public void increaseEmpSC() {
+ LootCommand lc = new LootCommand();
+ ConfigHandler cf = new ConfigHandler();
+
+ if (lc.empSCs != -1) {
+ lc.empSCs++;
+ }
+ if (lc.empSCsSession != -1) {
+ lc.empSCsSession++;
+ }
+
+ cf.writeIntConfig("fishing", "empSC", lc.empSCs);
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/ArmourCommand.java b/src/main/java/me/Danker/commands/ArmourCommand.java
new file mode 100644
index 0000000..255825c
--- /dev/null
+++ b/src/main/java/me/Danker/commands/ArmourCommand.java
@@ -0,0 +1,150 @@
+package me.Danker.commands;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Base64;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.gson.JsonObject;
+
+import me.Danker.handlers.APIHandler;
+import me.Danker.handlers.ConfigHandler;
+import me.Danker.utils.Utils;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.CompressedStreamTools;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class ArmourCommand extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "armor";
+ }
+
+ @Override
+ public List<String> getCommandAliases()
+ {
+ return Collections.singletonList("armour");
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " [name]";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return Utils.getMatchingPlayers(args[0]);
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ // MULTI THREAD DRIFTING
+ new Thread(() -> {
+ APIHandler ah = new APIHandler();
+ ConfigHandler cf = new ConfigHandler();
+ EntityPlayer player = (EntityPlayer) arg0;
+
+ // Check key
+ String key = cf.getString("api", "APIKey");
+ if (key.equals("")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey."));
+ }
+
+ // Get UUID for Hypixel API requests
+ String username;
+ String uuid;
+ if (arg1.length == 0) {
+ username = player.getName();
+ uuid = player.getUniqueID().toString().replaceAll("[\\-]", "");
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking armour of " + EnumChatFormatting.DARK_GREEN + username));
+ } else {
+ username = arg1[0];
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking armour of " + EnumChatFormatting.DARK_GREEN + username));
+ uuid = ah.getUUID(username);
+ }
+
+ // Find stats of latest profile
+ String latestProfile = ah.getLatestProfileID(uuid, key);
+ if (latestProfile == null) return;
+
+ String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key;
+ System.out.println("Fetching profile...");
+ JsonObject profileResponse = ah.getResponse(profileURL);
+ if (!profileResponse.get("success").getAsBoolean()) {
+ String reason = profileResponse.get("cause").getAsString();
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason));
+ return;
+ }
+
+ String armourBase64 = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("inv_armor").getAsJsonObject().get("data").getAsString();
+ InputStream armourStream = new ByteArrayInputStream(Base64.getDecoder().decode(armourBase64));
+ // String armourDecodedGZIP = new String(Base64.getDecoder().decode(armourBase64));
+
+ try {
+ NBTTagCompound armour = CompressedStreamTools.readCompressed(armourStream);
+ NBTTagList armourList = armour.getTagList("i", 10);
+
+ String helmet = EnumChatFormatting.RED + "None";
+ String chest = EnumChatFormatting.RED + "None";
+ String legs = EnumChatFormatting.RED + "None";
+ String boots = EnumChatFormatting.RED + "None";
+ // Loop through armour
+ for (int i = 0; i < armourList.tagCount(); i++) {
+ NBTTagCompound armourPiece = armourList.getCompoundTagAt(i);
+ if (armourPiece.hasNoTags()) continue;
+
+ String armourPieceName = armourPiece.getCompoundTag("tag").getCompoundTag("display").getString("Name");
+ // NBT is served boots -> helmet
+ switch (i) {
+ case 0:
+ boots = armourPieceName;
+ break;
+ case 1:
+ legs = armourPieceName;
+ break;
+ case 2:
+ chest = armourPieceName;
+ break;
+ case 3:
+ helmet = armourPieceName;
+ break;
+ default:
+ System.err.println("An error has occurred.");
+ break;
+ }
+ }
+ armourStream.close();
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.AQUA + " " + username + "'s Armour:\n" +
+ EnumChatFormatting.GREEN + " Helmet: " + helmet + "\n" +
+ EnumChatFormatting.GREEN + " Chestplate: " + chest + "\n" +
+ EnumChatFormatting.GREEN + " Leggings: " + legs + "\n" +
+ EnumChatFormatting.GREEN + " Boots: " + boots + "\n" +
+ EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------"));
+ } catch (IOException ex) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occurred while reading inventory data. See logs for more info."));
+ System.err.println(ex);
+ }
+ }).start();
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/BankCommand.java b/src/main/java/me/Danker/commands/BankCommand.java
new file mode 100644
index 0000000..e32e66f
--- /dev/null
+++ b/src/main/java/me/Danker/commands/BankCommand.java
@@ -0,0 +1,115 @@
+package me.Danker.commands;
+
+import java.text.NumberFormat;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.gson.JsonObject;
+
+import me.Danker.handlers.APIHandler;
+import me.Danker.handlers.ConfigHandler;
+import me.Danker.utils.Utils;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class BankCommand extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "bank";
+ }
+
+ @Override
+ public List<String> getCommandAliases()
+ {
+ return Collections.singletonList("purse");
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " [name]";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return Utils.getMatchingPlayers(args[0]);
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ // MULTI THREAD DRIFTING
+ new Thread(() -> {
+ APIHandler ah = new APIHandler();
+ ConfigHandler cf = new ConfigHandler();
+ EntityPlayer player = (EntityPlayer) arg0;
+
+ // Check key
+ String key = cf.getString("api", "APIKey");
+ if (key.equals("")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey."));
+ }
+
+ // Get UUID for Hypixel API requests
+ String username;
+ String uuid;
+ if (arg1.length == 0) {
+ username = player.getName();
+ uuid = player.getUniqueID().toString().replaceAll("[\\-]", "");
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking coins of " + EnumChatFormatting.DARK_GREEN + username));
+ } else {
+ username = arg1[0];
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking coins of " + EnumChatFormatting.DARK_GREEN + username));
+ uuid = ah.getUUID(username);
+ }
+
+ // Find stats of latest profile
+ String latestProfile = ah.getLatestProfileID(uuid, key);
+ if (latestProfile == null) return;
+
+ String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key;
+ System.out.println("Fetching profile...");
+ JsonObject profileResponse = ah.getResponse(profileURL);
+ if (!profileResponse.get("success").getAsBoolean()) {
+ String reason = profileResponse.get("cause").getAsString();
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason));
+ return;
+ }
+
+ System.out.println("Fetching bank + purse coins...");
+ double purseCoins = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("coin_purse").getAsDouble();
+ purseCoins = (double) Math.floor(purseCoins * 100.0) / 100.0;
+
+ // Check for bank api
+ if (profileResponse.get("profile").getAsJsonObject().has("banking")) {
+ double bankCoins = profileResponse.get("profile").getAsJsonObject().get("banking").getAsJsonObject().get("balance").getAsDouble();
+ bankCoins = (double) Math.floor(bankCoins * 100.0) / 100.0;
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.AQUA + " " + username + "'s Coins:\n" +
+ EnumChatFormatting.GREEN + " Bank: " + EnumChatFormatting.GOLD + NumberFormat.getInstance().format(bankCoins) + "\n" +
+ EnumChatFormatting.GREEN + " Purse: " + EnumChatFormatting.GOLD + NumberFormat.getInstance().format(purseCoins) + "\n" +
+ EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------"));
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.AQUA + " " + username + "'s Coins:\n" +
+ EnumChatFormatting.GREEN + " Bank: " + EnumChatFormatting.RED + "Bank API disabled.\n" +
+ EnumChatFormatting.GREEN + " Purse: " + EnumChatFormatting.GOLD + NumberFormat.getInstance().format(purseCoins) + "\n" +
+ EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------"));
+ }
+ }).start();
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java
new file mode 100644
index 0000000..9ca6a6e
--- /dev/null
+++ b/src/main/java/me/Danker/commands/DHelpCommand.java
@@ -0,0 +1,52 @@
+package me.Danker.commands;
+
+import me.Danker.TheMod;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class DHelpCommand extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "dhelp";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName();
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ EntityPlayer player = (EntityPlayer) arg0;
+
+ player.addChatMessage(new ChatComponentText("\n" + EnumChatFormatting.GOLD + " " + TheMod.MODID + " Version " + TheMod.VERSION + "\n" +
+ EnumChatFormatting.AQUA + " <> = Mandatory parameter. [] = Optional parameter.\n" +
+ EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" +
+ EnumChatFormatting.GOLD + " /toggle <gparty/coords/golden/slayercount/list>" + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" +
+ EnumChatFormatting.GOLD + " /setkey <key>" + EnumChatFormatting.AQUA + " - Sets API key.\n" +
+ EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey.\n" +
+ EnumChatFormatting.GOLD + " /loot <zombie/spider/wolf/fishing> [winter/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" +
+ EnumChatFormatting.GOLD + " /display <zombie/spider/wolf/fishing/off> [winter/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead.\n" +
+ EnumChatFormatting.GOLD + " /resetloot <zombie/spider/wolf/fishing/confirm/cancel>" + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" +
+ EnumChatFormatting.GOLD + " /move <coords/display> <x> <y>" + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" +
+ EnumChatFormatting.GOLD + " /scale <coords/display> <scale (0.1 - 10)" + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" +
+ EnumChatFormatting.GOLD + " /slayer [player]" + EnumChatFormatting.AQUA + " - Uses API to get slayer xp of a person. If no name is provided, it checks yours.\n" +
+ EnumChatFormatting.GOLD + " /skills [player]" + EnumChatFormatting.AQUA + " - Uses API to get skill levels of a person. If no name is provided, it checks yours.\n" +
+ EnumChatFormatting.GOLD + " /guildof [player]" + EnumChatFormatting.AQUA + " - Uses API to get guild name and guild master of a person. If no name is provided, it checks yours.\n" +
+ EnumChatFormatting.GOLD + " /petsof [player]" + EnumChatFormatting.AQUA + " - Uses API to get pets of a person. If no name is provided, it checks yours.\n" +
+ EnumChatFormatting.GOLD + " /bank [player]" + EnumChatFormatting.AQUA + " - Uses API to get bank and purse coins of a person. If no name is provided, it checks yours.\n" +
+ EnumChatFormatting.GOLD + " /armor [player]" + EnumChatFormatting.AQUA + " - Uses API to get armour of a person. If no name is provided, it checks yours.\n" +
+ EnumChatFormatting.GOLD + " /importfishing" + EnumChatFormatting.AQUA + " - Imports your fishing stats from your latest profile to your fishing tracker using the API.\n"));
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java
new file mode 100644
index 0000000..916245e
--- /dev/null
+++ b/src/main/java/me/Danker/commands/DisplayCommand.java
@@ -0,0 +1,108 @@
+package me.Danker.commands;
+
+import java.util.List;
+
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class DisplayCommand extends CommandBase {
+ public static String display;
+
+ @Override
+ public String getCommandName() {
+ return "display";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " <zombie/spider/wolf/fishing/off> [winter/session]";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing", "off");
+ } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) {
+ return getListOfStringsMatchingLastWord(args, "winter", "session");
+ } else if (args.length == 2 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) {
+ return getListOfStringsMatchingLastWord(args, "session");
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer) arg0;
+
+ if (arg1.length == 0) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display <zombie/spider/wolf/fishing/off> [winter/session]"));
+ return;
+ }
+
+ final ConfigHandler cf = new ConfigHandler();
+ boolean showSession = false;
+
+ if (arg1.length > 1) {
+ if (arg1[1].equalsIgnoreCase("session")) {
+ showSession = true;
+ } else if (arg1.length > 2) {
+ if (arg1[2].equalsIgnoreCase("session")) {
+ showSession = true;
+ }
+ }
+ }
+
+ if (arg1[0].equalsIgnoreCase("wolf")) {
+ if (showSession) {
+ display = "wolf_session";
+ } else {
+ display = "wolf";
+ }
+ } else if (arg1[0].equalsIgnoreCase("spider")) {
+ if (showSession) {
+ display = "spider_session";
+ } else {
+ display = "spider";
+ }
+ } else if (arg1[0].equalsIgnoreCase("zombie")) {
+ if (showSession) {
+ display = "zombie_session";
+ } else {
+ display = "zombie";
+ }
+ } else if (arg1[0].equalsIgnoreCase("fishing")) {
+ if (arg1.length > 1 && arg1[1].equalsIgnoreCase("winter")) {
+ if (showSession) {
+ display = "fishing_winter_session";
+ } else {
+ display = "fishing_winter";
+ }
+ } else {
+ if (showSession) {
+ display = "fishing_session";
+ } else {
+ display = "fishing";
+ }
+ }
+ } else if (arg1[0].equalsIgnoreCase("off")) {
+ display = "off";
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /display <zombie/spider/wolf/fishing/off> [winter/session]"));
+ return;
+ }
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display set to " + EnumChatFormatting.DARK_GREEN + display + EnumChatFormatting.GREEN + "."));
+ cf.writeStringConfig("misc", "display", display);
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/GetkeyCommand.java b/src/main/java/me/Danker/commands/GetkeyCommand.java
new file mode 100644
index 0000000..80354fe
--- /dev/null
+++ b/src/main/java/me/Danker/commands/GetkeyCommand.java
@@ -0,0 +1,41 @@
+package me.Danker.commands;
+
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class GetkeyCommand extends CommandBase implements ICommand {
+
+ @Override
+ public String getCommandName() {
+ return "getkey";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName();
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer)arg0;
+ final ConfigHandler cf = new ConfigHandler();
+
+ if (cf.getString("api", "APIKey").equals("")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Set your API key using /setkey."));
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Your set API key is " + EnumChatFormatting.DARK_GREEN + cf.getString("api", "APIKey")));
+ }
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/GuildOfCommand.java b/src/main/java/me/Danker/commands/GuildOfCommand.java
new file mode 100644
index 0000000..238ba81
--- /dev/null
+++ b/src/main/java/me/Danker/commands/GuildOfCommand.java
@@ -0,0 +1,116 @@
+package me.Danker.commands;
+
+import java.util.List;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+import me.Danker.handlers.APIHandler;
+import me.Danker.handlers.ConfigHandler;
+import me.Danker.utils.Utils;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class GuildOfCommand extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "guildof";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " [name]";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return Utils.getMatchingPlayers(args[0]);
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ // MULTI THREAD DRIFTING
+ new Thread(() -> {
+ APIHandler ah = new APIHandler();
+ ConfigHandler cf = new ConfigHandler();
+ EntityPlayer player = (EntityPlayer) arg0;
+
+ // Check key
+ String key = cf.getString("api", "APIKey");
+ if (key.equals("")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey."));
+ }
+
+ // Get UUID for Hypixel API requests
+ String username;
+ String uuid;
+ if (arg1.length == 0) {
+ username = player.getName();
+ uuid = player.getUniqueID().toString().replaceAll("[\\-]", "");
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking guild of " + EnumChatFormatting.DARK_GREEN + username));
+ } else {
+ username = arg1[0];
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking guild of " + EnumChatFormatting.DARK_GREEN + username));
+ uuid = ah.getUUID(username);
+ }
+
+ // Find guild ID
+ System.out.println("Fetching guild...");
+ String guildURL = "https://api.hypixel.net/guild?player=" + uuid + "&key=" + key;
+ JsonObject guildResponse = ah.getResponse(guildURL);
+ if (!guildResponse.get("success").getAsBoolean()) {
+ String reason = guildResponse.get("cause").getAsString();
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason));
+ return;
+ }
+
+ System.out.println("Fetching guild stats and members...");
+
+ String guildName = "N/A";
+ String guildMaster = "N/A";
+ // Check if player is in guild
+ if (!guildResponse.get("guild").isJsonNull()) {
+ guildName = guildResponse.get("guild").getAsJsonObject().get("name").getAsString();
+
+ // Loop through members to find guildmaster
+ JsonArray guildMembers = guildResponse.get("guild").getAsJsonObject().get("members").getAsJsonArray();
+ for (JsonElement member : guildMembers) {
+ JsonObject memberObject = member.getAsJsonObject();
+ String memberRank = memberObject.get("rank").getAsString();
+
+ if (memberRank.equals("GUILDMASTER") || memberRank.equals("Guild Master")) {
+ // Get username from UUID
+ String gmUUID = memberObject.get("uuid").getAsString();
+ String gmNameURL = "https://api.mojang.com/user/profiles/" + gmUUID + "/names";
+ JsonArray gmNameResponse = ah.getArrayResponse(gmNameURL);
+
+ guildMaster = gmNameResponse.get(gmNameResponse.size() - 1).getAsJsonObject().get("name").getAsString();
+ break;
+ }
+ }
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.AQUA + " " + username + "'s Guild:\n" +
+ EnumChatFormatting.GREEN + " Guild: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + guildName + "\n" +
+ EnumChatFormatting.GREEN + " Guildmaster: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + guildMaster + "\n" +
+ EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------"));
+ }).start();
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java
new file mode 100644
index 0000000..bbbcb9f
--- /dev/null
+++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java
@@ -0,0 +1,233 @@
+package me.Danker.commands;
+
+import com.google.gson.JsonObject;
+
+import me.Danker.handlers.APIHandler;
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class ImportFishingCommand extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "importfishing";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName();
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ // MULTI THREAD DRIFTING
+ new Thread(() -> {
+ APIHandler ah = new APIHandler();
+ LootCommand lc = new LootCommand();
+ ConfigHandler cf = new ConfigHandler();
+ EntityPlayer player = (EntityPlayer) arg0;
+
+ // Check key
+ String key = cf.getString("api", "APIKey");
+ if (key.equals("")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey."));
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Importing your fishing stats..."));
+
+ // Get UUID for Hypixel API requests
+ String username = player.getName();
+ String uuid = player.getUniqueID().toString().replaceAll("[\\-]", "");
+
+ String latestProfile = ah.getLatestProfileID(uuid, key);
+ if (latestProfile == null) return;
+
+ String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key;
+ System.out.println("Fetching profile...");
+ JsonObject profileResponse = ah.getResponse(profileURL);
+ if (!profileResponse.get("success").getAsBoolean()) {
+ String reason = profileResponse.get("cause").getAsString();
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason));
+ return;
+ }
+
+ System.out.println("Fetching fishing stats...");
+ JsonObject statsObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("stats").getAsJsonObject();
+
+ lc.greatCatches = 0;
+ lc.goodCatches = 0;
+ if (statsObject.has("items_fished_treasure")) {
+ if (statsObject.has("items_fished_large_treasure")) {
+ lc.greatCatches = statsObject.get("items_fished_large_treasure").getAsInt();
+ lc.goodCatches = statsObject.get("items_fished_treasure").getAsInt() - lc.greatCatches;
+ } else {
+ lc.goodCatches = statsObject.get("items_fished_treasure").getAsInt();
+ }
+ }
+
+ lc.seaCreatures = 0;
+ lc.squids = 0;
+ if (statsObject.has("kills_pond_squid")) {
+ lc.squids = statsObject.get("kills_pond_squid").getAsInt();
+ }
+ lc.seaCreatures += lc.squids;
+
+ lc.seaWalkers = 0;
+ if (statsObject.has("kills_sea_walker")) {
+ lc.seaWalkers = statsObject.get("kills_sea_walker").getAsInt();
+ }
+ lc.seaCreatures += lc.seaWalkers;
+
+ lc.nightSquids = 0;
+ if (statsObject.has("kills_night_squid")) {
+ lc.nightSquids = statsObject.get("kills_night_squid").getAsInt();
+ }
+ lc.seaCreatures += lc.nightSquids;
+
+ lc.seaGuardians = 0;
+ if (statsObject.has("kills_sea_guardian")) {
+ lc.seaGuardians = statsObject.get("kills_sea_guardian").getAsInt();
+ }
+ lc.seaCreatures += lc.seaGuardians;
+
+ lc.seaWitches = 0;
+ if (statsObject.has("kills_sea_witch")) {
+ lc.seaWitches = statsObject.get("kills_sea_witch").getAsInt();
+ }
+ lc.seaCreatures += lc.seaWitches;
+
+ lc.seaArchers = 0;
+ if (statsObject.has("kills_sea_archer")) {
+ lc.seaArchers = statsObject.get("kills_sea_archer").getAsInt();
+ }
+ lc.seaCreatures += lc.seaArchers;
+
+ lc.monsterOfTheDeeps = 0;
+ if (statsObject.has("kills_zombie_deep")) {
+ if (statsObject.has("kills_chicken_deep")) {
+ lc.monsterOfTheDeeps = statsObject.get("kills_zombie_deep").getAsInt() + statsObject.get("kills_chicken_deep").getAsInt();
+ } else {
+ lc.monsterOfTheDeeps = statsObject.get("kills_zombie_deep").getAsInt();
+ }
+ } else if (statsObject.has("kills_chicken_deep")) {
+ lc.monsterOfTheDeeps = statsObject.get("kills_chicken_deep").getAsInt();
+ }
+ lc.seaCreatures += lc.monsterOfTheDeeps;
+
+ lc.catfishes = 0;
+ if (statsObject.has("kills_catfish")) {
+ lc.catfishes = statsObject.get("kills_catfish").getAsInt();
+ }
+ lc.seaCreatures += lc.catfishes;
+
+ lc.carrotKings = 0;
+ if (statsObject.has("kills_carrot_king")) {
+ lc.carrotKings = statsObject.get("kills_carrot_king").getAsInt();
+ }
+ lc.seaCreatures += lc.carrotKings;
+
+ lc.seaLeeches = 0;
+ if (statsObject.has("kills_sea_leech")) {
+ lc.seaLeeches = statsObject.get("kills_sea_leech").getAsInt();
+ }
+ lc.seaCreatures += lc.seaLeeches;
+
+ lc.guardianDefenders = 0;
+ if (statsObject.has("kills_guardian_defender")) {
+ lc.guardianDefenders = statsObject.get("kills_guardian_defender").getAsInt();
+ }
+ lc.seaCreatures += lc.guardianDefenders;
+
+ lc.deepSeaProtectors = 0;
+ if (statsObject.has("kills_deep_sea_protector")) {
+ lc.deepSeaProtectors = statsObject.get("kills_deep_sea_protector").getAsInt();
+ }
+ lc.seaCreatures += lc.deepSeaProtectors;
+
+ lc.hydras = 0;
+ if (statsObject.has("kills_water_hydra")) {
+ // Hydra splits
+ lc.hydras = statsObject.get("kills_water_hydra").getAsInt() / 2;
+ }
+ lc.seaCreatures += lc.hydras;
+
+ lc.seaEmperors = 0;
+ if (statsObject.has("kills_skeleton_emperor")) {
+ if (statsObject.has("kills_guardian_emperor")) {
+ lc.seaEmperors = statsObject.get("kills_skeleton_emperor").getAsInt() + statsObject.get("kills_guardian_emperor").getAsInt();
+ } else {
+ lc.seaEmperors = statsObject.get("kills_skeleton_emperor").getAsInt();
+ }
+ } else if (statsObject.has("kills_guardian_emperor")) {
+ lc.seaEmperors = statsObject.get("kills_guardian_emperor").getAsInt();
+ }
+ lc.seaCreatures += lc.seaEmperors;
+
+ lc.fishingMilestone = 0;
+ if (statsObject.has("pet_milestone_sea_creatures_killed")) {
+ lc.fishingMilestone = statsObject.get("pet_milestone_sea_creatures_killed").getAsInt();
+ }
+
+ lc.frozenSteves = 0;
+ if (statsObject.has("kills_frozen_steve")) {
+ lc.frozenSteves = statsObject.get("kills_frozen_steve").getAsInt();
+ }
+ lc.seaCreatures += lc.frozenSteves;
+
+ lc.frostyTheSnowmans = 0;
+ if (statsObject.has("kills_frosty_the_snowman")) {
+ lc.frostyTheSnowmans = statsObject.get("kills_frosty_the_snowman").getAsInt();
+ }
+ lc.seaCreatures += lc.frostyTheSnowmans;
+
+ lc.grinches = 0;
+ if (statsObject.has("kills_grinch")) {
+ lc.grinches = statsObject.get("kills_grinch").getAsInt();
+ }
+ lc.seaCreatures += lc.grinches;
+
+ lc.yetis = 0;
+ if (statsObject.has("kills_yeti")) {
+ lc.yetis = statsObject.get("kills_yeti").getAsInt();
+ }
+ lc.seaCreatures += lc.yetis;
+
+ System.out.println("Writing to config...");
+ cf.writeIntConfig("fishing", "goodCatch", lc.goodCatches);
+ cf.writeIntConfig("fishing", "greatCatch", lc.greatCatches);
+ cf.writeIntConfig("fishing", "seaCreature", lc.seaCreatures);
+ cf.writeIntConfig("fishing", "squid", lc.squids);
+ cf.writeIntConfig("fishing", "seaWalker", lc.seaWalkers);
+ cf.writeIntConfig("fishing", "nightSquid", lc.nightSquids);
+ cf.writeIntConfig("fishing", "seaGuardian", lc.seaGuardians);
+ cf.writeIntConfig("fishing", "seaWitch", lc.seaWitches);
+ cf.writeIntConfig("fishing", "seaArcher", lc.seaArchers);
+ cf.writeIntConfig("fishing", "monsterOfDeep", lc.monsterOfTheDeeps);
+ cf.writeIntConfig("fishing", "catfish", lc.catfishes);
+ cf.writeIntConfig("fishing", "carrotKing", lc.carrotKings);
+ cf.writeIntConfig("fishing", "seaLeech", lc.seaLeeches);
+ cf.writeIntConfig("fishing", "guardianDefender", lc.guardianDefenders);
+ cf.writeIntConfig("fishing", "deepSeaProtector", lc.deepSeaProtectors);
+ cf.writeIntConfig("fishing", "hydra", lc.hydras);
+ cf.writeIntConfig("fishing", "seaEmperor", lc.seaEmperors);
+ cf.writeIntConfig("fishing", "milestone", lc.fishingMilestone);
+ cf.writeIntConfig("fishing", "frozenSteve", lc.frozenSteves);
+ cf.writeIntConfig("fishing", "snowman", lc.frostyTheSnowmans);
+ cf.writeIntConfig("fishing", "grinch", lc.grinches);
+ cf.writeIntConfig("fishing", "yeti", lc.yetis);
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Fishing stats imported."));
+ }).start();
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/LootCommand.java b/src/main/java/me/Danker/commands/LootCommand.java
new file mode 100644
index 0000000..d64e9d9
--- /dev/null
+++ b/src/main/java/me/Danker/commands/LootCommand.java
@@ -0,0 +1,533 @@
+package me.Danker.commands;
+
+import java.text.NumberFormat;
+import java.util.List;
+import java.util.Locale;
+
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class LootCommand extends CommandBase {
+ // Wolf
+ public static int wolfSvens;
+ public static int wolfTeeth;
+ public static int wolfWheels;
+ public static int wolfWheelsDrops;
+ public static int wolfSpirits;
+ public static int wolfBooks;
+ public static int wolfEggs;
+ public static int wolfCoutures;
+ public static int wolfBaits;
+ public static int wolfFluxes;
+ public static double wolfTime;
+ public static int wolfBosses;
+ // Spider
+ public static int spiderTarantulas;
+ public static int spiderWebs;
+ public static int spiderTAP;
+ public static int spiderTAPDrops;
+ public static int spiderBites;
+ public static int spiderCatalysts;
+ public static int spiderBooks;
+ public static int spiderSwatters;
+ public static int spiderTalismans;
+ public static int spiderMosquitos;
+ public static double spiderTime;
+ public static int spiderBosses;
+ // Zombie
+ public static int zombieRevs;
+ public static int zombieRevFlesh;
+ public static int zombieFoulFlesh;
+ public static int zombieFoulFleshDrops;
+ public static int zombiePestilences;
+ public static int zombieUndeadCatas;
+ public static int zombieBooks;
+ public static int zombieBeheadeds;
+ public static int zombieRevCatas;
+ public static int zombieSnakes;
+ public static int zombieScythes;
+ public static double zombieTime;
+ public static int zombieBosses;
+
+ // Fishing
+ public static int seaCreatures;
+ public static int goodCatches;
+ public static int greatCatches;
+ public static int squids;
+ public static int seaWalkers;
+ public static int nightSquids;
+ public static int seaGuardians;
+ public static int seaWitches;
+ public static int seaArchers;
+ public static int monsterOfTheDeeps;
+ public static int catfishes;
+ public static int carrotKings;
+ public static int seaLeeches;
+ public static int guardianDefenders;
+ public static int deepSeaProtectors;
+ public static int hydras;
+ public static int seaEmperors;
+ public static double empTime;
+ public static int empSCs;
+ public static int fishingMilestone;
+ // Fishing Winter
+ public static int frozenSteves;
+ public static int frostyTheSnowmans;
+ public static int grinches;
+ public static int yetis;
+
+ // Single sessions (No config saves)
+ // Wolf
+ public static int wolfSvensSession = 0;
+ public static int wolfTeethSession = 0;
+ public static int wolfWheelsSession = 0;
+ public static int wolfWheelsDropsSession = 0;
+ public static int wolfSpiritsSession = 0;
+ public static int wolfBooksSession = 0;
+ public static int wolfEggsSession = 0;
+ public static int wolfCouturesSession = 0;
+ public static int wolfBaitsSession = 0;
+ public static int wolfFluxesSession = 0;
+ public static double wolfTimeSession = -1;
+ public static int wolfBossesSession = -1;
+ // Spider
+ public static int spiderTarantulasSession = 0;
+ public static int spiderWebsSession = 0;
+ public static int spiderTAPSession = 0;
+ public static int spiderTAPDropsSession = 0;
+ public static int spiderBitesSession = 0;
+ public static int spiderCatalystsSession = 0;
+ public static int spiderBooksSession = 0;
+ public static int spiderSwattersSession = 0;
+ public static int spiderTalismansSession = 0;
+ public static int spiderMosquitosSession = 0;
+ public static double spiderTimeSession = -1;
+ public static int spiderBossesSession = -1;
+ // Zombie
+ public static int zombieRevsSession = 0;
+ public static int zombieRevFleshSession = 0;
+ public static int zombieFoulFleshSession = 0;
+ public static int zombieFoulFleshDropsSession = 0;
+ public static int zombiePestilencesSession = 0;
+ public static int zombieUndeadCatasSession = 0;
+ public static int zombieBooksSession = 0;
+ public static int zombieBeheadedsSession = 0;
+ public static int zombieRevCatasSession = 0;
+ public static int zombieSnakesSession = 0;
+ public static int zombieScythesSession = 0;
+ public static double zombieTimeSession = -1;
+ public static int zombieBossesSession = -1;
+
+ // Fishing
+ public static int seaCreaturesSession = 0;
+ public static int goodCatchesSession = 0;
+ public static int greatCatchesSession = 0;
+ public static int squidsSession = 0;
+ public static int seaWalkersSession = 0;
+ public static int nightSquidsSession = 0;
+ public static int seaGuardiansSession = 0;
+ public static int seaWitchesSession = 0;
+ public static int seaArchersSession = 0;
+ public static int monsterOfTheDeepsSession = 0;
+ public static int catfishesSession = 0;
+ public static int carrotKingsSession = 0;
+ public static int seaLeechesSession = 0;
+ public static int guardianDefendersSession = 0;
+ public static int deepSeaProtectorsSession = 0;
+ public static int hydrasSession = 0;
+ public static int seaEmperorsSession = 0;
+ public static double empTimeSession = -1;
+ public static int empSCsSession = -1;
+ public static int fishingMilestoneSession = 0;
+ // Fishing Winter
+ public static int frozenStevesSession = 0;
+ public static int frostyTheSnowmansSession = 0;
+ public static int grinchesSession = 0;
+ public static int yetisSession = 0;
+
+ public String getTimeBetween(double timeOne, double timeTwo) {
+ double secondsBetween = Math.floor(timeTwo - timeOne);
+
+ String timeFormatted = "";
+ int days;
+ int hours;
+ int minutes;
+ int seconds;
+
+ if (secondsBetween > 86400) {
+ // More than 1d, display #d#h
+ days = (int) (secondsBetween / 86400);
+ hours = (int) (secondsBetween % 86400 / 3600);
+ timeFormatted = days + "d" + hours + "h";
+ } else if (secondsBetween > 3600) {
+ // More than 1h, display #h#m
+ hours = (int) (secondsBetween / 3600);
+ minutes = (int) (secondsBetween % 3600 / 60);
+ timeFormatted = hours + "h" + minutes + "m";
+ } else {
+ // Display #m#s
+ minutes = (int) (secondsBetween / 60);
+ seconds = (int) (secondsBetween % 60);
+ timeFormatted = minutes + "m" + seconds + "s";
+ }
+
+ return timeFormatted;
+ }
+
+ @Override
+ public String getCommandName() {
+ return "loot";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " <zombie/spider/wolf/fishing> [winter/session]";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return getListOfStringsMatchingLastWord(args, "wolf", "spider", "zombie", "fishing");
+ } else if (args.length == 2 && args[0].equalsIgnoreCase("fishing")) {
+ return getListOfStringsMatchingLastWord(args, "winter", "session");
+ } else if (args.length == 2 || (args.length == 3 && args[0].equalsIgnoreCase("fishing") && args[1].equalsIgnoreCase("winter"))) {
+ return getListOfStringsMatchingLastWord(args, "session");
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer) arg0;
+
+ if (arg1.length == 0) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot <zombie/spider/wolf/fishing> [winter/session]"));
+ return;
+ }
+
+ double timeNow = System.currentTimeMillis() / 1000;
+ String timeBetween;
+ String bossesBetween;
+ String drop20;
+ NumberFormat nf = NumberFormat.getIntegerInstance(Locale.US);
+ boolean showSession = false;
+
+ if (arg1.length > 1) {
+ if (arg1[1].equalsIgnoreCase("session")) {
+ showSession = true;
+ } else if (arg1.length > 2) {
+ if (arg1[2].equalsIgnoreCase("session")) {
+ showSession = true;
+ }
+ }
+ }
+
+ if (arg1[0].equalsIgnoreCase("wolf")) {
+ if (showSession) {
+ if (wolfTimeSession == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = getTimeBetween(wolfTimeSession, timeNow);
+ }
+ if (wolfBossesSession == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(wolfBossesSession);
+ }
+ if (ToggleCommand.slayerCountTotal) {
+ drop20 = nf.format(wolfWheelsSession);
+ } else {
+ drop20 = nf.format(wolfWheelsDropsSession) + " times";
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.DARK_AQUA + EnumChatFormatting.BOLD + " Sven Loot Summary (Current Session):\n" +
+ EnumChatFormatting.GOLD + " Svens Killed: " + nf.format(wolfSvensSession) + "\n" +
+ EnumChatFormatting.GREEN + " Wolf Teeth: " + nf.format(wolfTeethSession) + "\n" +
+ EnumChatFormatting.BLUE + " Hamster Wheels: " + drop20 + "\n" +
+ EnumChatFormatting.AQUA + " Spirit Runes: " + wolfSpiritsSession + "\n" +
+ EnumChatFormatting.WHITE + " Critical VI Books: " + wolfBooksSession + "\n" +
+ EnumChatFormatting.DARK_RED + " Red Claw Eggs: " + wolfEggsSession + "\n" +
+ EnumChatFormatting.GOLD + " Couture Runes: " + wolfCouturesSession + "\n" +
+ EnumChatFormatting.AQUA + " Grizzly Baits: " + wolfBaitsSession + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Overfluxes: " + wolfFluxesSession + "\n" +
+ EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" +
+ EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------"));
+ return;
+ }
+
+ if (wolfTime == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = getTimeBetween(wolfTime, timeNow);
+ }
+ if (wolfBosses == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(wolfBosses);
+ }
+ if (ToggleCommand.slayerCountTotal) {
+ drop20 = nf.format(wolfWheels);
+ } else {
+ drop20 = nf.format(wolfWheelsDrops) + " times";
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.DARK_AQUA + EnumChatFormatting.BOLD + " Sven Loot Summary:\n" +
+ EnumChatFormatting.GOLD + " Svens Killed: " + nf.format(wolfSvens) + "\n" +
+ EnumChatFormatting.GREEN + " Wolf Teeth: " + nf.format(wolfTeeth) + "\n" +
+ EnumChatFormatting.BLUE + " Hamster Wheels: " + drop20 + "\n" +
+ EnumChatFormatting.AQUA + " Spirit Runes: " + wolfSpirits + "\n" +
+ EnumChatFormatting.WHITE + " Critical VI Books: " + wolfBooks + "\n" +
+ EnumChatFormatting.DARK_RED + " Red Claw Eggs: " + wolfEggs + "\n" +
+ EnumChatFormatting.GOLD + " Couture Runes: " + wolfCoutures + "\n" +
+ EnumChatFormatting.AQUA + " Grizzly Baits: " + wolfBaits + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Overfluxes: " + wolfFluxes + "\n" +
+ EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" +
+ EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------"));
+ } else if (arg1[0].equalsIgnoreCase("spider")) {
+ if (showSession) {
+ if (spiderTimeSession == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = getTimeBetween(spiderTimeSession, timeNow);
+ }
+ if (spiderBossesSession == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(spiderBossesSession);
+ }
+ if (ToggleCommand.slayerCountTotal) {
+ drop20 = nf.format(spiderTAPSession);
+ } else {
+ drop20 = nf.format(spiderTAPDropsSession) + " times";
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " Spider Loot Summary (Current Session):\n" +
+ EnumChatFormatting.GOLD + " Tarantulas Killed: " + nf.format(spiderTarantulasSession) + "\n" +
+ EnumChatFormatting.GREEN + " Tarantula Webs: " + nf.format(spiderWebsSession) + "\n" +
+ EnumChatFormatting.DARK_GREEN + " Arrow Poison: " + drop20 + "\n" +
+ EnumChatFormatting.DARK_GRAY + " Bite Runes: " + spiderBitesSession + "\n" +
+ EnumChatFormatting.WHITE + " Bane VI Books: " + spiderBooksSession + "\n" +
+ EnumChatFormatting.AQUA + " Spider Catalysts: " + spiderCatalystsSession + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Tarantula Talismans: " + spiderTalismansSession + "\n" +
+ EnumChatFormatting.LIGHT_PURPLE + " Fly Swatters: " + spiderSwattersSession + "\n" +
+ EnumChatFormatting.GOLD + " Digested Mosquitos: " + spiderMosquitosSession + "\n" +
+ EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" +
+ EnumChatFormatting.RED + EnumChatFormatting.BOLD + " -------------------"));
+ return;
+ }
+
+ if (spiderTime == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = getTimeBetween(spiderTime, timeNow);
+ }
+ if (spiderBosses == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(spiderBosses);
+ }
+ if (ToggleCommand.slayerCountTotal) {
+ drop20 = nf.format(spiderTAP);
+ } else {
+ drop20 = nf.format(spiderTAPDrops) + " times";
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.DARK_RED + EnumChatFormatting.BOLD + " Spider Loot Summary:\n" +
+ EnumChatFormatting.GOLD + " Tarantulas Killed: " + nf.format(spiderTarantulas) + "\n" +
+ EnumChatFormatting.GREEN + " Tarantula Webs: " + nf.format(spiderWebs) + "\n" +
+ EnumChatFormatting.DARK_GREEN + " Arrow Poison: " + drop20 + "\n" +
+ EnumChatFormatting.DARK_GRAY + " Bite Runes: " + spiderBites + "\n" +
+ EnumChatFormatting.WHITE + " Bane VI Books: " + spiderBooks + "\n" +
+ EnumChatFormatting.AQUA + " Spider Catalysts: " + spiderCatalysts + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Tarantula Talismans: " + spiderTalismans + "\n" +
+ EnumChatFormatting.LIGHT_PURPLE + " Fly Swatters: " + spiderSwatters + "\n" +
+ EnumChatFormatting.GOLD + " Digested Mosquitos: " + spiderMosquitos + "\n" +
+ EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" +
+ EnumChatFormatting.RED + EnumChatFormatting.BOLD + " -------------------"));
+ } else if (arg1[0].equalsIgnoreCase("zombie")) {
+ if (showSession) {
+ if (zombieTimeSession == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = getTimeBetween(zombieTimeSession, timeNow);
+ }
+ if (zombieBossesSession == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(zombieBossesSession);
+ }
+ if (ToggleCommand.slayerCountTotal) {
+ drop20 = nf.format(zombieFoulFleshSession);
+ } else {
+ drop20 = nf.format(zombieFoulFleshDropsSession) + " times";
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + " Zombie Loot Summary (Current Session):\n" +
+ EnumChatFormatting.GOLD + " Revs Killed: " + nf.format(zombieRevsSession) + "\n" +
+ EnumChatFormatting.GREEN + " Revenant Flesh: " + nf.format(zombieRevFleshSession) + "\n" +
+ EnumChatFormatting.BLUE + " Foul Flesh: " + drop20 + "\n" +
+ EnumChatFormatting.DARK_GREEN + " Pestilence Runes: " + zombiePestilencesSession + "\n" +
+ EnumChatFormatting.WHITE + " Smite VI Books: " + zombieBooksSession + "\n" +
+ EnumChatFormatting.AQUA + " Undead Catalysts: " + zombieUndeadCatasSession + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Beheaded Horrors: " + zombieBeheadedsSession + "\n" +
+ EnumChatFormatting.RED + " Revenant Catalysts: " + zombieRevCatasSession + "\n" +
+ EnumChatFormatting.DARK_GREEN + " Snake Runes: " + zombieSnakesSession + "\n" +
+ EnumChatFormatting.GOLD + " Scythe Blades: " + zombieScythesSession + "\n" +
+ EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" +
+ EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + " -------------------"));
+ return;
+ }
+
+ if (zombieTime == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = getTimeBetween(zombieTime, timeNow);
+ }
+ if (zombieBosses == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(zombieBosses);
+ }
+ if (ToggleCommand.slayerCountTotal) {
+ drop20 = nf.format(zombieFoulFlesh);
+ } else {
+ drop20 = nf.format(zombieFoulFleshDrops) + " times";
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + " Zombie Loot Summary:\n" +
+ EnumChatFormatting.GOLD + " Revs Killed: " + nf.format(zombieRevs) + "\n" +
+ EnumChatFormatting.GREEN + " Revenant Flesh: " + nf.format(zombieRevFlesh) + "\n" +
+ EnumChatFormatting.BLUE + " Foul Flesh: " + drop20 + "\n" +
+ EnumChatFormatting.DARK_GREEN + " Pestilence Runes: " + zombiePestilences + "\n" +
+ EnumChatFormatting.WHITE + " Smite VI Books: " + zombieBooks + "\n" +
+ EnumChatFormatting.AQUA + " Undead Catalysts: " + zombieUndeadCatas + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Beheaded Horrors: " + zombieBeheadeds + "\n" +
+ EnumChatFormatting.RED + " Revenant Catalysts: " + zombieRevCatas + "\n" +
+ EnumChatFormatting.DARK_GREEN + " Snake Runes: " + zombieSnakes + "\n" +
+ EnumChatFormatting.GOLD + " Scythe Blades: " + zombieScythes + "\n" +
+ EnumChatFormatting.AQUA + " Time Since RNG: " + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + " Bosses Since RNG: " + bossesBetween + "\n" +
+ EnumChatFormatting.GREEN + EnumChatFormatting.BOLD + " -------------------"));
+ } else if (arg1[0].equalsIgnoreCase("fishing")) {
+ if (arg1.length > 1) {
+ if (arg1[1].equalsIgnoreCase("winter")) {
+ if (showSession) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.WHITE + EnumChatFormatting.BOLD + " Winter Fishing Summary (Current Session):\n" +
+ EnumChatFormatting.AQUA + " Frozen Steves: " + nf.format(frozenStevesSession) + "\n" +
+ EnumChatFormatting.WHITE + " Snowmans: " + nf.format(frostyTheSnowmansSession) + "\n" +
+ EnumChatFormatting.DARK_GREEN + " Grinches: " + nf.format(grinchesSession) + "\n" +
+ EnumChatFormatting.GOLD + " Yetis: " + nf.format(yetisSession) + "\n" +
+ EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------"));
+ return;
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.WHITE + EnumChatFormatting.BOLD + " Winter Fishing Summary:\n" +
+ EnumChatFormatting.AQUA + " Frozen Steves: " + nf.format(frozenSteves) + "\n" +
+ EnumChatFormatting.WHITE + " Snowmans: " + nf.format(frostyTheSnowmans) + "\n" +
+ EnumChatFormatting.DARK_GREEN + " Grinches: " + nf.format(grinches) + "\n" +
+ EnumChatFormatting.GOLD + " Yetis: " + nf.format(yetis) + "\n" +
+ EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " -------------------"));
+ return;
+ }
+ }
+
+ if (showSession) {
+ if (empTimeSession == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = getTimeBetween(empTimeSession, timeNow);
+ }
+ if (empSCsSession == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(empSCsSession);
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " Fishing Summary (Current Session):\n" +
+ EnumChatFormatting.AQUA + " Sea Creatures Caught: " + nf.format(seaCreaturesSession) + "\n" +
+ EnumChatFormatting.GOLD + " Good Catches: " + nf.format(goodCatchesSession) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Great Catches: " + nf.format(greatCatchesSession) + "\n\n" +
+ EnumChatFormatting.GRAY + " Squids: " + nf.format(squidsSession) + "\n" +
+ EnumChatFormatting.GREEN + " Sea Walkers: " + nf.format(seaWalkersSession) + "\n" +
+ EnumChatFormatting.DARK_GRAY + " Night Squids: " + nf.format(nightSquidsSession) + "\n" +
+ EnumChatFormatting.DARK_AQUA + " Sea Guardians: " + nf.format(seaGuardiansSession) + "\n" +
+ EnumChatFormatting.BLUE + " Sea Witches: " + nf.format(seaWitchesSession) + "\n" +
+ EnumChatFormatting.GREEN + " Sea Archers: " + nf.format(seaArchersSession) + "\n" +
+ EnumChatFormatting.GREEN + " Monster of the Deeps: " + nf.format(monsterOfTheDeepsSession) + "\n" +
+ EnumChatFormatting.YELLOW + " Catfishes: " + nf.format(catfishesSession) + "\n" +
+ EnumChatFormatting.GOLD + " Carrot Kings: " + nf.format(carrotKingsSession) + "\n" +
+ EnumChatFormatting.GRAY + " Sea Leeches: " + nf.format(seaLeechesSession) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Guardian Defenders: " + nf.format(guardianDefendersSession) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Deep Sea Protectors: " + nf.format(deepSeaProtectorsSession) + "\n" +
+ EnumChatFormatting.GOLD + " Hydras: " + nf.format(hydrasSession) + "\n" +
+ EnumChatFormatting.GOLD + " Sea Emperors: " + nf.format(seaEmperorsSession) + "\n" +
+ EnumChatFormatting.AQUA + " Time Since Sea Emperor: " + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + " Sea Creatures Since Sea Emperor: " + bossesBetween + "\n" +
+ EnumChatFormatting.DARK_AQUA + EnumChatFormatting.BOLD + " -------------------"));
+ return;
+ }
+
+ if (empTime == -1) {
+ timeBetween = "Never";
+ } else {
+ timeBetween = getTimeBetween(empTime, timeNow);
+ }
+ if (empSCs == -1) {
+ bossesBetween = "Never";
+ } else {
+ bossesBetween = nf.format(empSCs);
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.AQUA + EnumChatFormatting.BOLD + " Fishing Summary:\n" +
+ EnumChatFormatting.AQUA + " Sea Creatures Caught: " + nf.format(seaCreatures) + "\n" +
+ EnumChatFormatting.GOLD + " Good Catches: " + nf.format(goodCatches) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Great Catches: " + nf.format(greatCatches) + "\n\n" +
+ EnumChatFormatting.GRAY + " Squids: " + nf.format(squids) + "\n" +
+ EnumChatFormatting.GREEN + " Sea Walkers: " + nf.format(seaWalkers) + "\n" +
+ EnumChatFormatting.DARK_GRAY + " Night Squids: " + nf.format(nightSquids) + "\n" +
+ EnumChatFormatting.DARK_AQUA + " Sea Guardians: " + nf.format(seaGuardians) + "\n" +
+ EnumChatFormatting.BLUE + " Sea Witches: " + nf.format(seaWitches) + "\n" +
+ EnumChatFormatting.GREEN + " Sea Archers: " + nf.format(seaArchers) + "\n" +
+ EnumChatFormatting.GREEN + " Monster of the Deeps: " + nf.format(monsterOfTheDeeps) + "\n" +
+ EnumChatFormatting.YELLOW + " Catfishes: " + nf.format(catfishes) + "\n" +
+ EnumChatFormatting.GOLD + " Carrot Kings: " + nf.format(carrotKings) + "\n" +
+ EnumChatFormatting.GRAY + " Sea Leeches: " + nf.format(seaLeeches) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Guardian Defenders: " + nf.format(guardianDefenders) + "\n" +
+ EnumChatFormatting.DARK_PURPLE + " Deep Sea Protectors: " + nf.format(deepSeaProtectors) + "\n" +
+ EnumChatFormatting.GOLD + " Hydras: " + nf.format(hydras) + "\n" +
+ EnumChatFormatting.GOLD + " Sea Emperors: " + nf.format(seaEmperors) + "\n" +
+ EnumChatFormatting.AQUA + " Time Since Sea Emperor: " + timeBetween + "\n" +
+ EnumChatFormatting.AQUA + " Sea Creatures Since Sea Emperor: " + bossesBetween + "\n" +
+ EnumChatFormatting.DARK_AQUA + EnumChatFormatting.BOLD + " -------------------"));
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /loot <zombie/spider/wolf/fishing> [winter/session]"));
+ }
+
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java
new file mode 100644
index 0000000..1232e18
--- /dev/null
+++ b/src/main/java/me/Danker/commands/MoveCommand.java
@@ -0,0 +1,69 @@
+package me.Danker.commands;
+
+import java.util.List;
+
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class MoveCommand extends CommandBase {
+
+ public static int[] coordsXY = {0, 0};
+ public static int[] displayXY = {0, 0};
+
+ @Override
+ public String getCommandName() {
+ return "move";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " <coords/display> <x> <y>";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return getListOfStringsMatchingLastWord(args, "coords", "display");
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer)arg0;
+ final ConfigHandler cf = new ConfigHandler();
+
+ if (arg1.length < 2) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /move <coords/display> <x> <y>"));
+ return;
+ }
+
+ if (arg1[0].equalsIgnoreCase("coords")) {
+ coordsXY[0] = Integer.parseInt(arg1[1]);
+ coordsXY[1] = Integer.parseInt(arg1[2]);
+ cf.writeIntConfig("locations", "coordsX", coordsXY[0]);
+ cf.writeIntConfig("locations", "coordsY", coordsXY[1]);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Coords have been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2]));
+ } else if (arg1[0].equalsIgnoreCase("display")) {
+ displayXY[0] = Integer.parseInt(arg1[1]);
+ displayXY[1] = Integer.parseInt(arg1[2]);
+ cf.writeIntConfig("locations", "displayX", displayXY[0]);
+ cf.writeIntConfig("locations", "displayY", displayXY[1]);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Tracker display has been moved to " + EnumChatFormatting.DARK_GREEN + arg1[1] + ", " + arg1[2]));
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /move <coords/display> <x> <y>"));
+ }
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/PetsCommand.java b/src/main/java/me/Danker/commands/PetsCommand.java
new file mode 100644
index 0000000..75367ab
--- /dev/null
+++ b/src/main/java/me/Danker/commands/PetsCommand.java
@@ -0,0 +1,247 @@
+package me.Danker.commands;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+import me.Danker.handlers.APIHandler;
+import me.Danker.handlers.ConfigHandler;
+import me.Danker.utils.Utils;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class PetsCommand extends CommandBase {
+
+ static int petXpToLevel(double xp, String rarity) {
+ int[] xpPerLevel = {100, 110, 120, 130, 145, 160, 175, 190, 210, 230, 250, 275, 300, 330, 360, 400, 440, 490, 540, 600, 660, 730,
+ 800, 880, 860, 1050, 1150, 1260, 1380, 1510, 1650, 1800, 1960, 2130, 2310, 2500, 2700, 2920, 3160, 3420, 3700,
+ 4000, 4350, 4750, 5200, 5700, 6300, 7000, 7800, 8700, 9700, 10800, 12000, 13300, 14700, 16200, 17800, 19500,
+ 21300, 23200, 25200, 27400, 29800, 32400, 35200, 38200, 41400, 44800, 48400, 52200, 56200, 60400, 64800, 69400,
+ 74200, 79200, 84700, 90700, 97200, 104200, 111700, 119700, 128200, 137200, 146700, 156700, 167700, 179700, 192700,
+ 206700, 221700, 237700, 254700, 272700, 291700, 311700, 333700, 357700, 383700, 411700, 441700, 476700, 516700,
+ 561700, 611700, 666700, 726700, 791700, 861700, 936700, 1016700, 1101700, 1191700, 1286700, 1386700, 1496700,
+ 1616700, 1746700, 1886700};
+
+ int levelOffset = 0;
+ if (rarity.equals("UNCOMMON")) {
+ levelOffset = 6;
+ } else if (rarity.equals("RARE")) {
+ levelOffset = 11;
+ } else if (rarity.equals("EPIC")) {
+ levelOffset = 16;
+ } else if (rarity.equals("LEGENDARY")) {
+ levelOffset = 20;
+ }
+
+ for (int i = levelOffset, xpAdded = 0; i < levelOffset + 99; i++) {
+ xpAdded += xpPerLevel[i];
+ if (xp < xpAdded) {
+ return i + 1 - levelOffset;
+ }
+ }
+ return 100;
+ }
+
+ static String capitalize(String string) {
+ String capitalized = string.substring(0, 1).toUpperCase() + string.substring(1).toLowerCase();
+ return capitalized;
+ }
+
+ @Override
+ public String getCommandName() {
+ return "petsof";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " [name]";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return Utils.getMatchingPlayers(args[0]);
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ // MULTI THREAD DRIFTING
+ new Thread(() -> {
+ APIHandler ah = new APIHandler();
+ ConfigHandler cf = new ConfigHandler();
+ EntityPlayer player = (EntityPlayer) arg0;
+
+ // Check key
+ String key = cf.getString("api", "APIKey");
+ if (key.equals("")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey."));
+ }
+
+ // Get UUID for Hypixel API requests
+ String username;
+ String uuid;
+ if (arg1.length == 0) {
+ username = player.getName();
+ uuid = player.getUniqueID().toString().replaceAll("[\\-]", "");
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking pets of " + EnumChatFormatting.DARK_GREEN + username));
+ } else {
+ username = arg1[0];
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking pets of " + EnumChatFormatting.DARK_GREEN + username));
+ uuid = ah.getUUID(username);
+ }
+
+ // Find stats of latest profile
+ String latestProfile = ah.getLatestProfileID(uuid, key);
+ if (latestProfile == null) return;
+
+ String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key;
+ System.out.println("Fetching profile...");
+ JsonObject profileResponse = ah.getResponse(profileURL);
+ if (!profileResponse.get("success").getAsBoolean()) {
+ String reason = profileResponse.get("cause").getAsString();
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason));
+ return;
+ }
+
+ System.out.println("Fetching pets...");
+ JsonArray petsArray = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("pets").getAsJsonArray();
+ if (petsArray.size() == 0) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + username + " has no pets."));
+ return;
+ }
+
+ System.out.println("Looping through pets...");
+ // Push each pet into list
+ List<JsonElement> sortedPets = new ArrayList<JsonElement>();
+ for (JsonElement petElement : petsArray) {
+ sortedPets.add(petElement);
+ }
+
+ // Sort pets by exp
+ Collections.sort(sortedPets, (pet1, pet2) -> {
+ double petXp1 = pet1.getAsJsonObject().get("exp").getAsDouble();
+ double petXp2 = pet2.getAsJsonObject().get("exp").getAsDouble();
+ return -Double.compare(petXp1, petXp2);
+ });
+
+ // Sort pets into rarities
+ List<JsonObject> commonPets = new ArrayList<JsonObject>();
+ List<JsonObject> uncommonPets = new ArrayList<JsonObject>();
+ List<JsonObject> rarePets = new ArrayList<JsonObject>();
+ List<JsonObject> epicPets = new ArrayList<JsonObject>();
+ List<JsonObject> legendaryPets = new ArrayList<JsonObject>();
+
+ for (JsonElement petElement : sortedPets) {
+ JsonObject pet = petElement.getAsJsonObject();
+ String rarity = pet.get("tier").getAsString();
+
+ if (rarity.equals("COMMON")) {
+ commonPets.add(pet);
+ } else if (rarity.equals("UNCOMMON")) {
+ uncommonPets.add(pet);
+ } else if (rarity.equals("RARE")) {
+ rarePets.add(pet);
+ } else if (rarity.equals("EPIC")) {
+ epicPets.add(pet);
+ } else if (rarity.equals("LEGENDARY")) {
+ legendaryPets.add(pet);
+ }
+ }
+
+ String finalMessage = EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.AQUA + " " + username + "'s Pets:\n";
+
+ // Loop through pet rarities
+ for (JsonObject legPet : legendaryPets) {
+ String petName = capitalize(legPet.get("type").getAsString());
+ int level = petXpToLevel(legPet.get("exp").getAsDouble(), "LEGENDARY");
+
+ String messageToAdd = "";
+ if (legPet.get("active").getAsBoolean()) {
+ messageToAdd = EnumChatFormatting.GOLD + " " + EnumChatFormatting.BOLD + ">>> Legendary " + petName + " (" + level + ") <<<";
+ } else {
+ messageToAdd = EnumChatFormatting.GOLD + " Legendary " + petName + " (" + level + ")";
+ }
+
+ finalMessage += messageToAdd + "\n";
+ }
+
+ for (JsonObject epicPet: epicPets) {
+ String petName = capitalize(epicPet.get("type").getAsString());
+ int level = petXpToLevel(epicPet.get("exp").getAsDouble(), "EPIC");
+
+ String messageToAdd = "";
+ if (epicPet.get("active").getAsBoolean()) {
+ messageToAdd = EnumChatFormatting.DARK_PURPLE + " " + EnumChatFormatting.BOLD + ">>> Epic " + petName + " (" + level + ") <<<";
+ } else {
+ messageToAdd = EnumChatFormatting.DARK_PURPLE + " Epic " + petName + " (" + level + ")";
+ }
+
+ finalMessage += messageToAdd + "\n";
+ }
+
+ for (JsonObject rarePet: rarePets) {
+ String petName = capitalize(rarePet.get("type").getAsString());
+ int level = petXpToLevel(rarePet.get("exp").getAsDouble(), "RARE");
+
+ String messageToAdd = "";
+ if (rarePet.get("active").getAsBoolean()) {
+ messageToAdd = EnumChatFormatting.BLUE + " " + EnumChatFormatting.BOLD + ">>> Rare " + petName + " (" + level + ") <<<";
+ } else {
+ messageToAdd = EnumChatFormatting.BLUE + " Rare " + petName + " (" + level + ")";
+ }
+
+ finalMessage += messageToAdd + "\n";
+ }
+
+ for (JsonObject uncommonPet: uncommonPets) {
+ String petName = capitalize(uncommonPet.get("type").getAsString());
+ int level = petXpToLevel(uncommonPet.get("exp").getAsDouble(), "UNCOMMON");
+
+ String messageToAdd = "";
+ if (uncommonPet.get("active").getAsBoolean()) {
+ messageToAdd = EnumChatFormatting.GREEN + " " + EnumChatFormatting.BOLD + ">>> Uncommon " + petName + " (" + level + ") <<<";
+ } else {
+ messageToAdd = EnumChatFormatting.GREEN + " Uncommon " + petName + " (" + level + ")";
+ }
+
+ finalMessage += messageToAdd + "\n";
+ }
+
+ for (JsonObject commonPet: commonPets) {
+ String petName = capitalize(commonPet.get("type").getAsString());
+ int level = petXpToLevel(commonPet.get("exp").getAsDouble(), "COMMON");
+
+ String messageToAdd = "";
+ if (commonPet.get("active").getAsBoolean()) {
+ messageToAdd = EnumChatFormatting.BOLD + ">>> Common " + petName + " (" + level + ") <<<";
+ } else {
+ messageToAdd = " Common " + petName + " (" + level + ")";
+ }
+
+ finalMessage += messageToAdd + "\n";
+ }
+
+ finalMessage += EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------";
+ player.addChatMessage(new ChatComponentText(finalMessage));
+
+ }).start();
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/ReloadConfigCommand.java b/src/main/java/me/Danker/commands/ReloadConfigCommand.java
new file mode 100644
index 0000000..122f1c1
--- /dev/null
+++ b/src/main/java/me/Danker/commands/ReloadConfigCommand.java
@@ -0,0 +1,36 @@
+package me.Danker.commands;
+
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class ReloadConfigCommand extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "reloadconfig";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName();
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer)arg0;
+ final ConfigHandler cf = new ConfigHandler();
+ cf.reloadConfig();
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Reloaded config."));
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java
new file mode 100644
index 0000000..1afc204
--- /dev/null
+++ b/src/main/java/me/Danker/commands/ResetLootCommand.java
@@ -0,0 +1,181 @@
+package me.Danker.commands;
+
+import java.util.List;
+
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class ResetLootCommand extends CommandBase {
+
+ static String resetOption;
+ static boolean confirmReset = false;
+
+ @Override
+ public String getCommandName() {
+ return "resetloot";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + "<zombie/spider/wolf/fishing/confirm/cancel>";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length != 1) return null;
+
+ if (confirmReset) {
+ return getListOfStringsMatchingLastWord(args, "confirm", "cancel");
+ } else {
+ return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf", "fishing");
+ }
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer) arg0;
+
+ if (arg1.length == 0) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /resetloot <zombie/spider/wolf/fishing>"));
+ return;
+ }
+
+ if (confirmReset) {
+ if (arg1[0].equalsIgnoreCase("confirm")) {
+ confirmReset = false;
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Resetting " + resetOption + " tracker..."));
+ if (resetOption.equalsIgnoreCase("zombie")) {
+ resetZombie();
+ } else if (resetOption.equalsIgnoreCase("spider")) {
+ resetSpider();
+ } else if (resetOption.equalsIgnoreCase("wolf")) {
+ resetWolf();
+ } else if (resetOption.equalsIgnoreCase("fishing")) {
+ resetFishing();
+ }
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Reset complete."));
+ } else if (arg1[0].equalsIgnoreCase("cancel")) {
+ confirmReset = false;
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Reset cancelled."));
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Please confirm the reset of the " + resetOption + " tracker by using /resetloot confirm." +
+ EnumChatFormatting.RED + " Cancel by using /resetloot cancel."));
+ }
+ } else {
+ if (arg1[0].equalsIgnoreCase("zombie") || arg1[0].equalsIgnoreCase("spider") || arg1[0].equalsIgnoreCase("wolf") || arg1[0].equalsIgnoreCase("fishing")) {
+ resetOption = arg1[0];
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Are you sure you want to reset the " + resetOption + " tracker?" +
+ " Confirm with " + EnumChatFormatting.GREEN + "/resetloot confirm" + EnumChatFormatting.YELLOW + "." +
+ " Cancel by using " + EnumChatFormatting.GREEN + "/resetloot cancel" + EnumChatFormatting.YELLOW + "."));
+ confirmReset = true;
+ } else if (arg1[0].equalsIgnoreCase("confirm") || arg1[0].equalsIgnoreCase("cancel")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Pick something to reset first."));
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /resetloot <zombie/spider/wolf/fishing>"));
+ }
+ }
+ }
+
+ static void resetZombie() {
+ LootCommand lc = new LootCommand();
+ ConfigHandler cf = new ConfigHandler();
+
+ lc.zombieRevsSession = 0;
+ lc.zombieRevFleshSession = 0;
+ lc.zombieFoulFleshSession = 0;
+ lc.zombieFoulFleshDropsSession = 0;
+ lc.zombiePestilencesSession = 0;
+ lc.zombieUndeadCatasSession = 0;
+ lc.zombieBooksSession = 0;
+ lc.zombieBeheadedsSession = 0;
+ lc.zombieRevCatasSession = 0;
+ lc.zombieSnakesSession = 0;
+ lc.zombieScythesSession = 0;
+ lc.zombieTimeSession = -1;
+ lc.zombieBossesSession = -1;
+ cf.deleteCategory("zombie");
+ cf.reloadConfig();
+ }
+
+ static void resetSpider() {
+ LootCommand lc = new LootCommand();
+ ConfigHandler cf = new ConfigHandler();
+
+ lc.spiderTarantulasSession = 0;
+ lc.spiderWebsSession = 0;
+ lc.spiderTAPSession = 0;
+ lc.spiderTAPDropsSession = 0;
+ lc.spiderBitesSession = 0;
+ lc.spiderCatalystsSession = 0;
+ lc.spiderBooksSession = 0;
+ lc.spiderSwattersSession = 0;
+ lc.spiderTalismansSession = 0;
+ lc.spiderMosquitosSession = 0;
+ lc.spiderTimeSession = -1;
+ lc.spiderBossesSession = -1;
+ cf.deleteCategory("spider");
+ cf.reloadConfig();
+ }
+
+ static void resetWolf() {
+ LootCommand lc = new LootCommand();
+ ConfigHandler cf = new ConfigHandler();
+ lc.wolfSvensSession = 0;
+ lc.wolfTeethSession = 0;
+ lc.wolfWheelsSession = 0;
+ lc.wolfWheelsDropsSession = 0;
+ lc.wolfSpiritsSession = 0;
+ lc.wolfBooksSession = 0;
+ lc.wolfEggsSession = 0;
+ lc.wolfCouturesSession = 0;
+ lc.wolfBaitsSession = 0;
+ lc.wolfFluxesSession = 0;
+ lc.wolfTimeSession = -1;
+ lc.wolfBossesSession = -1;
+ cf.deleteCategory("wolf");
+ cf.reloadConfig();
+ }
+
+ static void resetFishing() {
+ LootCommand lc = new LootCommand();
+ ConfigHandler cf = new ConfigHandler();
+ lc.seaCreaturesSession = 0;
+ lc.goodCatchesSession = 0;
+ lc.greatCatchesSession = 0;
+ lc.squidsSession = 0;
+ lc.seaWalkersSession = 0;
+ lc.nightSquidsSession = 0;
+ lc.seaGuardiansSession = 0;
+ lc.seaWitchesSession = 0;
+ lc.seaArchersSession = 0;
+ lc.monsterOfTheDeepsSession = 0;
+ lc.catfishesSession = 0;
+ lc.carrotKingsSession = 0;
+ lc.seaLeechesSession = 0;
+ lc.guardianDefendersSession = 0;
+ lc.deepSeaProtectorsSession = 0;
+ lc.hydrasSession = 0;
+ lc.seaEmperorsSession = 0;
+ lc.empTimeSession = -1;
+ lc.empSCsSession = -1;
+ lc.fishingMilestoneSession = 0;
+ lc.frozenStevesSession = 0;
+ lc.frostyTheSnowmansSession = 0;
+ lc.grinchesSession = 0;
+ lc.yetisSession = 0;
+ cf.deleteCategory("fishing");
+ cf.reloadConfig();
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java
new file mode 100644
index 0000000..f8c73c9
--- /dev/null
+++ b/src/main/java/me/Danker/commands/ScaleCommand.java
@@ -0,0 +1,70 @@
+package me.Danker.commands;
+
+import java.util.List;
+
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class ScaleCommand extends CommandBase {
+
+ public static double coordsScale;
+ public static double displayScale;
+
+ @Override
+ public String getCommandName() {
+ return "scale";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " <coords/display> <size (0.1 - 10)>";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return getListOfStringsMatchingLastWord(args, "coords", "display");
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer) arg0;
+
+ if (arg1.length < 2) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /scale <coords/display> <size (0.1 - 10)>"));
+ return;
+ }
+
+ double scaleAmount = (double) Math.floor(Double.parseDouble(arg1[1]) * 10.0) / 10.0;
+ if (scaleAmount < 0.1 || scaleAmount > 10.0) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Scale multipler can only be between 0.1x and 10x."));
+ return;
+ }
+
+ if (arg1[0].equalsIgnoreCase("coords")) {
+ coordsScale = scaleAmount;
+ ConfigHandler.writeDoubleConfig("scales", "coordsScale", coordsScale);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Coords have been scaled to " + EnumChatFormatting.DARK_GREEN + coordsScale + "x"));
+ } else if (arg1[0].equalsIgnoreCase("display")) {
+ displayScale = scaleAmount;
+ ConfigHandler.writeDoubleConfig("scales", "displayScale", displayScale);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Display has been scaled to " + EnumChatFormatting.DARK_GREEN + displayScale + "x"));
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /scale <coords/display> <size (0.1 - 10)>"));
+ }
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/SetkeyCommand.java b/src/main/java/me/Danker/commands/SetkeyCommand.java
new file mode 100644
index 0000000..f68ff75
--- /dev/null
+++ b/src/main/java/me/Danker/commands/SetkeyCommand.java
@@ -0,0 +1,43 @@
+package me.Danker.commands;
+
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class SetkeyCommand extends CommandBase implements ICommand {
+
+ @Override
+ public String getCommandName() {
+ return "setkey";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " <key>";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer)arg0;
+
+ if (arg1.length == 0) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /setkey <key>"));
+ return;
+ }
+
+ final ConfigHandler cf = new ConfigHandler();
+ cf.writeStringConfig("api", "APIKey", arg1[0]);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Set API key to " + EnumChatFormatting.DARK_GREEN + arg1[0]));
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java
new file mode 100644
index 0000000..5818772
--- /dev/null
+++ b/src/main/java/me/Danker/commands/SkillsCommand.java
@@ -0,0 +1,334 @@
+package me.Danker.commands;
+
+import java.util.List;
+
+import com.google.gson.JsonObject;
+
+import me.Danker.handlers.APIHandler;
+import me.Danker.handlers.ConfigHandler;
+import me.Danker.utils.Utils;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class SkillsCommand extends CommandBase {
+
+ static double xpToLevel(double xp) {
+ int level;
+ double progress;
+
+ if (xp < 50) {
+ level = 0;
+ progress = xp / 50;
+ } else if (xp < 175) {
+ level = 1;
+ progress = (xp - 50) / 125;
+ } else if (xp < 375) {
+ level = 2;
+ progress = (xp - 175) / 200;
+ } else if (xp < 675) {
+ level = 3;
+ progress = (xp - 375) / 300;
+ } else if (xp < 1175) {
+ level = 4;
+ progress = (xp - 675) / 500;
+ } else if (xp < 1925) {
+ level = 5;
+ progress = (xp - 1175) / 750;
+ } else if (xp < 2925) {
+ level = 6;
+ progress = (xp - 1925) / 1000;
+ } else if (xp < 4425) {
+ level = 7;
+ progress = (xp - 2925) / 1500;
+ } else if (xp < 6425) {
+ level = 8;
+ progress = (xp - 4425) / 2000;
+ } else if (xp < 9925) {
+ level = 9;
+ progress = (xp - 6425) / 3500;
+ } else if (xp < 14925) {
+ level = 10;
+ progress = (xp - 9925) / 5000;
+ } else if (xp < 22425) {
+ level = 11;
+ progress = (xp - 14925) / 7500;
+ } else if (xp < 32425) {
+ level = 12;
+ progress = (xp - 22425) / 10000;
+ } else if (xp < 47425) {
+ level = 13;
+ progress = (xp - 32425) / 15000;
+ } else if (xp < 67425) {
+ level = 14;
+ progress = (xp - 47425) / 20000;
+ } else if (xp < 97425) {
+ level = 15;
+ progress = (xp - 67425) / 30000;
+ } else if (xp < 147425) {
+ level = 16;
+ progress = (xp - 97425) / 50000;
+ } else if (xp < 222425) {
+ level = 17;
+ progress = (xp - 147425) / 75000;
+ } else if (xp < 322425) {
+ level = 18;
+ progress = (xp - 222425) / 100000;
+ } else if (xp < 522425) {
+ level = 19;
+ progress = (xp - 322425) / 200000;
+ } else if (xp < 822425) {
+ level = 20;
+ progress = (xp - 522425) / 300000;
+ } else if (xp < 1222425) {
+ level = 21;
+ progress = (xp - 822425) / 400000;
+ } else if (xp < 1722425) {
+ level = 22;
+ progress = (xp - 1222425) / 500000;
+ } else if (xp < 2322425) {
+ level = 23;
+ progress = (xp - 1722425) / 600000;
+ } else if (xp < 3022425) {
+ level = 24;
+ progress = (xp - 2322425) / 700000;
+ } else if (xp < 3822425) {
+ level = 25;
+ progress = (xp - 3022425) / 800000;
+ } else if (xp < 4722425) {
+ level = 26;
+ progress = (xp - 3822425) / 900000;
+ } else if (xp < 5722425) {
+ level = 27;
+ progress = (xp - 4722425) / 1000000;
+ } else if (xp < 6822425) {
+ level = 28;
+ progress = (xp - 5722425) / 1100000;
+ } else if (xp < 8022425) {
+ level = 29;
+ progress = (xp - 6822425) / 1200000;
+ } else if (xp < 9322425) {
+ level = 30;
+ progress = (xp - 8022425) / 1300000;
+ } else if (xp < 10722425) {
+ level = 31;
+ progress = (xp - 9322425) / 1400000;
+ } else if (xp < 12222425) {
+ level = 32;
+ progress = (xp - 10722425) / 1500000;
+ } else if (xp < 13822425) {
+ level = 33;
+ progress = (xp - 12222425) / 1600000;
+ } else if (xp < 15522425) {
+ level = 34;
+ progress = (xp - 13822425) / 1700000;
+ } else if (xp < 17322425) {
+ level = 35;
+ progress = (xp - 15522425) / 1800000;
+ } else if (xp < 19222425) {
+ level = 36;
+ progress = (xp - 17322425) / 1900000;
+ } else if (xp < 21222425) {
+ level = 37;
+ progress = (xp - 19222425) / 2000000;
+ } else if (xp < 23322425) {
+ level = 38;
+ progress = (xp - 21222425) / 2100000;
+ } else if (xp < 25522425) {
+ level = 39;
+ progress = (xp - 23322425) / 2200000;
+ } else if (xp < 27822425) {
+ level = 40;
+ progress = (xp - 25522425) / 2300000;
+ } else if (xp < 30222425) {
+ level = 41;
+ progress = (xp - 27822425) / 2400000;
+ } else if (xp < 32722425) {
+ level = 42;
+ progress = (xp - 30222425) / 2500000;
+ } else if (xp < 35322425) {
+ level = 43;
+ progress = (xp - 32722425) / 2600000;
+ } else if (xp < 38072425) {
+ level = 44;
+ progress = (xp - 35322425) / 2750000;
+ } else if (xp < 40972425) {
+ level = 45;
+ progress = (xp - 38072425) / 2900000;
+ } else if (xp < 44072425) {
+ level = 46;
+ progress = (xp - 40972425) / 3100000;
+ } else if (xp < 47472425) {
+ level = 47;
+ progress = (xp - 44072425) / 3400000;
+ } else if (xp < 51172425) {
+ level = 48;
+ progress = (xp - 47472425) / 3700000;
+ } else if (xp < 55172425) {
+ level = 49;
+ progress = (xp - 51172425) / 4000000;
+ } else {
+ level = 50;
+ progress = 0;
+ }
+
+ return level + progress;
+ }
+
+ @Override
+ public String getCommandName() {
+ return "skills";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " [name]";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return Utils.getMatchingPlayers(args[0]);
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ // MULTI THREAD DRIFTING
+ new Thread(() -> {
+ APIHandler ah = new APIHandler();
+ ConfigHandler cf = new ConfigHandler();
+ EntityPlayer player = (EntityPlayer) arg0;
+
+ // Check key
+ String key = cf.getString("api", "APIKey");
+ if (key.equals("")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey."));
+ }
+
+ // Get UUID for Hypixel API requests
+ String username;
+ String uuid;
+ if (arg1.length == 0) {
+ username = player.getName();
+ uuid = player.getUniqueID().toString().replaceAll("[\\-]", "");
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking skills of " + EnumChatFormatting.DARK_GREEN + username));
+ } else {
+ username = arg1[0];
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking skills of " + EnumChatFormatting.DARK_GREEN + username));
+ uuid = ah.getUUID(username);
+ }
+
+ // Find stats of latest profile
+ String latestProfile = ah.getLatestProfileID(uuid, key);
+ if (latestProfile == null) return;
+
+ String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key;
+ System.out.println("Fetching profile...");
+ JsonObject profileResponse = ah.getResponse(profileURL);
+ if (!profileResponse.get("success").getAsBoolean()) {
+ String reason = profileResponse.get("cause").getAsString();
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason));
+ return;
+ }
+
+ System.out.println("Fetching skills...");
+ JsonObject userObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject();
+
+ double farmingLevel = 0;
+ double miningLevel = 0;
+ double combatLevel = 0;
+ double foragingLevel = 0;
+ double fishingLevel = 0;
+ double enchantingLevel = 0;
+ double alchemyLevel = 0;
+ double tamingLevel = 0;
+
+ if (userObject.has("experience_skill_farming") || userObject.has("experience_skill_mining") || userObject.has("experience_skill_combat") || userObject.has("experience_skill_foraging") || userObject.has("experience_skill_fishing") || userObject.has("experience_skill_enchanting") || userObject.has("experience_skill_alchemy")) {
+ if (userObject.has("experience_skill_farming")) {
+ farmingLevel = xpToLevel(userObject.get("experience_skill_farming").getAsDouble());
+ farmingLevel = (double) Math.round(farmingLevel * 100) / 100;
+ }
+ if (userObject.has("experience_skill_mining")) {
+ miningLevel = xpToLevel(userObject.get("experience_skill_mining").getAsDouble());
+ miningLevel = (double) Math.round(miningLevel * 100) / 100;
+ }
+ if (userObject.has("experience_skill_combat")) {
+ combatLevel = xpToLevel(userObject.get("experience_skill_combat").getAsDouble());
+ combatLevel = (double) Math.round(combatLevel * 100) / 100;
+ }
+ if (userObject.has("experience_skill_foraging")) {
+ foragingLevel = xpToLevel(userObject.get("experience_skill_foraging").getAsDouble());
+ foragingLevel = (double) Math.round(foragingLevel * 100) / 100;
+ }
+ if (userObject.has("experience_skill_fishing")) {
+ fishingLevel = xpToLevel(userObject.get("experience_skill_fishing").getAsDouble());
+ fishingLevel = (double) Math.round(fishingLevel * 100) / 100;
+ }
+ if (userObject.has("experience_skill_enchanting")) {
+ enchantingLevel = xpToLevel(userObject.get("experience_skill_enchanting").getAsDouble());
+ enchantingLevel = (double) Math.round(enchantingLevel * 100) / 100;
+ }
+ if (userObject.has("experience_skill_alchemy")) {
+ alchemyLevel = xpToLevel(userObject.get("experience_skill_alchemy").getAsDouble());
+ alchemyLevel = (double) Math.round(alchemyLevel * 100) / 100;
+ }
+ if (userObject.has("experience_skill_taming")) {
+ tamingLevel = xpToLevel(userObject.get("experience_skill_taming").getAsDouble());
+ tamingLevel = (double) Math.round(tamingLevel * 100) / 100;
+ }
+ } else {
+ // Get skills from achievement API, will be floored
+
+ String playerURL = "https://api.hypixel.net/player?uuid=" + uuid + "&key=" + key;
+ System.out.println("Fetching skills from achievement API");
+ JsonObject playerObject = ah.getResponse(playerURL);
+
+ if (!playerObject.get("success").getAsBoolean()) {
+ String reason = profileResponse.get("cause").getAsString();
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason));
+ return;
+ }
+
+ JsonObject achievementObject = playerObject.get("player").getAsJsonObject().get("achievements").getAsJsonObject();
+ farmingLevel = achievementObject.get("skyblock_harvester").getAsInt();
+ miningLevel = achievementObject.get("skyblock_excavator").getAsInt();
+ combatLevel = achievementObject.get("skyblock_combat").getAsInt();
+ foragingLevel = achievementObject.get("skyblock_gatherer").getAsInt();
+ fishingLevel = achievementObject.get("skyblock_angler").getAsInt();
+ enchantingLevel = achievementObject.get("skyblock_augmentation").getAsInt();
+ alchemyLevel = achievementObject.get("skyblock_concoctor").getAsInt();
+ tamingLevel = achievementObject.get("skyblock_domesticator").getAsInt();
+ }
+
+ double skillAvg = (farmingLevel + miningLevel + combatLevel + foragingLevel + fishingLevel + enchantingLevel + alchemyLevel + tamingLevel) / 8;
+ skillAvg = (double) Math.round(skillAvg * 100) / 100;
+ double trueAvg = (Math.floor(farmingLevel) + Math.floor(miningLevel) + Math.floor(combatLevel) + Math.floor(foragingLevel) + Math.floor(fishingLevel) + Math.floor(enchantingLevel) + Math.floor(alchemyLevel) + Math.floor(tamingLevel)) / 8;
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.AQUA + " " + username + "'s Skills:\n" +
+ EnumChatFormatting.GREEN + " Farming: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + farmingLevel + "\n" +
+ EnumChatFormatting.GREEN + " Mining: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + miningLevel + "\n" +
+ EnumChatFormatting.GREEN + " Combat: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + combatLevel + "\n" +
+ EnumChatFormatting.GREEN + " Foraging: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + foragingLevel + "\n" +
+ EnumChatFormatting.GREEN + " Fishing: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + fishingLevel + "\n" +
+ EnumChatFormatting.GREEN + " Enchanting: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + enchantingLevel + "\n" +
+ EnumChatFormatting.GREEN + " Alchemy: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + alchemyLevel + "\n" +
+ EnumChatFormatting.GREEN + " Taming: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + tamingLevel + "\n" +
+ EnumChatFormatting.AQUA + " Average Skill Level: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + skillAvg + "\n" +
+ EnumChatFormatting.AQUA + " True Average Skill Level: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + trueAvg + "\n" +
+ EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------"));
+ }).start();
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/SlayerCommand.java b/src/main/java/me/Danker/commands/SlayerCommand.java
new file mode 100644
index 0000000..f8100b4
--- /dev/null
+++ b/src/main/java/me/Danker/commands/SlayerCommand.java
@@ -0,0 +1,112 @@
+package me.Danker.commands;
+
+import java.text.NumberFormat;
+import java.util.List;
+
+import com.google.gson.JsonObject;
+
+import me.Danker.handlers.APIHandler;
+import me.Danker.handlers.ConfigHandler;
+import me.Danker.utils.Utils;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class SlayerCommand extends CommandBase {
+
+ @Override
+ public String getCommandName() {
+ return "slayer";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " [name]";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return Utils.getMatchingPlayers(args[0]);
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ // MULTI THREAD DRIFTING
+ new Thread(() -> {
+ APIHandler ah = new APIHandler();
+ ConfigHandler cf = new ConfigHandler();
+ EntityPlayer player = (EntityPlayer) arg0;
+
+ // Check key
+ String key = cf.getString("api", "APIKey");
+ if (key.equals("")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey."));
+ }
+
+ // Get UUID for Hypixel API requests
+ String username;
+ String uuid;
+ if (arg1.length == 0) {
+ username = player.getName();
+ uuid = player.getUniqueID().toString().replaceAll("[\\-]", "");
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking slayer of " + EnumChatFormatting.DARK_GREEN + username));
+ } else {
+ username = arg1[0];
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Checking slayer of " + EnumChatFormatting.DARK_GREEN + username));
+ uuid = ah.getUUID(username);
+ }
+
+ // Find stats of latest profile
+ String latestProfile = ah.getLatestProfileID(uuid, key);
+ if (latestProfile == null) return;
+
+ String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key;
+ System.out.println("Fetching profile...");
+ JsonObject profileResponse = ah.getResponse(profileURL);
+ if (!profileResponse.get("success").getAsBoolean()) {
+ String reason = profileResponse.get("cause").getAsString();
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason));
+ return;
+ }
+
+ System.out.println("Fetching slayer stats...");
+ JsonObject slayersObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("slayer_bosses").getAsJsonObject();
+ // Zombie
+ int zombieXP = 0;
+ if (slayersObject.get("zombie").getAsJsonObject().has("xp")) {
+ zombieXP = slayersObject.get("zombie").getAsJsonObject().get("xp").getAsInt();
+ }
+ // Spider
+ int spiderXP = 0;
+ if (slayersObject.get("spider").getAsJsonObject().has("xp")) {
+ spiderXP = slayersObject.get("spider").getAsJsonObject().get("xp").getAsInt();
+ }
+ // Wolf
+ int wolfXP = 0;
+ if (slayersObject.get("wolf").getAsJsonObject().has("xp")) {
+ wolfXP = slayersObject.get("wolf").getAsJsonObject().get("xp").getAsInt();
+ }
+
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" +
+ EnumChatFormatting.AQUA + " " + username + "'s Total XP: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + NumberFormat.getIntegerInstance().format(zombieXP + spiderXP + wolfXP) + "\n" +
+ EnumChatFormatting.AQUA + " Zombie XP: " + EnumChatFormatting.BLUE + EnumChatFormatting.BOLD + NumberFormat.getIntegerInstance().format(zombieXP) + "\n" +
+ EnumChatFormatting.AQUA + " Spider XP: " + EnumChatFormatting.BLUE + EnumChatFormatting.BOLD + NumberFormat.getIntegerInstance().format(spiderXP) + "\n" +
+ EnumChatFormatting.AQUA + " Wolf XP: " + EnumChatFormatting.BLUE + EnumChatFormatting.BOLD + NumberFormat.getIntegerInstance().format(wolfXP) + "\n" +
+ EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------"));
+
+ }).start();
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java
new file mode 100644
index 0000000..decf99a
--- /dev/null
+++ b/src/main/java/me/Danker/commands/ToggleCommand.java
@@ -0,0 +1,83 @@
+package me.Danker.commands;
+
+import java.util.List;
+
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommand;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class ToggleCommand extends CommandBase implements ICommand {
+ public static boolean gpartyToggled;
+ public static boolean coordsToggled;
+ public static boolean goldenToggled;
+ public static boolean slayerCountTotal;
+ public static boolean rngesusAlerts;
+
+ @Override
+ public String getCommandName() {
+ return "toggle";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return getCommandName() + " <gparty/coords/golden/slayercount/rngesusalerts/list>";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "list");
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer)arg0;
+ final ConfigHandler cf = new ConfigHandler();
+
+ if (arg1.length == 0) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/list>"));
+ return;
+ }
+
+ if (arg1[0].equalsIgnoreCase("gparty")) {
+ gpartyToggled = !gpartyToggled;
+ cf.writeBooleanConfig("toggles", "GParty", gpartyToggled);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications has been set to " + EnumChatFormatting.DARK_GREEN + gpartyToggled + EnumChatFormatting.GREEN + "."));
+ } else if (arg1[0].equalsIgnoreCase("coords")) {
+ coordsToggled = !coordsToggled;
+ cf.writeBooleanConfig("toggles", "Coords", coordsToggled);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Coord/Angle display has been set to " + EnumChatFormatting.DARK_GREEN + coordsToggled + EnumChatFormatting.GREEN + "."));
+ } else if (arg1[0].equalsIgnoreCase("golden")) {
+ goldenToggled = !goldenToggled;
+ cf.writeBooleanConfig("toggles", "Golden", goldenToggled);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Golden T6 enchants has been set to " + EnumChatFormatting.DARK_GREEN + goldenToggled + EnumChatFormatting.GREEN + "."));
+ } else if (arg1[0].equalsIgnoreCase("slayercount")) {
+ slayerCountTotal = !slayerCountTotal;
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Counting total 20% slayer drops has been set to " + EnumChatFormatting.DARK_GREEN + slayerCountTotal + EnumChatFormatting.GREEN + "."));
+ } else if (arg1[0].equalsIgnoreCase("rngesusalerts")) {
+ rngesusAlerts = !rngesusAlerts;
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Slayer RNGesus alerts has been set to " + EnumChatFormatting.DARK_GREEN + rngesusAlerts + EnumChatFormatting.GREEN + "."));
+ } else if (arg1[0].equalsIgnoreCase("list")) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Guild party notifications: " + EnumChatFormatting.DARK_GREEN + gpartyToggled + "\n" +
+ EnumChatFormatting.GREEN + " Coord/Angle display: " + EnumChatFormatting.DARK_GREEN + coordsToggled + "\n" +
+ EnumChatFormatting.GREEN + " Golden T6 enchants: " + EnumChatFormatting.DARK_GREEN + goldenToggled + "\n" +
+ EnumChatFormatting.GREEN + " Counting total 20% slayer drops: " + EnumChatFormatting.DARK_GREEN + slayerCountTotal + "\n" +
+ EnumChatFormatting.GREEN + " Slayer RNGesus alerts: " + EnumChatFormatting.DARK_GREEN + rngesusAlerts));
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: /toggle <gparty/coords/golden/slayercount/rngesusalerts/list>"));
+ }
+ }
+}
diff --git a/src/main/java/me/Danker/handlers/APIHandler.java b/src/main/java/me/Danker/handlers/APIHandler.java
new file mode 100644
index 0000000..783ca92
--- /dev/null
+++ b/src/main/java/me/Danker/handlers/APIHandler.java
@@ -0,0 +1,141 @@
+package me.Danker.handlers;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class APIHandler {
+ public static JsonObject getResponse(String urlString) {
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+
+ try {
+ URL url = new URL(urlString);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestMethod("GET");
+
+ if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
+ BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ String input;
+ StringBuffer response = new StringBuffer();
+
+ while ((input = in.readLine()) != null) {
+ response.append(input);
+ }
+ in.close();
+
+ Gson gson = new Gson();
+ JsonObject object = gson.fromJson(response.toString(), JsonObject.class);
+
+ return object;
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Request failed. HTTP Error Code: " + conn.getResponseCode()));
+ }
+ } catch (MalformedURLException ex) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occured. See logs for more details."));
+ System.err.println(ex);
+ } catch (IOException ex) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occured. See logs for more details."));
+ System.err.println(ex);
+ }
+
+ return new JsonObject();
+ }
+
+ // Only used for UUID => Username
+ public static JsonArray getArrayResponse(String urlString) {
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+
+ try {
+ URL url = new URL(urlString);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestMethod("GET");
+
+ if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
+ BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ String input;
+ StringBuffer response = new StringBuffer();
+
+ while ((input = in.readLine()) != null) {
+ response.append(input);
+ }
+ in.close();
+
+ Gson gson = new Gson();
+ JsonArray array = gson.fromJson(response.toString(), JsonArray.class);
+
+ return array;
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Request failed. HTTP Error Code: " + conn.getResponseCode()));
+ }
+ } catch (MalformedURLException ex) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occured. See logs for more details."));
+ System.err.println(ex);
+ } catch (IOException ex) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occured. See logs for more details."));
+ System.err.println(ex);
+ }
+
+ return new JsonArray();
+ }
+
+ public static String getUUID(String username) {
+ Gson gson = new Gson();
+
+ JsonObject uuidResponse = getResponse("https://api.mojang.com/users/profiles/minecraft/" + username);
+ String UUID = uuidResponse.get("id").getAsString();
+ return UUID;
+ }
+
+ public static String getLatestProfileID(String UUID, String key) {
+ Gson gson = new Gson();
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+
+ // Get profiles
+ System.out.println("Fetching profiles...");
+
+ JsonObject profilesResponse = getResponse("https://api.hypixel.net/skyblock/profiles?uuid=" + UUID + "&key=" + key);
+ if (!profilesResponse.get("success").getAsBoolean()) {
+ String reason = profilesResponse.get("cause").getAsString();
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason));
+ return null;
+ }
+ if (profilesResponse.get("profiles").isJsonNull()) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This player doesn't appear to have played SkyBlock."));
+ return null;
+ }
+
+ // Loop through profiles to find latest
+ System.out.println("Looping through profiles...");
+ String latestProfile = "";
+ long latestSave = 0;
+ JsonArray profilesArray = profilesResponse.get("profiles").getAsJsonArray();
+
+ for (JsonElement profile : profilesArray) {
+ JsonObject profileJSON = profile.getAsJsonObject();
+ long profileLastSave = 1;
+ if (profileJSON.get("members").getAsJsonObject().get(UUID).getAsJsonObject().has("last_save")) {
+ profileLastSave = profileJSON.get("members").getAsJsonObject().get(UUID).getAsJsonObject().get("last_save").getAsLong();
+ }
+
+ if (profileLastSave > latestSave) {
+ latestProfile = profileJSON.get("profile_id").getAsString();
+ latestSave = profileLastSave;
+ }
+ }
+
+ return latestProfile;
+ }
+}
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
new file mode 100644
index 0000000..4fc4be5
--- /dev/null
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -0,0 +1,347 @@
+package me.Danker.handlers;
+
+import java.io.File;
+
+import me.Danker.commands.DisplayCommand;
+import me.Danker.commands.LootCommand;
+import me.Danker.commands.MoveCommand;
+import me.Danker.commands.ScaleCommand;
+import me.Danker.commands.ToggleCommand;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraftforge.common.config.ConfigCategory;
+import net.minecraftforge.common.config.Configuration;
+
+public class ConfigHandler {
+ public static Configuration config;
+ private static String file = "config/Danker's Skyblock Mod.cfg";
+
+ public static void init() {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ }
+
+ public static int getInt(String category, String key) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ if (config.getCategory(category).containsKey(key)) {
+ return config.get(category, key, 0).getInt();
+ }
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ return 0;
+ }
+
+ public static double getDouble(String category, String key) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ if (config.getCategory(category).containsKey(key)) {
+ return config.get(category, key, 0D).getDouble();
+ }
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ return 0D;
+ }
+
+ public static String getString(String category, String key) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ if (config.getCategory(category).containsKey(key)) {
+ return config.get(category, key, "").getString();
+ }
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ return "";
+ }
+
+ public static boolean getBoolean(String category, String key) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ if (config.getCategory(category).containsKey(key)) {
+ return config.get(category, key, false).getBoolean();
+ }
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ return true;
+ }
+
+ public static void writeIntConfig(String category, String key, int value) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ int set = config.get(category, key, value).getInt();
+ config.getCategory(category).get(key).set(value);
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ }
+
+ public static void writeDoubleConfig(String category, String key, double value) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ double set = config.get(category, key, value).getDouble();
+ config.getCategory(category).get(key).set(value);
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ }
+
+ public static void writeStringConfig(String category, String key, String value) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ String set = config.get(category, key, value).getString();
+ config.getCategory(category).get(key).set(value);
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ }
+
+ public static void writeBooleanConfig(String category, String key, boolean value) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ boolean set = config.get(category, key, value).getBoolean();
+ config.getCategory(category).get(key).set(value);
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ }
+
+ public static boolean hasKey(String category, String key) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ if (!config.hasCategory(category)) return false;
+ return config.getCategory(category).containsKey(key);
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ return false;
+ }
+
+ public static void deleteCategory(String category) {
+ config = new Configuration(new File(file));
+ try {
+ config.load();
+ if (config.hasCategory(category)) {
+ config.removeCategory(new ConfigCategory(category));
+ }
+ } catch (Exception ex) {
+ System.err.println(ex);
+ } finally {
+ config.save();
+ }
+ }
+
+ public static void reloadConfig() {
+ // Config init
+ if (!hasKey("toggles", "GParty")) writeBooleanConfig("toggles", "GParty", false);
+ if (!hasKey("toggles", "Coords")) writeBooleanConfig("toggles", "Coords", false);
+ if (!hasKey("toggles", "Golden")) writeBooleanConfig("toggles", "Golden", false);
+ if (!hasKey("toggles", "SlayerCount")) writeBooleanConfig("toggles", "SlayerCount", true);
+ if (!hasKey("toggles", "RNGesusAlerts")) writeBooleanConfig("toggles", "RNGesusAlerts", true);
+ if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", "");
+
+ // Wolf Loot
+ if (!hasKey("wolf", "svens")) writeIntConfig("wolf", "svens", 0);
+ if (!hasKey("wolf", "teeth")) writeIntConfig("wolf", "teeth", 0);
+ if (!hasKey("wolf", "wheel")) writeIntConfig("wolf", "wheel", 0);
+ if (!hasKey("wolf", "wheelDrops")) writeIntConfig("wolf", "wheelDrops", 0);
+ if (!hasKey("wolf", "spirit")) writeIntConfig("wolf", "spirit", 0);
+ if (!hasKey("wolf", "book")) writeIntConfig("wolf", "book", 0);
+ if (!hasKey("wolf", "egg")) writeIntConfig("wolf", "egg", 0);
+ if (!hasKey("wolf", "couture")) writeIntConfig("wolf", "couture", 0);
+ if (!hasKey("wolf", "bait")) writeIntConfig("wolf", "bait", 0);
+ if (!hasKey("wolf", "flux")) writeIntConfig("wolf", "flux", 0);
+ if (!hasKey("wolf", "timeRNG")) writeDoubleConfig("wolf", "timeRNG", -1);
+ if (!hasKey("wolf", "bossRNG")) writeIntConfig("wolf", "bossRNG", -1);
+ // Spider Loot
+ if (!hasKey("spider", "tarantulas")) writeIntConfig("spider", "tarantulas", 0);
+ if (!hasKey("spider", "web")) writeIntConfig("spider", "web", 0);
+ if (!hasKey("spider", "tap")) writeIntConfig("spider", "tap", 0);
+ if (!hasKey("spider", "tapDrops")) writeIntConfig("spider", "tapDrops", 0);
+ if (!hasKey("spider", "bite")) writeIntConfig("spider", "bite", 0);
+ if (!hasKey("spider", "catalyst")) writeIntConfig("spider", "catalyst", 0);
+ if (!hasKey("spider", "book")) writeIntConfig("spider", "book", 0);
+ if (!hasKey("spider", "swatter")) writeIntConfig("spider", "swatter", 0);
+ if (!hasKey("spider", "talisman")) writeIntConfig("spider", "talisman", 0);
+ if (!hasKey("spider", "mosquito")) writeIntConfig("spider", "mosquito", 0);
+ if (!hasKey("spider", "timeRNG")) writeDoubleConfig("spider", "timeRNG", -1);
+ if (!hasKey("spider", "bossRNG")) writeIntConfig("spider", "bossRNG", -1);
+ // Zombie Loot
+ if (!hasKey("zombie", "revs")) writeIntConfig("zombie", "revs", 0);
+ if (!hasKey("zombie", "revFlesh")) writeIntConfig("zombie", "revFlesh", 0);
+ if (!hasKey("zombie", "foulFlesh")) writeIntConfig("zombie", "foulFlesh", 0);
+ if (!hasKey("zombie", "foulFleshDrops")) writeIntConfig("zombie", "foulFleshDrops", 0);
+ if (!hasKey("zombie", "pestilence")) writeIntConfig("zombie", "pestilence", 0);
+ if (!hasKey("zombie", "undeadCatalyst")) writeIntConfig("zombie", "undeadCatalyst", 0);
+ if (!hasKey("zombie", "book")) writeIntConfig("zombie", "book", 0);
+ if (!hasKey("zombie", "beheaded")) writeIntConfig("zombie", "beheaded", 0);
+ if (!hasKey("zombie", "revCatalyst")) writeIntConfig("zombie", "revCatalyst", 0);
+ if (!hasKey("zombie", "snake")) writeIntConfig("zombie", "snake", 0);
+ if (!hasKey("zombie", "scythe")) writeIntConfig("zombie", "scythe", 0);
+ if (!hasKey("zombie", "timeRNG")) writeDoubleConfig("zombie", "timeRNG", -1);
+ if (!hasKey("zombie", "bossRNG")) writeIntConfig("zombie", "bossRNG", -1);
+
+ // Fishing
+ if (!hasKey("fishing", "seaCreature")) writeIntConfig("fishing", "seaCreature", 0);
+ if (!hasKey("fishing", "goodCatch")) writeIntConfig("fishing", "goodCatch", 0);
+ if (!hasKey("fishing", "greatCatch")) writeIntConfig("fishing", "greatCatch", 0);
+ if (!hasKey("fishing", "squid")) writeIntConfig("fishing", "squid", 0);
+ if (!hasKey("fishing", "seaWalker")) writeIntConfig("fishing", "seaWalker", 0);
+ if (!hasKey("fishing", "nightSquid")) writeIntConfig("fishing", "nightSquid", 0);
+ if (!hasKey("fishing", "seaGuardian")) writeIntConfig("fishing", "seaGuardian", 0);
+ if (!hasKey("fishing", "seaWitch")) writeIntConfig("fishing", "seaWitch", 0);
+ if (!hasKey("fishing", "seaArcher")) writeIntConfig("fishing", "seaArcher", 0);
+ if (!hasKey("fishing", "monsterOfDeep")) writeIntConfig("fishing", "monsterOfDeep", 0);
+ if (!hasKey("fishing", "catfish")) writeIntConfig("fishing", "catfish", 0);
+ if (!hasKey("fishing", "carrotKing")) writeIntConfig("fishing", "carrotKing", 0);
+ if (!hasKey("fishing", "seaLeech")) writeIntConfig("fishing", "seaLeech", 0);
+ if (!hasKey("fishing", "guardianDefender")) writeIntConfig("fishing", "guardianDefender", 0);
+ if (!hasKey("fishing", "deepSeaProtector")) writeIntConfig("fishing", "deepSeaProtector", 0);
+ if (!hasKey("fishing", "hydra")) writeIntConfig("fishing", "hydra", 0);
+ if (!hasKey("fishing", "seaEmperor")) writeIntConfig("fishing", "seaEmperor", 0);
+ if (!hasKey("fishing", "empTime")) writeDoubleConfig("fishing", "empTime", -1);
+ if (!hasKey("fishing", "empSC")) writeIntConfig("fishing", "empSC", -1);
+ if (!hasKey("fishing", "milestone")) writeIntConfig("fishing", "milestone", 0);
+ // Fishing Winter
+ if (!hasKey("fishing", "frozenSteve")) writeIntConfig("fishing", "frozenSteve", 0);
+ if (!hasKey("fishing", "snowman")) writeIntConfig("fishing", "snowman", 0);
+ if (!hasKey("fishing", "grinch")) writeIntConfig("fishing", "grinch", 0);
+ if (!hasKey("fishing", "yeti")) writeIntConfig("fishing", "yeti", 0);
+
+ if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off");
+
+ ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft());
+ int height = scaled.getScaledHeight();
+ if (!hasKey("locations", "coordsX")) writeIntConfig("locations", "coordsX", 5);
+ if (!hasKey("locations", "coordsY")) writeIntConfig("locations", "coordsY", height - 25);
+ if (!hasKey("locations", "displayX")) writeIntConfig("locations", "displayX", 80);
+ if (!hasKey("locations", "displayY")) writeIntConfig("locations", "displayY", 5);
+ if (!hasKey("scales", "coordsScale")) writeDoubleConfig("scales", "coordsScale", 1);
+ if (!hasKey("scales", "displayScale")) writeDoubleConfig("scales", "displayScale", 1);
+
+ final ToggleCommand tf = new ToggleCommand();
+ tf.gpartyToggled = getBoolean("toggles", "GParty");
+ tf.coordsToggled = getBoolean("toggles", "Coords");
+ tf.goldenToggled = getBoolean("toggles", "Golden");
+ tf.slayerCountTotal = getBoolean("toggles", "SlayerCount");
+ tf.rngesusAlerts = getBoolean("toggles", "RNGesusAlerts");
+
+ final LootCommand lc = new LootCommand();
+ // Wolf
+ lc.wolfSvens = getInt("wolf", "svens");
+ lc.wolfTeeth = getInt("wolf", "teeth");
+ lc.wolfWheels = getInt("wolf", "wheel");
+ lc.wolfWheelsDrops = getInt("wolf", "wheelDrops");
+ lc.wolfSpirits = getInt("wolf", "spirit");
+ lc.wolfBooks = getInt("wolf", "book");
+ lc.wolfEggs = getInt("wolf", "egg");
+ lc.wolfCoutures = getInt("wolf", "couture");
+ lc.wolfBaits = getInt("wolf", "bait");
+ lc.wolfFluxes = getInt("wolf", "flux");
+ lc.wolfTime = getDouble("wolf", "timeRNG");
+ lc.wolfBosses = getInt("wolf", "bossRNG");
+ // Spider
+ lc.spiderTarantulas = getInt("spider", "tarantulas");
+ lc.spiderWebs = getInt("spider", "web");
+ lc.spiderTAP = getInt("spider", "tap");
+ lc.spiderTAPDrops = getInt("spider", "tapDrops");
+ lc.spiderBites = getInt("spider", "bite");
+ lc.spiderCatalysts = getInt("spider", "catalyst");
+ lc.spiderBooks = getInt("spider", "book");
+ lc.spiderSwatters = getInt("spider", "swatter");
+ lc.spiderTalismans = getInt("spider", "talisman");
+ lc.spiderMosquitos = getInt("spider", "mosquito");
+ lc.spiderTime = getDouble("spider", "timeRNG");
+ lc.spiderBosses = getInt("spider", "bossRNG");
+ // Zombie
+ lc.zombieRevs = getInt("zombie", "revs");
+ lc.zombieRevFlesh = getInt("zombie", "revFlesh");
+ lc.zombieFoulFlesh = getInt("zombie", "foulFlesh");
+ lc.zombieFoulFleshDrops = getInt("zombie", "foulFleshDrops");
+ lc.zombiePestilences = getInt("zombie", "pestilence");
+ lc.zombieUndeadCatas = getInt("zombie", "undeadCatalyst");
+ lc.zombieBooks = getInt("zombie", "book");
+ lc.zombieBeheadeds = getInt("zombie", "beheaded");
+ lc.zombieRevCatas = getInt("zombie", "revCatalyst");
+ lc.zombieSnakes = getInt("zombie", "snake");
+ lc.zombieScythes = getInt("zombie", "scythe");
+ lc.zombieTime = getDouble("zombie", "timeRNG");
+ lc.zombieBosses = getInt("zombie", "bossRNG");
+
+ // Fishing
+ lc.seaCreatures = getInt("fishing", "seaCreature");
+ lc.goodCatches = getInt("fishing", "goodCatch");
+ lc.greatCatches = getInt("fishing", "greatCatch");
+ lc.squids = getInt("fishing", "squid");
+ lc.seaWalkers = getInt("fishing", "seaWalker");
+ lc.nightSquids = getInt("fishing", "nightSquid");
+ lc.seaGuardians = getInt("fishing", "seaGuardian");
+ lc.seaWitches = getInt("fishing", "seaWitch");
+ lc.seaArchers = getInt("fishing", "seaArcher");
+ lc.monsterOfTheDeeps = getInt("fishing", "monsterOfDeep");
+ lc.catfishes = getInt("fishing", "catfish");
+ lc.seaLeeches = getInt("fishing", "seaLeech");
+ lc.guardianDefenders = getInt("fishing", "guardianDefender");
+ lc.deepSeaProtectors = getInt("fishing", "deepSeaProtector");
+ lc.hydras = getInt("fishing", "hydra");
+ lc.seaEmperors = getInt("fishing", "seaEmperor");
+ lc.empTime = getDouble("fishing", "empTime");
+ lc.empSCs = getInt("fishing", "empSC");
+ lc.fishingMilestone = getInt("fishing", "milestone");
+ // Fishing Winter
+ lc.frozenSteves = getInt("fishing", "frozenSteve");
+ lc.frostyTheSnowmans = getInt("fishing", "snowman");
+ lc.grinches = getInt("fishing", "grinch");
+ lc.yetis = getInt("fishing", "yeti");
+
+ final DisplayCommand ds = new DisplayCommand();
+ ds.display = getString("misc", "display");
+
+ final MoveCommand moc = new MoveCommand();
+ moc.coordsXY[0] = getInt("locations", "coordsX");
+ moc.coordsXY[1] = getInt("locations", "coordsY");
+ moc.displayXY[0] = getInt("locations", "displayX");
+ moc.displayXY[1] = getInt("locations", "displayY");
+
+ final ScaleCommand sc = new ScaleCommand();
+ sc.coordsScale = getDouble("scales", "coordsScale");
+ sc.displayScale = getDouble("scales", "displayScale");
+ }
+
+}
diff --git a/src/main/java/me/Danker/handlers/ScoreboardHandler.java b/src/main/java/me/Danker/handlers/ScoreboardHandler.java
new file mode 100644
index 0000000..e89591b
--- /dev/null
+++ b/src/main/java/me/Danker/handlers/ScoreboardHandler.java
@@ -0,0 +1,60 @@
+package me.Danker.handlers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.scoreboard.Score;
+import net.minecraft.scoreboard.ScoreObjective;
+import net.minecraft.scoreboard.ScorePlayerTeam;
+import net.minecraft.scoreboard.Scoreboard;
+import net.minecraft.util.StringUtils;
+
+public class ScoreboardHandler {
+
+ public static String cleanSB(String scoreboard) {
+ char[] nvString = StringUtils.stripControlCodes(scoreboard).toCharArray();
+ StringBuilder cleaned = new StringBuilder();
+
+ for (char c : nvString) {
+ if ((int) c > 20 && (int) c < 127) {
+ cleaned.append(c);
+ }
+ }
+
+ return cleaned.toString();
+ }
+
+ public static List<String> getSidebarLines() {
+ List<String> lines = new ArrayList<>();
+ Scoreboard scoreboard = Minecraft.getMinecraft().theWorld.getScoreboard();
+ if (scoreboard == null) return lines;
+
+ ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(1);
+ if (objective == null) return lines;
+
+ Collection<Score> scores = scoreboard.getSortedScores(objective);
+ List<Score> list = Lists.newArrayList(scores.stream()
+ .filter(input -> input != null && input.getPlayerName() != null && !input.getPlayerName()
+ .startsWith("#"))
+ .collect(Collectors.toList()));
+
+ if (list.size() > 15) {
+ scores = Lists.newArrayList(Iterables.skip(list, scores.size() - 15));
+ } else {
+ scores = list;
+ }
+
+ for (Score score : scores) {
+ ScorePlayerTeam team = scoreboard.getPlayersTeam(score.getPlayerName());
+ lines.add(ScorePlayerTeam.formatPlayerName(team, score.getPlayerName()));
+ }
+
+ return lines;
+ }
+}
diff --git a/src/main/java/me/Danker/handlers/TextRenderer.java b/src/main/java/me/Danker/handlers/TextRenderer.java
new file mode 100644
index 0000000..bf5711d
--- /dev/null
+++ b/src/main/java/me/Danker/handlers/TextRenderer.java
@@ -0,0 +1,20 @@
+package me.Danker.handlers;
+
+import org.lwjgl.opengl.GL11;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+
+public class TextRenderer extends Gui {
+ public TextRenderer(Minecraft mc, String text, int x, int y, double scale) {
+ double scaleReset = (double) Math.pow(scale, -1);
+
+ GL11.glScaled(scale, scale, scale);
+ y -= mc.fontRendererObj.FONT_HEIGHT;
+ for (String line : text.split("\n")) {
+ y += mc.fontRendererObj.FONT_HEIGHT * scale;
+ drawString(mc.fontRendererObj, line, (int) Math.round(x / scale), (int) Math.round(y / scale), 0xFFFFFF);
+ }
+ GL11.glScaled(scaleReset, scaleReset, scaleReset);
+ }
+}
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java
new file mode 100644
index 0000000..4749305
--- /dev/null
+++ b/src/main/java/me/Danker/utils/Utils.java
@@ -0,0 +1,88 @@
+package me.Danker.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+
+import me.Danker.TheMod;
+import me.Danker.handlers.TextRenderer;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.StringUtils;
+
+public class Utils {
+
+ public static int getItems(String item) {
+ Minecraft mc = Minecraft.getMinecraft();
+ EntityPlayer player = mc.thePlayer;
+
+ double x = player.posX;
+ double y = player.posY;
+ double z = player.posZ;
+ AxisAlignedBB scan = new AxisAlignedBB(x - 6, y - 6, z - 6, x + 6, y + 6, z + 6);
+ List<EntityItem> items = mc.theWorld.getEntitiesWithinAABB(EntityItem.class, scan);
+
+ for (EntityItem i : items) {
+ String itemName = StringUtils.stripControlCodes(i.getEntityItem().getDisplayName());
+ if (itemName.equals(item)) return i.getEntityItem().stackSize;
+ }
+ // No items found
+ return 0;
+ }
+
+ public static String returnGoldenEnchants(String line) {
+ Matcher matcher = TheMod.pattern.matcher(line);
+ StringBuffer out = new StringBuffer();
+
+ while (matcher.find()) {
+ matcher.appendReplacement(out, TheMod.t6Enchants.get(matcher.group(1)));
+ }
+ matcher.appendTail(out);
+
+ return out.toString();
+ }
+
+ public static List<String> getMatchingPlayers(String arg) {
+ List<String> matchingPlayers = new ArrayList<>();
+ List<EntityPlayer> players = Minecraft.getMinecraft().theWorld.playerEntities;
+
+ for (EntityPlayer player : players) {
+ String playerName = player.getName();
+ if (playerName.toLowerCase().startsWith(arg.toLowerCase())) {
+ matchingPlayers.add(playerName);
+ }
+ }
+
+ return matchingPlayers;
+ }
+
+ public static void createTitle(String text, int seconds) {
+ Minecraft.getMinecraft().thePlayer.playSound("random.orb", 1, (float) 0.5);
+ TheMod.titleTimer = seconds * 20;
+ TheMod.showTitle = true;
+ TheMod.titleText = text;
+ }
+
+ public static void drawTitle(String text) {
+ Minecraft mc = Minecraft.getMinecraft();
+ ScaledResolution scaledResolution = new ScaledResolution(mc);
+
+ int height = scaledResolution.getScaledHeight();
+ int width = scaledResolution.getScaledWidth();
+ int textLength = mc.fontRendererObj.getStringWidth(text);
+
+ double scale = 4;
+ if (textLength * scale > (width * 0.9F)) {
+ scale = (width * 0.9F) / (float) textLength;
+ }
+
+ int titleX = (int) ((width / 2) - (textLength * scale / 2));
+ int titleY = (int) ((height * 0.45) / scale);
+ new TextRenderer(mc, text, titleX, titleY, scale);
+ }
+
+}
diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info
new file mode 100644
index 0000000..6070c23
--- /dev/null
+++ b/src/main/resources/mcmod.info
@@ -0,0 +1,12 @@
+[
+{
+ "modid": "Danker's Skyblock Mod",
+ "name": "Danker's Skyblock Mod",
+ "description": "QOL changes that enhances your Hypixel Skyblock experience.",
+ "version": "${version}",
+ "mcversion": "${mcversion}",
+ "url": "https://github.com/bowser0000/SkyblockMod",
+ "authorList": ["Danker"],
+ "credits": "smyt for parsing scoreboard info."
+}
+]