diff options
author | Sychic <Sychic@github.com> | 2020-12-26 18:24:14 -0500 |
---|---|---|
committer | Sychic <Sychic@github.com> | 2020-12-26 18:24:14 -0500 |
commit | f8a26eac5faa5cee84eaae3fe1b9a7b4588fb7ec (patch) | |
tree | b0f8cca429a40a4253c48994a98c612fdc2277ce /src/main/java | |
parent | 3917028d62623f56428784f039af241bf5750a14 (diff) | |
download | SkyblockMod-f8a26eac5faa5cee84eaae3fe1b9a7b4588fb7ec.tar.gz SkyblockMod-f8a26eac5faa5cee84eaae3fe1b9a7b4588fb7ec.tar.bz2 SkyblockMod-f8a26eac5faa5cee84eaae3fe1b9a7b4588fb7ec.zip |
Add secrets back because i accidentally removed it while resolving conflicts
Diffstat (limited to 'src/main/java')
-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 4179420..f9ad93e 100644 --- a/src/main/java/me/Danker/commands/DungeonsCommand.java +++ b/src/main/java/me/Danker/commands/DungeonsCommand.java @@ -78,6 +78,14 @@ public class DungeonsCommand extends CommandBase { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); 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.")); + } System.out.println("Fetching dungeon stats..."); JsonObject dungeonsObject = profileResponse.get("profile").getAsJsonObject().get("members").getAsJsonObject().get(uuid).getAsJsonObject().get("dungeons").getAsJsonObject(); @@ -94,6 +102,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(); int highestFloor = catacombsObject.get("highest_tier_completed").getAsInt(); JsonObject completionObj = catacombsObject.get("tier_completions").getAsJsonObject(); @@ -107,7 +116,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\n"); + EnumChatFormatting.BLUE + " Tank Level: " + tank + "\n\n" + + EnumChatFormatting.WHITE + " Secrets Found: " + secrets + "\n\n"); StringBuilder completionsHoverString = new StringBuilder(); |