diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-08-08 23:07:53 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2020-08-08 23:07:53 -0400 |
commit | fddf14fd04c50e02704c946d8893a3604f1abb11 (patch) | |
tree | a0dbf80dc346a460c865e97e79cd4ce15af361bf /me/Danker/commands | |
parent | 91aa2e90f5d802bb88b17f6a818e948823888e7b (diff) | |
download | SkyblockMod-fddf14fd04c50e02704c946d8893a3604f1abb11.tar.gz SkyblockMod-fddf14fd04c50e02704c946d8893a3604f1abb11.tar.bz2 SkyblockMod-fddf14fd04c50e02704c946d8893a3604f1abb11.zip |
v1.6.1
Add all build files
Diffstat (limited to 'me/Danker/commands')
-rw-r--r-- | me/Danker/commands/ArmourCommand.java | 150 | ||||
-rw-r--r-- | me/Danker/commands/BankCommand.java | 115 | ||||
-rw-r--r-- | me/Danker/commands/DHelpCommand.java | 52 | ||||
-rw-r--r-- | me/Danker/commands/DisplayCommand.java | 108 | ||||
-rw-r--r-- | me/Danker/commands/GetkeyCommand.java | 41 | ||||
-rw-r--r-- | me/Danker/commands/GuildOfCommand.java | 116 | ||||
-rw-r--r-- | me/Danker/commands/ImportFishingCommand.java | 233 | ||||
-rw-r--r-- | me/Danker/commands/LootCommand.java | 533 | ||||
-rw-r--r-- | me/Danker/commands/MoveCommand.java | 69 | ||||
-rw-r--r-- | me/Danker/commands/PetsCommand.java | 247 | ||||
-rw-r--r-- | me/Danker/commands/ReloadConfigCommand.java | 36 | ||||
-rw-r--r-- | me/Danker/commands/ResetLootCommand.java | 181 | ||||
-rw-r--r-- | me/Danker/commands/ScaleCommand.java | 70 | ||||
-rw-r--r-- | me/Danker/commands/SetkeyCommand.java | 43 | ||||
-rw-r--r-- | me/Danker/commands/SkillsCommand.java | 334 | ||||
-rw-r--r-- | me/Danker/commands/SlayerCommand.java | 112 | ||||
-rw-r--r-- | me/Danker/commands/ToggleCommand.java | 83 |
17 files changed, 0 insertions, 2523 deletions
diff --git a/me/Danker/commands/ArmourCommand.java b/me/Danker/commands/ArmourCommand.java deleted file mode 100644 index 255825c..0000000 --- a/me/Danker/commands/ArmourCommand.java +++ /dev/null @@ -1,150 +0,0 @@ -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/me/Danker/commands/BankCommand.java b/me/Danker/commands/BankCommand.java deleted file mode 100644 index e32e66f..0000000 --- a/me/Danker/commands/BankCommand.java +++ /dev/null @@ -1,115 +0,0 @@ -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/me/Danker/commands/DHelpCommand.java b/me/Danker/commands/DHelpCommand.java deleted file mode 100644 index 9ca6a6e..0000000 --- a/me/Danker/commands/DHelpCommand.java +++ /dev/null @@ -1,52 +0,0 @@ -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/me/Danker/commands/DisplayCommand.java b/me/Danker/commands/DisplayCommand.java deleted file mode 100644 index 916245e..0000000 --- a/me/Danker/commands/DisplayCommand.java +++ /dev/null @@ -1,108 +0,0 @@ -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/me/Danker/commands/GetkeyCommand.java b/me/Danker/commands/GetkeyCommand.java deleted file mode 100644 index 80354fe..0000000 --- a/me/Danker/commands/GetkeyCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -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/me/Danker/commands/GuildOfCommand.java b/me/Danker/commands/GuildOfCommand.java deleted file mode 100644 index 238ba81..0000000 --- a/me/Danker/commands/GuildOfCommand.java +++ /dev/null @@ -1,116 +0,0 @@ -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/me/Danker/commands/ImportFishingCommand.java b/me/Danker/commands/ImportFishingCommand.java deleted file mode 100644 index bbbcb9f..0000000 --- a/me/Danker/commands/ImportFishingCommand.java +++ /dev/null @@ -1,233 +0,0 @@ -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/me/Danker/commands/LootCommand.java b/me/Danker/commands/LootCommand.java deleted file mode 100644 index d64e9d9..0000000 --- a/me/Danker/commands/LootCommand.java +++ /dev/null @@ -1,533 +0,0 @@ -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/me/Danker/commands/MoveCommand.java b/me/Danker/commands/MoveCommand.java deleted file mode 100644 index 1232e18..0000000 --- a/me/Danker/commands/MoveCommand.java +++ /dev/null @@ -1,69 +0,0 @@ -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/me/Danker/commands/PetsCommand.java b/me/Danker/commands/PetsCommand.java deleted file mode 100644 index 75367ab..0000000 --- a/me/Danker/commands/PetsCommand.java +++ /dev/null @@ -1,247 +0,0 @@ -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/me/Danker/commands/ReloadConfigCommand.java b/me/Danker/commands/ReloadConfigCommand.java deleted file mode 100644 index 122f1c1..0000000 --- a/me/Danker/commands/ReloadConfigCommand.java +++ /dev/null @@ -1,36 +0,0 @@ -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/me/Danker/commands/ResetLootCommand.java b/me/Danker/commands/ResetLootCommand.java deleted file mode 100644 index 1afc204..0000000 --- a/me/Danker/commands/ResetLootCommand.java +++ /dev/null @@ -1,181 +0,0 @@ -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/me/Danker/commands/ScaleCommand.java b/me/Danker/commands/ScaleCommand.java deleted file mode 100644 index f8c73c9..0000000 --- a/me/Danker/commands/ScaleCommand.java +++ /dev/null @@ -1,70 +0,0 @@ -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/me/Danker/commands/SetkeyCommand.java b/me/Danker/commands/SetkeyCommand.java deleted file mode 100644 index f68ff75..0000000 --- a/me/Danker/commands/SetkeyCommand.java +++ /dev/null @@ -1,43 +0,0 @@ -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/me/Danker/commands/SkillsCommand.java b/me/Danker/commands/SkillsCommand.java deleted file mode 100644 index 5818772..0000000 --- a/me/Danker/commands/SkillsCommand.java +++ /dev/null @@ -1,334 +0,0 @@ -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/me/Danker/commands/SlayerCommand.java b/me/Danker/commands/SlayerCommand.java deleted file mode 100644 index f8100b4..0000000 --- a/me/Danker/commands/SlayerCommand.java +++ /dev/null @@ -1,112 +0,0 @@ -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/me/Danker/commands/ToggleCommand.java b/me/Danker/commands/ToggleCommand.java deleted file mode 100644 index decf99a..0000000 --- a/me/Danker/commands/ToggleCommand.java +++ /dev/null @@ -1,83 +0,0 @@ -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>")); - } - } -} |