diff options
| author | bowser0000 <bowser0000@gmail.com> | 2022-08-15 20:40:34 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-15 20:40:34 -0400 |
| commit | 3aa11b859a2a22be30a5035f7273e1a604a4dde4 (patch) | |
| tree | 8f428b29a6b56cc9d010b0441bf41b6b78373548 /src/main/java/me/Danker/commands/PetsCommand.java | |
| parent | 33710ac6d9f57fa59e8dfb19a81b053346f1b097 (diff) | |
| parent | daceea1e42371c295c36f80b3246601a6ffb2cc5 (diff) | |
| download | SkyblockMod-3aa11b859a2a22be30a5035f7273e1a604a4dde4.tar.gz SkyblockMod-3aa11b859a2a22be30a5035f7273e1a604a4dde4.tar.bz2 SkyblockMod-3aa11b859a2a22be30a5035f7273e1a604a4dde4.zip | |
1.8.7
Diffstat (limited to 'src/main/java/me/Danker/commands/PetsCommand.java')
| -rw-r--r-- | src/main/java/me/Danker/commands/PetsCommand.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/java/me/Danker/commands/PetsCommand.java b/src/main/java/me/Danker/commands/PetsCommand.java index fc2f691..de3aed9 100644 --- a/src/main/java/me/Danker/commands/PetsCommand.java +++ b/src/main/java/me/Danker/commands/PetsCommand.java @@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; import java.util.ArrayList; import java.util.List; @@ -82,7 +83,7 @@ public class PetsCommand extends CommandBase { } } - class Pet { + static class Pet { public Rarity rarity; public double xp; @@ -103,13 +104,16 @@ public class PetsCommand extends CommandBase { } } this.active = pet.get("active").getAsBoolean(); - this.name = Utils.capitalizeString(pet.get("type").getAsString());; + this.name = Utils.capitalizeString(pet.get("type").getAsString()); this.rarity = rarity; this.xp = pet.get("exp").getAsDouble(); } public String getStringToAdd() { int level = petXpToLevel(this.xp, this.rarity.name()); + if (this.name.equals("Golden Dragon") && this.xp > 25353230D) { + level = 100 + MathHelper.clamp_int((int) ((this.xp - 25353230) / 1886700) + 2, 0, 100); + } String messageToAdd = rarity.getChatColor() + " " + (this.active ? EnumChatFormatting.BOLD + ">>> " : "") + Utils.capitalizeString(this.rarity.name()) + (this.rarityBoosted ? " ⇑" : "") + " " + this.name + " (" + level + ")" + (this.active ? " <<<" : ""); @@ -155,6 +159,7 @@ public class PetsCommand extends CommandBase { String key = ConfigHandler.getString("api", "APIKey"); if (key.equals("")) { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "API key not set. Use /setkey.")); + return; } // Get UUID for Hypixel API requests @@ -176,7 +181,7 @@ public class PetsCommand extends CommandBase { String profileURL = "https://api.hypixel.net/skyblock/profile?profile=" + latestProfile + "&key=" + key; System.out.println("Fetching profile..."); - JsonObject profileResponse = APIHandler.getResponse(profileURL); + JsonObject profileResponse = APIHandler.getResponse(profileURL, true); if (!profileResponse.get("success").getAsBoolean()) { String reason = profileResponse.get("cause").getAsString(); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Failed with reason: " + reason)); |
