diff options
Diffstat (limited to 'src/main/java/me/Danker/commands')
20 files changed, 334 insertions, 387 deletions
diff --git a/src/main/java/me/Danker/commands/ArmourCommand.java b/src/main/java/me/Danker/commands/ArmourCommand.java index 44255e8..a10d75f 100644 --- a/src/main/java/me/Danker/commands/ArmourCommand.java +++ b/src/main/java/me/Danker/commands/ArmourCommand.java @@ -32,8 +32,7 @@ public class ArmourCommand extends CommandBase { } @Override - public List<String> getCommandAliases() - { + public List<String> getCommandAliases() { return Collections.singletonList("armour"); } @@ -59,12 +58,10 @@ public class ArmourCommand extends CommandBase { 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"); + String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey.")); } @@ -79,16 +76,16 @@ public class ArmourCommand extends CommandBase { } else { username = arg1[0]; player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking armour of " + TheMod.SECONDARY_COLOUR + username)); - uuid = ah.getUUID(username); + uuid = APIHandler.getUUID(username); } // Find stats of latest profile - String latestProfile = ah.getLatestProfileID(uuid, key); + String latestProfile = APIHandler.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); + JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); diff --git a/src/main/java/me/Danker/commands/BankCommand.java b/src/main/java/me/Danker/commands/BankCommand.java index f832a2d..6e2ddaa 100644 --- a/src/main/java/me/Danker/commands/BankCommand.java +++ b/src/main/java/me/Danker/commands/BankCommand.java @@ -53,12 +53,10 @@ public class BankCommand extends CommandBase { 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"); + String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "API key not set. Use /setkey.")); } @@ -73,16 +71,16 @@ public class BankCommand extends CommandBase { } else { username = arg1[0]; player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking coins of " + TheMod.SECONDARY_COLOUR + username)); - uuid = ah.getUUID(username); + uuid = APIHandler.getUUID(username); } // Find stats of latest profile - String latestProfile = ah.getLatestProfileID(uuid, key); + String latestProfile = APIHandler.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); + JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason)); diff --git a/src/main/java/me/Danker/commands/BlockSlayerCommand.java b/src/main/java/me/Danker/commands/BlockSlayerCommand.java index bc6a32b..96ea530 100644 --- a/src/main/java/me/Danker/commands/BlockSlayerCommand.java +++ b/src/main/java/me/Danker/commands/BlockSlayerCommand.java @@ -10,7 +10,6 @@ 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 BlockSlayerCommand extends CommandBase { @@ -45,7 +44,6 @@ public class BlockSlayerCommand extends CommandBase { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { final EntityPlayer player = (EntityPlayer)arg0; - final ConfigHandler cf = new ConfigHandler(); if (arg1.length == 0 || (arg1.length == 1 && !arg1[0].equalsIgnoreCase("off"))) { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); @@ -61,7 +59,7 @@ public class BlockSlayerCommand extends CommandBase { } else if (arg1[0].equalsIgnoreCase("off")) { onlySlayerName = ""; onlySlayerNumber = ""; - cf.writeStringConfig("toggles", "BlockSlayer", ""); + ConfigHandler.writeStringConfig("toggles", "BlockSlayer", ""); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Slayer blocking turned off.")); return; } else { @@ -91,7 +89,7 @@ public class BlockSlayerCommand extends CommandBase { return; } - cf.writeStringConfig("toggles", "BlockSlayer", onlySlayerName + " " + onlySlayerNumber); + ConfigHandler.writeStringConfig("toggles", "BlockSlayer", onlySlayerName + " " + onlySlayerNumber); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Slayer blocking set to " + TheMod.SECONDARY_COLOUR + onlySlayerName + " " + onlySlayerNumber)); } diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index ef39d24..3616849 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -1,8 +1,6 @@ package me.Danker.commands; import me.Danker.TheMod; -import me.Danker.gui.DankerGui; -import net.minecraft.client.Minecraft; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; diff --git a/src/main/java/me/Danker/commands/DisplayCommand.java b/src/main/java/me/Danker/commands/DisplayCommand.java index 6e00fba..2af402e 100644 --- a/src/main/java/me/Danker/commands/DisplayCommand.java +++ b/src/main/java/me/Danker/commands/DisplayCommand.java @@ -10,7 +10,6 @@ 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; @@ -54,7 +53,6 @@ public class DisplayCommand extends CommandBase { return; } - final ConfigHandler cf = new ConfigHandler(); boolean showSession = false; if (arg1[arg1.length - 1].equalsIgnoreCase("session")) showSession = true; @@ -151,7 +149,7 @@ public class DisplayCommand extends CommandBase { } else if (arg1[0].equalsIgnoreCase("auto")) { auto = true; player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Display set to " + TheMod.SECONDARY_COLOUR + "auto" + TheMod.MAIN_COLOUR + ".")); - cf.writeBooleanConfig("misc", "autoDisplay", true); + ConfigHandler.writeBooleanConfig("misc", "autoDisplay", true); return; } else if (arg1[0].equalsIgnoreCase("off")) { display = "off"; @@ -161,8 +159,8 @@ public class DisplayCommand extends CommandBase { } auto = false; player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Display set to " + TheMod.SECONDARY_COLOUR + display + TheMod.MAIN_COLOUR + ".")); - cf.writeBooleanConfig("misc", "autoDisplay", false); - cf.writeStringConfig("misc", "display", display); + ConfigHandler.writeBooleanConfig("misc", "autoDisplay", false); + ConfigHandler.writeStringConfig("misc", "display", display); } } diff --git a/src/main/java/me/Danker/commands/DungeonsCommand.java b/src/main/java/me/Danker/commands/DungeonsCommand.java index 7a57400..4b8c126 100644 --- a/src/main/java/me/Danker/commands/DungeonsCommand.java +++ b/src/main/java/me/Danker/commands/DungeonsCommand.java @@ -45,12 +45,10 @@ public class DungeonsCommand extends CommandBase { 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"); + String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } @@ -65,16 +63,16 @@ public class DungeonsCommand extends CommandBase { } else { username = arg1[0]; player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking dungeon stats of " + TheMod.SECONDARY_COLOUR + username)); - uuid = ah.getUUID(username); + uuid = APIHandler.getUUID(username); } // Find stats of latest profile - String latestProfile = ah.getLatestProfileID(uuid, key); + String latestProfile = APIHandler.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); + JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); diff --git a/src/main/java/me/Danker/commands/GetkeyCommand.java b/src/main/java/me/Danker/commands/GetkeyCommand.java index 32fa6df..e7dd051 100644 --- a/src/main/java/me/Danker/commands/GetkeyCommand.java +++ b/src/main/java/me/Danker/commands/GetkeyCommand.java @@ -12,7 +12,6 @@ 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 { @@ -34,16 +33,15 @@ public class GetkeyCommand extends CommandBase implements ICommand { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { EntityPlayer player = (EntityPlayer)arg0; - ConfigHandler cf = new ConfigHandler(); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); - StringSelection stringSelection = new StringSelection(cf.getString("api", "APIKey")); + StringSelection stringSelection = new StringSelection(ConfigHandler.getString("api", "APIKey")); - if (cf.getString("api", "APIKey").equals("")) { + if (ConfigHandler.getString("api", "APIKey").equals("")) { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Set your API key using /setkey.")); } clipboard.setContents(stringSelection, null); - player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Your set API key is " + TheMod.SECONDARY_COLOUR + cf.getString("api", "APIKey") + "\n" + + player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Your set API key is " + TheMod.SECONDARY_COLOUR + ConfigHandler.getString("api", "APIKey") + "\n" + TheMod.MAIN_COLOUR + " Your set API key has been copied to the clipboard.")); } diff --git a/src/main/java/me/Danker/commands/GuildOfCommand.java b/src/main/java/me/Danker/commands/GuildOfCommand.java index 44fb783..881a9c4 100644 --- a/src/main/java/me/Danker/commands/GuildOfCommand.java +++ b/src/main/java/me/Danker/commands/GuildOfCommand.java @@ -47,12 +47,10 @@ public class GuildOfCommand extends CommandBase { 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"); + String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } @@ -67,13 +65,13 @@ public class GuildOfCommand extends CommandBase { } else { username = arg1[0]; player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking guild of " + TheMod.SECONDARY_COLOUR + username)); - uuid = ah.getUUID(username); + uuid = APIHandler.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); + JsonObject guildResponse = APIHandler.getResponse(guildURL); if (!guildResponse.get("success").getAsBoolean()) { String reason = guildResponse.get("cause").getAsString(); player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); @@ -100,7 +98,7 @@ public class GuildOfCommand extends CommandBase { // 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); + JsonArray gmNameResponse = APIHandler.getArrayResponse(gmNameURL); guildMaster = gmNameResponse.get(gmNameResponse.size() - 1).getAsJsonObject().get("name").getAsString(); break; diff --git a/src/main/java/me/Danker/commands/ImportFishingCommand.java b/src/main/java/me/Danker/commands/ImportFishingCommand.java index 67e4c61..734a561 100644 --- a/src/main/java/me/Danker/commands/ImportFishingCommand.java +++ b/src/main/java/me/Danker/commands/ImportFishingCommand.java @@ -10,7 +10,6 @@ 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 { @@ -33,13 +32,10 @@ public class ImportFishingCommand extends CommandBase { 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"); + String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } @@ -50,12 +46,12 @@ public class ImportFishingCommand extends CommandBase { String username = player.getName(); String uuid = player.getUniqueID().toString().replaceAll("[\\-]", ""); - String latestProfile = ah.getLatestProfileID(uuid, key); + String latestProfile = APIHandler.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); + JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); @@ -65,230 +61,230 @@ public class ImportFishingCommand extends CommandBase { 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; + LootCommand.greatCatches = 0; + LootCommand.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; + LootCommand.greatCatches = statsObject.get("items_fished_large_treasure").getAsInt(); + LootCommand.goodCatches = statsObject.get("items_fished_treasure").getAsInt() - LootCommand.greatCatches; } else { - lc.goodCatches = statsObject.get("items_fished_treasure").getAsInt(); + LootCommand.goodCatches = statsObject.get("items_fished_treasure").getAsInt(); } } - lc.seaCreatures = 0; - lc.squids = 0; + LootCommand.seaCreatures = 0; + LootCommand.squids = 0; if (statsObject.has("kills_pond_squid")) { - lc.squids = statsObject.get("kills_pond_squid").getAsInt(); + LootCommand.squids = statsObject.get("kills_pond_squid").getAsInt(); } - lc.seaCreatures += lc.squids; + LootCommand.seaCreatures += LootCommand.squids; - lc.seaWalkers = 0; + LootCommand.seaWalkers = 0; if (statsObject.has("kills_sea_walker")) { - lc.seaWalkers = statsObject.get("kills_sea_walker").getAsInt(); + LootCommand.seaWalkers = statsObject.get("kills_sea_walker").getAsInt(); } - lc.seaCreatures += lc.seaWalkers; + LootCommand.seaCreatures += LootCommand.seaWalkers; - lc.nightSquids = 0; + LootCommand.nightSquids = 0; if (statsObject.has("kills_night_squid")) { - lc.nightSquids = statsObject.get("kills_night_squid").getAsInt(); + LootCommand.nightSquids = statsObject.get("kills_night_squid").getAsInt(); } - lc.seaCreatures += lc.nightSquids; + LootCommand.seaCreatures += LootCommand.nightSquids; - lc.seaGuardians = 0; + LootCommand.seaGuardians = 0; if (statsObject.has("kills_sea_guardian")) { - lc.seaGuardians = statsObject.get("kills_sea_guardian").getAsInt(); + LootCommand.seaGuardians = statsObject.get("kills_sea_guardian").getAsInt(); } - lc.seaCreatures += lc.seaGuardians; + LootCommand.seaCreatures += LootCommand.seaGuardians; - lc.seaWitches = 0; + LootCommand.seaWitches = 0; if (statsObject.has("kills_sea_witch")) { - lc.seaWitches = statsObject.get("kills_sea_witch").getAsInt(); + LootCommand.seaWitches = statsObject.get("kills_sea_witch").getAsInt(); } - lc.seaCreatures += lc.seaWitches; + LootCommand.seaCreatures += LootCommand.seaWitches; - lc.seaArchers = 0; + LootCommand.seaArchers = 0; if (statsObject.has("kills_sea_archer")) { - lc.seaArchers = statsObject.get("kills_sea_archer").getAsInt(); + LootCommand.seaArchers = statsObject.get("kills_sea_archer").getAsInt(); } - lc.seaCreatures += lc.seaArchers; + LootCommand.seaCreatures += LootCommand.seaArchers; - lc.monsterOfTheDeeps = 0; + LootCommand.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(); + LootCommand.monsterOfTheDeeps = statsObject.get("kills_zombie_deep").getAsInt() + statsObject.get("kills_chicken_deep").getAsInt(); } else { - lc.monsterOfTheDeeps = statsObject.get("kills_zombie_deep").getAsInt(); + LootCommand.monsterOfTheDeeps = statsObject.get("kills_zombie_deep").getAsInt(); } } else if (statsObject.has("kills_chicken_deep")) { - lc.monsterOfTheDeeps = statsObject.get("kills_chicken_deep").getAsInt(); + LootCommand.monsterOfTheDeeps = statsObject.get("kills_chicken_deep").getAsInt(); } - lc.seaCreatures += lc.monsterOfTheDeeps; + LootCommand.seaCreatures += LootCommand.monsterOfTheDeeps; - lc.catfishes = 0; + LootCommand.catfishes = 0; if (statsObject.has("kills_catfish")) { - lc.catfishes = statsObject.get("kills_catfish").getAsInt(); + LootCommand.catfishes = statsObject.get("kills_catfish").getAsInt(); } - lc.seaCreatures += lc.catfishes; + LootCommand.seaCreatures += LootCommand.catfishes; - lc.carrotKings = 0; + LootCommand.carrotKings = 0; if (statsObject.has("kills_carrot_king")) { - lc.carrotKings = statsObject.get("kills_carrot_king").getAsInt(); + LootCommand.carrotKings = statsObject.get("kills_carrot_king").getAsInt(); } - lc.seaCreatures += lc.carrotKings; + LootCommand.seaCreatures += LootCommand.carrotKings; - lc.seaLeeches = 0; + LootCommand.seaLeeches = 0; if (statsObject.has("kills_sea_leech")) { - lc.seaLeeches = statsObject.get("kills_sea_leech").getAsInt(); + LootCommand.seaLeeches = statsObject.get("kills_sea_leech").getAsInt(); } - lc.seaCreatures += lc.seaLeeches; + LootCommand.seaCreatures += LootCommand.seaLeeches; - lc.guardianDefenders = 0; + LootCommand.guardianDefenders = 0; if (statsObject.has("kills_guardian_defender")) { - lc.guardianDefenders = statsObject.get("kills_guardian_defender").getAsInt(); + LootCommand.guardianDefenders = statsObject.get("kills_guardian_defender").getAsInt(); } - lc.seaCreatures += lc.guardianDefenders; + LootCommand.seaCreatures += LootCommand.guardianDefenders; - lc.deepSeaProtectors = 0; + LootCommand.deepSeaProtectors = 0; if (statsObject.has("kills_deep_sea_protector")) { - lc.deepSeaProtectors = statsObject.get("kills_deep_sea_protector").getAsInt(); + LootCommand.deepSeaProtectors = statsObject.get("kills_deep_sea_protector").getAsInt(); } - lc.seaCreatures += lc.deepSeaProtectors; + LootCommand.seaCreatures += LootCommand.deepSeaProtectors; - lc.hydras = 0; + LootCommand.hydras = 0; if (statsObject.has("kills_water_hydra")) { // Hydra splits - lc.hydras = statsObject.get("kills_water_hydra").getAsInt() / 2; + LootCommand.hydras = statsObject.get("kills_water_hydra").getAsInt() / 2; } - lc.seaCreatures += lc.hydras; + LootCommand.seaCreatures += LootCommand.hydras; - lc.seaEmperors = 0; + LootCommand.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(); + LootCommand.seaEmperors = statsObject.get("kills_skeleton_emperor").getAsInt() + statsObject.get("kills_guardian_emperor").getAsInt(); } else { - lc.seaEmperors = statsObject.get("kills_skeleton_emperor").getAsInt(); + LootCommand.seaEmperors = statsObject.get("kills_skeleton_emperor").getAsInt(); } } else if (statsObject.has("kills_guardian_emperor")) { - lc.seaEmperors = statsObject.get("kills_guardian_emperor").getAsInt(); + LootCommand.seaEmperors = statsObject.get("kills_guardian_emperor").getAsInt(); } - lc.seaCreatures += lc.seaEmperors; + LootCommand.seaCreatures += LootCommand.seaEmperors; - lc.fishingMilestone = 0; + LootCommand.fishingMilestone = 0; if (statsObject.has("pet_milestone_sea_creatures_killed")) { - lc.fishingMilestone = statsObject.get("pet_milestone_sea_creatures_killed").getAsInt(); + LootCommand.fishingMilestone = statsObject.get("pet_milestone_sea_creatures_killed").getAsInt(); } - lc.frozenSteves = 0; + LootCommand.frozenSteves = 0; if (statsObject.has("kills_frozen_steve")) { - lc.frozenSteves = statsObject.get("kills_frozen_steve").getAsInt(); + LootCommand.frozenSteves = statsObject.get("kills_frozen_steve").getAsInt(); } - lc.seaCreatures += lc.frozenSteves; + LootCommand.seaCreatures += LootCommand.frozenSteves; - lc.frostyTheSnowmans = 0; + LootCommand.frostyTheSnowmans = 0; if (statsObject.has("kills_frosty_the_snowman")) { - lc.frostyTheSnowmans = statsObject.get("kills_frosty_the_snowman").getAsInt(); + LootCommand.frostyTheSnowmans = statsObject.get("kills_frosty_the_snowman").getAsInt(); } - lc.seaCreatures += lc.frostyTheSnowmans; + LootCommand.seaCreatures += LootCommand.frostyTheSnowmans; - lc.grinches = 0; + LootCommand.grinches = 0; if (statsObject.has("kills_grinch")) { - lc.grinches = statsObject.get("kills_grinch").getAsInt(); + LootCommand.grinches = statsObject.get("kills_grinch").getAsInt(); } - lc.seaCreatures += lc.grinches; + LootCommand.seaCreatures += LootCommand.grinches; - lc.yetis = 0; + LootCommand.yetis = 0; if (statsObject.has("kills_yeti")) { - lc.yetis = statsObject.get("kills_yeti").getAsInt(); + LootCommand.yetis = statsObject.get("kills_yeti").getAsInt(); } - lc.seaCreatures += lc.yetis; + LootCommand.seaCreatures += LootCommand.yetis; - lc.nurseSharks = 0; + LootCommand.nurseSharks = 0; if (statsObject.has("kills_nurse_shark")) { - lc.nurseSharks = statsObject.get("kills_nurse_shark").getAsInt(); + LootCommand.nurseSharks = statsObject.get("kills_nurse_shark").getAsInt(); } - lc.seaCreatures += lc.nurseSharks; + LootCommand.seaCreatures += LootCommand.nurseSharks; - lc.blueSharks = 0; + LootCommand.blueSharks = 0; if (statsObject.has("kills_nurse_shark")) { - lc.blueSharks = statsObject.get("kills_blue_shark").getAsInt(); + LootCommand.blueSharks = statsObject.get("kills_blue_shark").getAsInt(); } - lc.seaCreatures += lc.blueSharks; + LootCommand.seaCreatures += LootCommand.blueSharks; - lc.tigerSharks = 0; + LootCommand.tigerSharks = 0; if (statsObject.has("kills_nurse_shark")) { - lc.tigerSharks = statsObject.get("kills_tiger_shark").getAsInt(); + LootCommand.tigerSharks = statsObject.get("kills_tiger_shark").getAsInt(); } - lc.seaCreatures += lc.tigerSharks; + LootCommand.seaCreatures += LootCommand.tigerSharks; - lc.greatWhiteSharks = 0; + LootCommand.greatWhiteSharks = 0; if (statsObject.has("kills_nurse_shark")) { - lc.greatWhiteSharks = statsObject.get("kills_great_white_shark").getAsInt(); + LootCommand.greatWhiteSharks = statsObject.get("kills_great_white_shark").getAsInt(); } - lc.seaCreatures += lc.greatWhiteSharks; + LootCommand.seaCreatures += LootCommand.greatWhiteSharks; - lc.scarecrows = 0; + LootCommand.scarecrows = 0; if (statsObject.has("kills_scarecrow")) { - lc.scarecrows = statsObject.get("kills_scarecrow").getAsInt(); + LootCommand.scarecrows = statsObject.get("kills_scarecrow").getAsInt(); } - lc.seaCreatures += lc.scarecrows; + LootCommand.seaCreatures += LootCommand.scarecrows; - lc.nightmares = 0; + LootCommand.nightmares = 0; if (statsObject.has("kills_nightmare")) { - lc.nightmares = statsObject.get("kills_nightmare").getAsInt(); + LootCommand.nightmares = statsObject.get("kills_nightmare").getAsInt(); } - lc.seaCreatures += lc.nightmares; + LootCommand.seaCreatures += LootCommand.nightmares; - lc.werewolfs = 0; + LootCommand.werewolfs = 0; if (statsObject.has("kills_werewolf")) { - lc.werewolfs = statsObject.get("kills_werewolf").getAsInt(); + LootCommand.werewolfs = statsObject.get("kills_werewolf").getAsInt(); } - lc.seaCreatures += lc.werewolfs; + LootCommand.seaCreatures += LootCommand.werewolfs; - lc.phantomFishers = 0; + LootCommand.phantomFishers = 0; if (statsObject.has("kills_phantom_fisherman")) { - lc.phantomFishers = statsObject.get("kills_phantom_fisherman").getAsInt(); + LootCommand.phantomFishers = statsObject.get("kills_phantom_fisherman").getAsInt(); } - lc.seaCreatures += lc.phantomFishers; + LootCommand.seaCreatures += LootCommand.phantomFishers; - lc.grimReapers = 0; + LootCommand.grimReapers = 0; if (statsObject.has("kills_grim_reaper")) { - lc.grimReapers = statsObject.get("kills_grim_reaper").getAsInt(); + LootCommand.grimReapers = statsObject.get("kills_grim_reaper").getAsInt(); } - lc.seaCreatures += lc.grimReapers; + LootCommand.seaCreatures += LootCommand.grimReapers; 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); - cf.writeIntConfig("fishing", "nurseShark", lc.nurseSharks); - cf.writeIntConfig("fishing", "blueShark", lc.blueSharks); - cf.writeIntConfig("fishing", "tigerShark", lc.tigerSharks); - cf.writeIntConfig("fishing", "greatWhiteShark", lc.greatWhiteSharks); - cf.writeIntConfig("fishing", "scarecrow", lc.scarecrows); - cf.writeIntConfig("fishing", "nightmare", lc.nightmares); - cf.writeIntConfig("fishing", "werewolf", lc.werewolfs); - cf.writeIntConfig("fishing", "phantomFisher", lc.phantomFishers); - cf.writeIntConfig("fishing", "grimReaper", lc.grimReapers); + ConfigHandler.writeIntConfig("fishing", "goodCatch", LootCommand.goodCatches); + ConfigHandler.writeIntConfig("fishing", "greatCatch", LootCommand.greatCatches); + ConfigHandler.writeIntConfig("fishing", "seaCreature", LootCommand.seaCreatures); + ConfigHandler.writeIntConfig("fishing", "squid", LootCommand.squids); + ConfigHandler.writeIntConfig("fishing", "seaWalker", LootCommand.seaWalkers); + ConfigHandler.writeIntConfig("fishing", "nightSquid", LootCommand.nightSquids); + ConfigHandler.writeIntConfig("fishing", "seaGuardian", LootCommand.seaGuardians); + ConfigHandler.writeIntConfig("fishing", "seaWitch", LootCommand.seaWitches); + ConfigHandler.writeIntConfig("fishing", "seaArcher", LootCommand.seaArchers); + ConfigHandler.writeIntConfig("fishing", "monsterOfDeep", LootCommand.monsterOfTheDeeps); + ConfigHandler.writeIntConfig("fishing", "catfish", LootCommand.catfishes); + ConfigHandler.writeIntConfig("fishing", "carrotKing", LootCommand.carrotKings); + ConfigHandler.writeIntConfig("fishing", "seaLeech", LootCommand.seaLeeches); + ConfigHandler.writeIntConfig("fishing", "guardianDefender", LootCommand.guardianDefenders); + ConfigHandler.writeIntConfig("fishing", "deepSeaProtector", LootCommand.deepSeaProtectors); + ConfigHandler.writeIntConfig("fishing", "hydra", LootCommand.hydras); + ConfigHandler.writeIntConfig("fishing", "seaEmperor", LootCommand.seaEmperors); + ConfigHandler.writeIntConfig("fishing", "milestone", LootCommand.fishingMilestone); + ConfigHandler.writeIntConfig("fishing", "frozenSteve", LootCommand.frozenSteves); + ConfigHandler.writeIntConfig("fishing", "snowman", LootCommand.frostyTheSnowmans); + ConfigHandler.writeIntConfig("fishing", "grinch", LootCommand.grinches); + ConfigHandler.writeIntConfig("fishing", "yeti", LootCommand.yetis); + ConfigHandler.writeIntConfig("fishing", "nurseShark", LootCommand.nurseSharks); + ConfigHandler.writeIntConfig("fishing", "blueShark", LootCommand.blueSharks); + ConfigHandler.writeIntConfig("fishing", "tigerShark", LootCommand.tigerSharks); + ConfigHandler.writeIntConfig("fishing", "greatWhiteShark", LootCommand.greatWhiteSharks); + ConfigHandler.writeIntConfig("fishing", "scarecrow", LootCommand.scarecrows); + ConfigHandler.writeIntConfig("fishing", "nightmare", LootCommand.nightmares); + ConfigHandler.writeIntConfig("fishing", "werewolf", LootCommand.werewolfs); + ConfigHandler.writeIntConfig("fishing", "phantomFisher", LootCommand.phantomFishers); + ConfigHandler.writeIntConfig("fishing", "grimReaper", LootCommand.grimReapers); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Fishing stats imported.")); }).start(); diff --git a/src/main/java/me/Danker/commands/LobbySkillsCommand.java b/src/main/java/me/Danker/commands/LobbySkillsCommand.java index 696a855..679898d 100644 --- a/src/main/java/me/Danker/commands/LobbySkillsCommand.java +++ b/src/main/java/me/Danker/commands/LobbySkillsCommand.java @@ -46,13 +46,10 @@ public class LobbySkillsCommand extends CommandBase { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { EntityPlayer playerSP = (EntityPlayer) arg0; - ConfigHandler cf = new ConfigHandler(); - APIHandler ah = new APIHandler(); - boolean someErrored = false; Map<String, Double> unsortedSAList = new HashMap<String, Double>(); ArrayList<Double> lobbySkills = new ArrayList<Double>(); // Check key - String key = cf.getString("api", "APIKey"); + String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { playerSP.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); return; @@ -72,7 +69,7 @@ public class LobbySkillsCommand extends CommandBase { long biggestLastSave = 0; int profileIndex = -1; Thread.sleep(600); - JsonObject profileResponse = ah.getResponse("https://api.hypixel.net/skyblock/profiles?uuid=" + UUID + "&key=" + key); + JsonObject profileResponse = APIHandler.getResponse("https://api.hypixel.net/skyblock/profiles?uuid=" + UUID + "&key=" + key); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); System.out.println("User " + player.getGameProfile().getName() + " failed with reason: " + reason); @@ -138,7 +135,7 @@ public class LobbySkillsCommand extends CommandBase { } else { Thread.sleep(600); // Sleep for another request System.out.println("Fetching skills from achievement API"); - JsonObject playerObject = ah.getResponse("https://api.hypixel.net/player?uuid=" + UUID + "&key=" + key); + JsonObject playerObject = APIHandler.getResponse("https://api.hypixel.net/player?uuid=" + UUID + "&key=" + key); if (!playerObject.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); diff --git a/src/main/java/me/Danker/commands/MoveCommand.java b/src/main/java/me/Danker/commands/MoveCommand.java index a3f5e3b..0581d8c 100644 --- a/src/main/java/me/Danker/commands/MoveCommand.java +++ b/src/main/java/me/Danker/commands/MoveCommand.java @@ -10,7 +10,6 @@ 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 { @@ -47,7 +46,6 @@ public class MoveCommand extends CommandBase { @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(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); @@ -57,38 +55,38 @@ public class MoveCommand extends CommandBase { 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]); + ConfigHandler.writeIntConfig("locations", "coordsX", coordsXY[0]); + ConfigHandler.writeIntConfig("locations", "coordsY", coordsXY[1]); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Coords have been moved to " + TheMod.SECONDARY_COLOUR + 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]); + ConfigHandler.writeIntConfig("locations", "displayX", displayXY[0]); + ConfigHandler.writeIntConfig("locations", "displayY", displayXY[1]); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Tracker display has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); } else if (arg1[0].equalsIgnoreCase("dungeontimer")) { dungeonTimerXY[0] = Integer.parseInt(arg1[1]); dungeonTimerXY[1] = Integer.parseInt(arg1[2]); - cf.writeIntConfig("locations", "dungeonTimerX", dungeonTimerXY[0]); - cf.writeIntConfig("locations", "dungeonTimerY", dungeonTimerXY[1]); + ConfigHandler.writeIntConfig("locations", "dungeonTimerX", dungeonTimerXY[0]); + ConfigHandler.writeIntConfig("locations", "dungeonTimerY", dungeonTimerXY[1]); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Dungeon timer has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); } else if (arg1[0].equalsIgnoreCase("skill50")) { skill50XY[0] = Integer.parseInt(arg1[1]); skill50XY[1] = Integer.parseInt(arg1[2]); - cf.writeIntConfig("locations", "skill50X", skill50XY[0]); - cf.writeIntConfig("locations", "skill50Y", skill50XY[1]); + ConfigHandler.writeIntConfig("locations", "skill50X", skill50XY[0]); + ConfigHandler.writeIntConfig("locations", "skill50Y", skill50XY[1]); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill 50 display has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); } else if (arg1[0].equalsIgnoreCase("lividhp")) { lividHpXY[0] = Integer.parseInt(arg1[1]); lividHpXY[1] = Integer.parseInt(arg1[2]); - cf.writeIntConfig("locations", "lividHpX", lividHpXY[0]); - cf.writeIntConfig("locations", "lividHpY", lividHpXY[1]); + ConfigHandler.writeIntConfig("locations", "lividHpX", lividHpXY[0]); + ConfigHandler.writeIntConfig("locations", "lividHpY", lividHpXY[1]); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Livid HP has been moved to " + TheMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2])); } else if (arg1[0].equalsIgnoreCase("caketimer")) { cakeTimerXY[0] = Integer.parseInt(arg1[1]); cakeTimerXY[1] = Integer.parseInt(arg1[2]); - cf.writeIntConfig("locations", "cakeTimerX", cakeTimerXY[0]); - cf.writeIntConfig("locations", "cakeTimerY", cakeTimerXY[1]); + ConfigHandler.writeIntConfig("locations", "cakeTimerX", cakeTimerXY[0]); + ConfigHandler.writeIntConfig("locations", "cakeTimerY", cakeTimerXY[1]); } else { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); } diff --git a/src/main/java/me/Danker/commands/PetsCommand.java b/src/main/java/me/Danker/commands/PetsCommand.java index 031d087..8e41814 100644 --- a/src/main/java/me/Danker/commands/PetsCommand.java +++ b/src/main/java/me/Danker/commands/PetsCommand.java @@ -79,12 +79,10 @@ public class PetsCommand extends CommandBase { 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"); + String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } @@ -99,16 +97,16 @@ public class PetsCommand extends CommandBase { } else { username = arg1[0]; player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking pets of " + TheMod.SECONDARY_COLOUR + username)); - uuid = ah.getUUID(username); + uuid = APIHandler.getUUID(username); } // Find stats of latest profile - String latestProfile = ah.getLatestProfileID(uuid, key); + String latestProfile = APIHandler.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); + JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); diff --git a/src/main/java/me/Danker/commands/ReloadConfigCommand.java b/src/main/java/me/Danker/commands/ReloadConfigCommand.java index 113bbc4..c4ad036 100644 --- a/src/main/java/me/Danker/commands/ReloadConfigCommand.java +++ b/src/main/java/me/Danker/commands/ReloadConfigCommand.java @@ -7,7 +7,6 @@ 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 { @@ -29,8 +28,7 @@ public class ReloadConfigCommand extends CommandBase { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { final EntityPlayer player = (EntityPlayer)arg0; - final ConfigHandler cf = new ConfigHandler(); - cf.reloadConfig(); + ConfigHandler.reloadConfig(); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Reloaded config.")); } diff --git a/src/main/java/me/Danker/commands/ResetLootCommand.java b/src/main/java/me/Danker/commands/ResetLootCommand.java index 0c33866..f99b5ae 100644 --- a/src/main/java/me/Danker/commands/ResetLootCommand.java +++ b/src/main/java/me/Danker/commands/ResetLootCommand.java @@ -90,154 +90,142 @@ public class ResetLootCommand extends CommandBase { } } - 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 resetZombie() { + LootCommand.zombieRevsSession = 0; + LootCommand.zombieRevFleshSession = 0; + LootCommand.zombieFoulFleshSession = 0; + LootCommand.zombieFoulFleshDropsSession = 0; + LootCommand.zombiePestilencesSession = 0; + LootCommand.zombieUndeadCatasSession = 0; + LootCommand.zombieBooksSession = 0; + LootCommand.zombieBeheadedsSession = 0; + LootCommand.zombieRevCatasSession = 0; + LootCommand.zombieSnakesSession = 0; + LootCommand.zombieScythesSession = 0; + LootCommand.zombieTimeSession = -1; + LootCommand.zombieBossesSession = -1; + ConfigHandler.deleteCategory("zombie"); + ConfigHandler.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(); + LootCommand.spiderTarantulasSession = 0; + LootCommand.spiderWebsSession = 0; + LootCommand.spiderTAPSession = 0; + LootCommand.spiderTAPDropsSession = 0; + LootCommand.spiderBitesSession = 0; + LootCommand.spiderCatalystsSession = 0; + LootCommand.spiderBooksSession = 0; + LootCommand.spiderSwattersSession = 0; + LootCommand.spiderTalismansSession = 0; + LootCommand.spiderMosquitosSession = 0; + LootCommand.spiderTimeSession = -1; + LootCommand.spiderBossesSession = -1; + ConfigHandler.deleteCategory("spider"); + ConfigHandler.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(); + LootCommand.wolfSvensSession = 0; + LootCommand.wolfTeethSession = 0; + LootCommand.wolfWheelsSession = 0; + LootCommand.wolfWheelsDropsSession = 0; + LootCommand.wolfSpiritsSession = 0; + LootCommand.wolfBooksSession = 0; + LootCommand.wolfEggsSession = 0; + LootCommand.wolfCouturesSession = 0; + LootCommand.wolfBaitsSession = 0; + LootCommand.wolfFluxesSession = 0; + LootCommand.wolfTimeSession = -1; + LootCommand.wolfBossesSession = -1; + ConfigHandler.deleteCategory("wolf"); + ConfigHandler.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; - lc.yetiTimeSession = -1; - lc.yetiSCsSession = -1; - lc.nurseSharksSession = 0; - lc.blueSharksSession = 0; - lc.tigerSharksSession = 0; - lc.greatWhiteSharksSession = 0; - lc.scarecrowsSession = 0; - lc.nightmaresSession = 0; - lc.werewolfsSession = 0; - lc.phantomFishersSession = 0; - lc.grimReapersSession = 0; - cf.deleteCategory("fishing"); - cf.reloadConfig(); + LootCommand.seaCreaturesSession = 0; + LootCommand.goodCatchesSession = 0; + LootCommand.greatCatchesSession = 0; + LootCommand.squidsSession = 0; + LootCommand.seaWalkersSession = 0; + LootCommand.nightSquidsSession = 0; + LootCommand.seaGuardiansSession = 0; + LootCommand.seaWitchesSession = 0; + LootCommand.seaArchersSession = 0; + LootCommand.monsterOfTheDeepsSession = 0; + LootCommand.catfishesSession = 0; + LootCommand.carrotKingsSession = 0; + LootCommand.seaLeechesSession = 0; + LootCommand.guardianDefendersSession = 0; + LootCommand.deepSeaProtectorsSession = 0; + LootCommand.hydrasSession = 0; + LootCommand.seaEmperorsSession = 0; + LootCommand.empTimeSession = -1; + LootCommand.empSCsSession = -1; + LootCommand.fishingMilestoneSession = 0; + LootCommand.frozenStevesSession = 0; + LootCommand.frostyTheSnowmansSession = 0; + LootCommand.grinchesSession = 0; + LootCommand.yetisSession = 0; + LootCommand.yetiTimeSession = -1; + LootCommand.yetiSCsSession = -1; + LootCommand.nurseSharksSession = 0; + LootCommand.blueSharksSession = 0; + LootCommand.tigerSharksSession = 0; + LootCommand.greatWhiteSharksSession = 0; + LootCommand.scarecrowsSession = 0; + LootCommand.nightmaresSession = 0; + LootCommand.werewolfsSession = 0; + LootCommand.phantomFishersSession = 0; + LootCommand.grimReapersSession = 0; + ConfigHandler.deleteCategory("fishing"); + ConfigHandler.reloadConfig(); } static void resetCatacombs() { - LootCommand lc = new LootCommand(); - ConfigHandler cf = new ConfigHandler(); - lc.recombobulatorsSession = 0; - lc.fumingPotatoBooksSession = 0; - lc.bonzoStaffsSession = 0; - lc.f1CoinsSpentSession = 0; - lc.f1TimeSpentSession = 0; - lc.scarfStudiesSession = 0; - lc.f2CoinsSpentSession = 0; - lc.f2TimeSpentSession = 0; - lc.adaptiveHelmsSession = 0; - lc.adaptiveChestsSession = 0; - lc.adaptiveLegsSession = 0; - lc.adaptiveBootsSession = 0; - lc.adaptiveSwordsSession = 0; - lc.f3CoinsSpentSession = 0; - lc.f3TimeSpentSession = 0; - lc.spiritWingsSession = 0; - lc.spiritBonesSession = 0; - lc.spiritBootsSession = 0; - lc.spiritSwordsSession = 0; - lc.epicSpiritPetsSession = 0; - lc.f4CoinsSpentSession = 0; - lc.f4TimeSpentSession = 0; - lc.warpedStonesSession = 0; - lc.shadowAssHelmsSession = 0; - lc.shadowAssChestsSession = 0; - lc.shadowAssLegsSession = 0; - lc.shadowAssBootsSession = 0; - lc.lividDaggersSession = 0; - lc.shadowFurysSession = 0; - lc.f5CoinsSpentSession = 0; - lc.f5TimeSpentSession = 0; - lc.ancientRosesSession = 0; - lc.precursorEyesSession = 0; - lc.giantsSwordsSession = 0; - lc.necroLordHelmsSession = 0; - lc.necroLordChestsSession = 0; - lc.necroLordLegsSession = 0; - lc.necroLordBootsSession = 0; - lc.necroSwordsSession = 0; - lc.f6CoinsSpentSession = 0; - lc.f6TimeSpentSession = 0; - cf.deleteCategory("catacombs"); - cf.reloadConfig(); + LootCommand.recombobulatorsSession = 0; + LootCommand.fumingPotatoBooksSession = 0; + LootCommand.bonzoStaffsSession = 0; + LootCommand.f1CoinsSpentSession = 0; + LootCommand.f1TimeSpentSession = 0; + LootCommand.scarfStudiesSession = 0; + LootCommand.f2CoinsSpentSession = 0; + LootCommand.f2TimeSpentSession = 0; + LootCommand.adaptiveHelmsSession = 0; + LootCommand.adaptiveChestsSession = 0; + LootCommand.adaptiveLegsSession = 0; + LootCommand.adaptiveBootsSession = 0; + LootCommand.adaptiveSwordsSession = 0; + LootCommand.f3CoinsSpentSession = 0; + LootCommand.f3TimeSpentSession = 0; + LootCommand.spiritWingsSession = 0; + LootCommand.spiritBonesSession = 0; + LootCommand.spiritBootsSession = 0; + LootCommand.spiritSwordsSession = 0; + LootCommand.epicSpiritPetsSession = 0; + LootCommand.f4CoinsSpentSession = 0; + LootCommand.f4TimeSpentSession = 0; + LootCommand.warpedStonesSession = 0; + LootCommand.shadowAssHelmsSession = 0; + LootCommand.shadowAssChestsSession = 0; + LootCommand.shadowAssLegsSession = 0; + LootCommand.shadowAssBootsSession = 0; + LootCommand.lividDaggersSession = 0; + LootCommand.shadowFurysSession = 0; + LootCommand.f5CoinsSpentSession = 0; + LootCommand.f5TimeSpentSession = 0; + LootCommand.ancientRosesSession = 0; + LootCommand.precursorEyesSession = 0; + LootCommand.giantsSwordsSession = 0; + LootCommand.necroLordHelmsSession = 0; + LootCommand.necroLordChestsSession = 0; + LootCommand.necroLordLegsSession = 0; + LootCommand.necroLordBootsSession = 0; + LootCommand.necroSwordsSession = 0; + LootCommand.f6CoinsSpentSession = 0; + LootCommand.f6TimeSpentSession = 0; + ConfigHandler.deleteCategory("catacombs"); + ConfigHandler.reloadConfig(); } } diff --git a/src/main/java/me/Danker/commands/ScaleCommand.java b/src/main/java/me/Danker/commands/ScaleCommand.java index fa4c51d..1527e40 100644 --- a/src/main/java/me/Danker/commands/ScaleCommand.java +++ b/src/main/java/me/Danker/commands/ScaleCommand.java @@ -10,7 +10,6 @@ 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 { diff --git a/src/main/java/me/Danker/commands/SetkeyCommand.java b/src/main/java/me/Danker/commands/SetkeyCommand.java index 9ad1abe..f2e58e5 100644 --- a/src/main/java/me/Danker/commands/SetkeyCommand.java +++ b/src/main/java/me/Danker/commands/SetkeyCommand.java @@ -8,7 +8,6 @@ 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 { @@ -36,8 +35,7 @@ public class SetkeyCommand extends CommandBase implements ICommand { return; } - final ConfigHandler cf = new ConfigHandler(); - cf.writeStringConfig("api", "APIKey", arg1[0]); + ConfigHandler.writeStringConfig("api", "APIKey", arg1[0]); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Set API key to " + TheMod.SECONDARY_COLOUR + arg1[0])); } diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java index 12bfd93..71905fc 100644 --- a/src/main/java/me/Danker/commands/SkillsCommand.java +++ b/src/main/java/me/Danker/commands/SkillsCommand.java @@ -45,12 +45,10 @@ public class SkillsCommand extends CommandBase { 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"); + String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } @@ -65,16 +63,16 @@ public class SkillsCommand extends CommandBase { } else { username = arg1[0]; player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking skills of " + TheMod.SECONDARY_COLOUR + username)); - uuid = ah.getUUID(username); + uuid = APIHandler.getUUID(username); } // Find stats of latest profile - String latestProfile = ah.getLatestProfileID(uuid, key); + String latestProfile = APIHandler.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); + JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); @@ -131,7 +129,7 @@ public class SkillsCommand extends CommandBase { String playerURL = "https://api.hypixel.net/player?uuid=" + uuid + "&key=" + key; System.out.println("Fetching skills from achievement API"); - JsonObject playerObject = ah.getResponse(playerURL); + JsonObject playerObject = APIHandler.getResponse(playerURL); if (!playerObject.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); diff --git a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java index 24c3152..aca61ee 100644 --- a/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java +++ b/src/main/java/me/Danker/commands/SkyblockPlayersCommand.java @@ -44,19 +44,17 @@ public class SkyblockPlayersCommand extends CommandBase { 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"); + String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } String playersURL = "https://api.hypixel.net/gameCounts?key=" + key; System.out.println("Fetching player count..."); - JsonObject playersResponse = ah.getResponse(playersURL); + JsonObject playersResponse = APIHandler.getResponse(playersURL); if (!playersResponse.get("success").getAsBoolean()) { String reason = playersResponse.get("cause").getAsString(); player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); diff --git a/src/main/java/me/Danker/commands/SlayerCommand.java b/src/main/java/me/Danker/commands/SlayerCommand.java index 3ac6a46..07119bb 100644 --- a/src/main/java/me/Danker/commands/SlayerCommand.java +++ b/src/main/java/me/Danker/commands/SlayerCommand.java @@ -47,12 +47,10 @@ public class SlayerCommand extends CommandBase { 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"); + String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey.")); } @@ -67,16 +65,16 @@ public class SlayerCommand extends CommandBase { } else { username = arg1[0]; player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking slayer of " + TheMod.SECONDARY_COLOUR + username)); - uuid = ah.getUUID(username); + uuid = APIHandler.getUUID(username); } // Find stats of latest profile - String latestProfile = ah.getLatestProfileID(uuid, key); + String latestProfile = APIHandler.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); + JsonObject profileResponse = APIHandler.getResponse(profileURL); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason)); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 563c403..93cce26 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -11,7 +11,6 @@ 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; @@ -76,7 +75,6 @@ public class ToggleCommand extends CommandBase implements ICommand { @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(TheMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); @@ -85,107 +83,107 @@ public class ToggleCommand extends CommandBase implements ICommand { if (arg1[0].equalsIgnoreCase("gparty")) { gpartyToggled = !gpartyToggled; - cf.writeBooleanConfig("toggles", "GParty", gpartyToggled); + ConfigHandler.writeBooleanConfig("toggles", "GParty", gpartyToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Guild party notifications has been set to " + TheMod.SECONDARY_COLOUR + gpartyToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("coords")) { coordsToggled = !coordsToggled; - cf.writeBooleanConfig("toggles", "Coords", coordsToggled); + ConfigHandler.writeBooleanConfig("toggles", "Coords", coordsToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Coord/Angle display has been set to " + TheMod.SECONDARY_COLOUR + coordsToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("golden")) { goldenToggled = !goldenToggled; - cf.writeBooleanConfig("toggles", "Golden", goldenToggled); + ConfigHandler.writeBooleanConfig("toggles", "Golden", goldenToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Golden T6 enchants has been set to " + TheMod.SECONDARY_COLOUR + goldenToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("slayercount")) { slayerCountTotal = !slayerCountTotal; - cf.writeBooleanConfig("toggles", "SlayerCount", slayerCountTotal); + ConfigHandler.writeBooleanConfig("toggles", "SlayerCount", slayerCountTotal); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Counting total 20% slayer drops has been set to " + TheMod.SECONDARY_COLOUR + slayerCountTotal + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("rngesusalerts")) { rngesusAlerts = !rngesusAlerts; - cf.writeBooleanConfig("toggles", "RNGesusAlerts", rngesusAlerts); + ConfigHandler.writeBooleanConfig("toggles", "RNGesusAlerts", rngesusAlerts); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Slayer RNGesus alerts has been set to " + TheMod.SECONDARY_COLOUR + rngesusAlerts + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("splitfishing")) { splitFishing = !splitFishing; - cf.writeBooleanConfig("toggles", "SplitFishing", splitFishing); + ConfigHandler.writeBooleanConfig("toggles", "SplitFishing", splitFishing); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Split fishing display has been set to " + TheMod.SECONDARY_COLOUR + splitFishing + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("chatmaddox")) { chatMaddoxToggled = !chatMaddoxToggled; - cf.writeBooleanConfig("toggles", "ChatMaddox", chatMaddoxToggled); + ConfigHandler.writeBooleanConfig("toggles", "ChatMaddox", chatMaddoxToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Click screen to open Maddox menu has been set to " + TheMod.SECONDARY_COLOUR + chatMaddoxToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("spiritbearalerts")) { spiritBearAlerts = !spiritBearAlerts; - cf.writeBooleanConfig("toggles", "SpiritBearAlerts", spiritBearAlerts); + ConfigHandler.writeBooleanConfig("toggles", "SpiritBearAlerts", spiritBearAlerts); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Spirit Bear alerts have been set to " + TheMod.SECONDARY_COLOUR + spiritBearAlerts + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("aotd")) { aotdToggled = !aotdToggled; - cf.writeBooleanConfig("toggles", "AOTD", aotdToggled); + ConfigHandler.writeBooleanConfig("toggles", "AOTD", aotdToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Block AOTD ability been set to " + TheMod.SECONDARY_COLOUR + aotdToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("lividdagger")) { lividDaggerToggled = !lividDaggerToggled; - cf.writeBooleanConfig("toggles", "LividDagger", lividDaggerToggled); + ConfigHandler.writeBooleanConfig("toggles", "LividDagger", lividDaggerToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Block Livid Dagger ability been set to " + TheMod.SECONDARY_COLOUR + lividDaggerToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("sceptremessages")) { sceptreMessages = !sceptreMessages; - cf.writeBooleanConfig("toggles", "SceptreMessages", sceptreMessages); + ConfigHandler.writeBooleanConfig("toggles", "SceptreMessages", sceptreMessages); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Spirit Sceptre messages have been set to " + TheMod.SECONDARY_COLOUR + sceptreMessages + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("petcolors") || arg1[0].equalsIgnoreCase("petcolours")) { petColoursToggled = !petColoursToggled; - cf.writeBooleanConfig("toggles", "PetColors", petColoursToggled); + ConfigHandler.writeBooleanConfig("toggles", "PetColors", petColoursToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Pet colours have been set to " + TheMod.SECONDARY_COLOUR + petColoursToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("dungeontimer")) { dungeonTimerToggled = !dungeonTimerToggled; - cf.writeBooleanConfig("toggles", "DungeonTimer", dungeonTimerToggled); + ConfigHandler.writeBooleanConfig("toggles", "DungeonTimer", dungeonTimerToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Dungeon timer has been set to " + TheMod.SECONDARY_COLOUR + dungeonTimerToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("golemalerts")) { golemAlertToggled = !golemAlertToggled; - cf.writeBooleanConfig("toggles", "GolemAlerts", golemAlertToggled); + ConfigHandler.writeBooleanConfig("toggles", "GolemAlerts", golemAlertToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Golem spawn alerts has been set to " + TheMod.SECONDARY_COLOUR + golemAlertToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("expertiselore")) { expertiseLoreToggled = !expertiseLoreToggled; - cf.writeBooleanConfig("toggles", "ExpertiseLore", expertiseLoreToggled); + ConfigHandler.writeBooleanConfig("toggles", "ExpertiseLore", expertiseLoreToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Expertise in lore has been set to " + TheMod.SECONDARY_COLOUR + expertiseLoreToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("skill50display")) { skill50DisplayToggled = !skill50DisplayToggled; - cf.writeBooleanConfig("toggles", "Skill50Display", skill50DisplayToggled); + ConfigHandler.writeBooleanConfig("toggles", "Skill50Display", skill50DisplayToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Skill 50 display has been set to " + TheMod.SECONDARY_COLOUR + skill50DisplayToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("outlinetext")) { outlineTextToggled = !outlineTextToggled; - cf.writeBooleanConfig("toggles", "OutlineText", outlineTextToggled); + ConfigHandler.writeBooleanConfig("toggles", "OutlineText", outlineTextToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Outline displayed text has been set to " + TheMod.SECONDARY_COLOUR + outlineTextToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("midasstaffmessages")) { midasStaffMessages = !midasStaffMessages; - cf.writeBooleanConfig("toggles", "MidasStaffMessages", midasStaffMessages); + ConfigHandler.writeBooleanConfig("toggles", "MidasStaffMessages", midasStaffMessages); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Midas Staff messages have been set to " + TheMod.SECONDARY_COLOUR + midasStaffMessages + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("healmessages")) { healMessages = !healMessages; - cf.writeBooleanConfig("toggles", "HealMessages", healMessages); + ConfigHandler.writeBooleanConfig("toggles", "HealMessages", healMessages); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Heal messages have been set to " + TheMod.SECONDARY_COLOUR + healMessages + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("caketimer")) { cakeTimerToggled = !cakeTimerToggled; - cf.writeBooleanConfig("toggles", "CakeTimer", cakeTimerToggled); + ConfigHandler.writeBooleanConfig("toggles", "CakeTimer", cakeTimerToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Cake timer has been set to " + TheMod.SECONDARY_COLOUR + cakeTimerToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("lividsolver")) { lividSolverToggled = !lividSolverToggled; - cf.writeBooleanConfig("toggles", "LividSolver", lividSolverToggled); + ConfigHandler.writeBooleanConfig("toggles", "LividSolver", lividSolverToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Livid solver has been set to " + TheMod.SECONDARY_COLOUR + lividSolverToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("threemanpuzzle")) { threeManToggled = !threeManToggled; - cf.writeBooleanConfig("toggles", "ThreeManPuzzle", threeManToggled); + ConfigHandler.writeBooleanConfig("toggles", "ThreeManPuzzle", threeManToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Three man puzzle solver has been set to " + TheMod.SECONDARY_COLOUR + threeManToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("oruopuzzle")) { oruoToggled = !oruoToggled; - cf.writeBooleanConfig("toggles", "OruoPuzzle", oruoToggled); + ConfigHandler.writeBooleanConfig("toggles", "OruoPuzzle", oruoToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Oruo trivia solver has been set to " + TheMod.SECONDARY_COLOUR + oruoToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("blazepuzzle")) { blazeToggled = !blazeToggled; - cf.writeBooleanConfig("toggles", "BlazePuzzle", blazeToggled); + ConfigHandler.writeBooleanConfig("toggles", "BlazePuzzle", blazeToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Blaze puzzle solver has been set to " + TheMod.SECONDARY_COLOUR + blazeToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("creeperpuzzle")) { creeperToggled = !creeperToggled; - cf.writeBooleanConfig("creeperpuzzle", "CreeperPuzzle", creeperToggled); + ConfigHandler.writeBooleanConfig("creeperpuzzle", "CreeperPuzzle", creeperToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Creeper puzzle solver has been set to " + TheMod.SECONDARY_COLOUR + creeperToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("waterpuzzle")) { waterToggled = !waterToggled; - cf.writeBooleanConfig("waterpuzzle", "WaterPuzzle", waterToggled); + ConfigHandler.writeBooleanConfig("waterpuzzle", "WaterPuzzle", waterToggled); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Water puzzle solver has been set to " + TheMod.SECONDARY_COLOUR + waterToggled + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("list")) { player.addChatMessage(new ChatComponentText(TheMod.TYPE_COLOUR + "Guild party notifications: " + TheMod.VALUE_COLOUR + gpartyToggled + "\n" + |