diff options
author | Sychic <Sychic@github.com> | 2020-12-17 13:57:36 -0500 |
---|---|---|
committer | Sychic <Sychic@github.com> | 2020-12-17 13:57:36 -0500 |
commit | 2a43011799565bd03b489291272c5b0ff69b3644 (patch) | |
tree | e5aed7b0308b0fe0458e118cf6ec9a6f2ff9675c /src/main/java/me/Danker | |
parent | 0aea3a9aca943510713daa78dfba725970192268 (diff) | |
download | SkyblockMod-2a43011799565bd03b489291272c5b0ff69b3644.tar.gz SkyblockMod-2a43011799565bd03b489291272c5b0ff69b3644.tar.bz2 SkyblockMod-2a43011799565bd03b489291272c5b0ff69b3644.zip |
secrets found
Diffstat (limited to 'src/main/java/me/Danker')
-rw-r--r-- | src/main/java/me/Danker/commands/DungeonsCommand.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/me/Danker/commands/DungeonsCommand.java b/src/main/java/me/Danker/commands/DungeonsCommand.java index bdc1403..f557b93 100644 --- a/src/main/java/me/Danker/commands/DungeonsCommand.java +++ b/src/main/java/me/Danker/commands/DungeonsCommand.java @@ -84,6 +84,14 @@ public class DungeonsCommand extends CommandBase { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "This player has not played dungeons.")); return; } + + String playerURL = "https://api.hypixel.net/player?uuid=" + uuid + "&key=" + key; + System.out.println("Fetching player data..."); + JsonObject playerResponse = APIHandler.getResponse(playerURL); + if(!playerResponse.get("success").getAsBoolean()){ + String reason = playerResponse.get("cause").getAsString(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "This player has not played on Hypixel.")); + } double catacombs = Utils.xpToDungeonsLevel(dungeonsObject.get("dungeon_types").getAsJsonObject().get("catacombs").getAsJsonObject().get("experience").getAsDouble()); double healer = Utils.xpToDungeonsLevel(dungeonsObject.get("player_classes").getAsJsonObject().get("healer").getAsJsonObject().get("experience").getAsDouble()); @@ -92,6 +100,7 @@ public class DungeonsCommand extends CommandBase { double archer = Utils.xpToDungeonsLevel(dungeonsObject.get("player_classes").getAsJsonObject().get("archer").getAsJsonObject().get("experience").getAsDouble()); double tank = Utils.xpToDungeonsLevel(dungeonsObject.get("player_classes").getAsJsonObject().get("tank").getAsJsonObject().get("experience").getAsDouble()); String selectedClass = Utils.capitalizeString(dungeonsObject.get("selected_dungeon_class").getAsString()); + int secrets = playerResponse.get("player").getAsJsonObject().get("achievements").getAsJsonObject().get("skyblock_treasure_hunter").getAsInt(); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "" + EnumChatFormatting.BOLD + "-------------------\n" + EnumChatFormatting.RED + " Catacombs Level: " + catacombs + "\n" + @@ -100,7 +109,8 @@ public class DungeonsCommand extends CommandBase { EnumChatFormatting.LIGHT_PURPLE + " Mage Level: " + mage + "\n" + EnumChatFormatting.RED + " Berserk Level: " + berserk + "\n" + EnumChatFormatting.GREEN + " Archer Level: " + archer + "\n" + - EnumChatFormatting.BLUE + " Tank Level: " + tank + "\n" + + EnumChatFormatting.BLUE + " Tank Level: " + tank + "\n\n" + + EnumChatFormatting.WHITE + " Screts Found: " + secrets + "\n" + DankersSkyblockMod.DELIMITER_COLOUR + " " + EnumChatFormatting.BOLD + "-------------------")); }).start(); } |