aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/SkillsCommand.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-11-21 19:16:08 -0500
committerbowser0000 <bowser0000@gmail.com>2020-11-21 19:16:08 -0500
commit43c6b9c0387eb0294d12f9de22baad7f9235b86f (patch)
tree8af2acaf7ed14d518984b83a56f8a617e2c4abdd /src/main/java/me/Danker/commands/SkillsCommand.java
parentb8481811e5e25f2a710053444347295010a6155c (diff)
downloadSkyblockMod-43c6b9c0387eb0294d12f9de22baad7f9235b86f.tar.gz
SkyblockMod-43c6b9c0387eb0294d12f9de22baad7f9235b86f.tar.bz2
SkyblockMod-43c6b9c0387eb0294d12f9de22baad7f9235b86f.zip
Access static methods in static ways and remove unused imports
Diffstat (limited to 'src/main/java/me/Danker/commands/SkillsCommand.java')
-rw-r--r--src/main/java/me/Danker/commands/SkillsCommand.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/me/Danker/commands/SkillsCommand.java b/src/main/java/me/Danker/commands/SkillsCommand.java
index 12bfd93..71905fc 100644
--- a/src/main/java/me/Danker/commands/SkillsCommand.java
+++ b/src/main/java/me/Danker/commands/SkillsCommand.java
@@ -45,12 +45,10 @@ public class SkillsCommand extends CommandBase {
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");
+ String key = ConfigHandler.getString("api", "APIKey");
if (key.equals("")) {
player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "API key not set. Use /setkey."));
}
@@ -65,16 +63,16 @@ public class SkillsCommand extends CommandBase {
} else {
username = arg1[0];
player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Checking skills of " + TheMod.SECONDARY_COLOUR + username));
- uuid = ah.getUUID(username);
+ uuid = APIHandler.getUUID(username);
}
// Find stats of latest profile
- String latestProfile = ah.getLatestProfileID(uuid, key);
+ String latestProfile = APIHandler.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);
+ JsonObject profileResponse = APIHandler.getResponse(profileURL);
if (!profileResponse.get("success").getAsBoolean()) {
String reason = profileResponse.get("cause").getAsString();
player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason));
@@ -131,7 +129,7 @@ public class SkillsCommand extends CommandBase {
String playerURL = "https://api.hypixel.net/player?uuid=" + uuid + "&key=" + key;
System.out.println("Fetching skills from achievement API");
- JsonObject playerObject = ah.getResponse(playerURL);
+ JsonObject playerObject = APIHandler.getResponse(playerURL);
if (!playerObject.get("success").getAsBoolean()) {
String reason = profileResponse.get("cause").getAsString();