aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/PetsCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/Danker/commands/PetsCommand.java')
-rw-r--r--src/main/java/me/Danker/commands/PetsCommand.java11
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));