aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/handlers/APIHandler.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-11-09 14:50:39 -0500
committerbowser0000 <bowser0000@gmail.com>2020-11-09 14:50:39 -0500
commit511b95de7dcb83e047dce2adadeff8c18804c1b6 (patch)
tree9e83ee2e91842b6c19a5bb05c0a9d7acac89e3ae /src/main/java/me/Danker/handlers/APIHandler.java
parent432ee590f73a08b184f0d0ec65b8549aa2f3e877 (diff)
downloadSkyblockMod-511b95de7dcb83e047dce2adadeff8c18804c1b6.tar.gz
SkyblockMod-511b95de7dcb83e047dce2adadeff8c18804c1b6.tar.bz2
SkyblockMod-511b95de7dcb83e047dce2adadeff8c18804c1b6.zip
Add config values for colours and many bug fixes
Fix spooky fishing config values Add spooky fishing to /importfishing Add boolean to config to truely turn off chat Maddox Remove bold red name from three man puzzle answer Change spooky fishing to fishing spooky
Diffstat (limited to 'src/main/java/me/Danker/handlers/APIHandler.java')
-rw-r--r--src/main/java/me/Danker/handlers/APIHandler.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/main/java/me/Danker/handlers/APIHandler.java b/src/main/java/me/Danker/handlers/APIHandler.java
index b8d52dc..6d1df32 100644
--- a/src/main/java/me/Danker/handlers/APIHandler.java
+++ b/src/main/java/me/Danker/handlers/APIHandler.java
@@ -14,6 +14,7 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import me.Danker.TheMod;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
@@ -54,16 +55,16 @@ public class APIHandler {
return object;
}
} else if (urlString.startsWith("https://api.mojang.com/users/profiles/minecraft/") && conn.getResponseCode() == 204) {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: Player does not exist."));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: Player does not exist."));
} else {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Request failed. HTTP Error Code: " + conn.getResponseCode()));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Request failed. HTTP Error Code: " + conn.getResponseCode()));
}
}
} catch (MalformedURLException ex) {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occured. See logs for more details."));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details."));
System.err.println(ex);
} catch (IOException ex) {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occured. See logs for more details."));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details."));
System.err.println(ex);
}
@@ -94,13 +95,13 @@ public class APIHandler {
return array;
} else {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Request failed. HTTP Error Code: " + conn.getResponseCode()));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Request failed. HTTP Error Code: " + conn.getResponseCode()));
}
} catch (MalformedURLException ex) {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occured. See logs for more details."));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details."));
System.err.println(ex);
} catch (IOException ex) {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "An error has occured. See logs for more details."));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "An error has occured. See logs for more details."));
System.err.println(ex);
}
@@ -125,11 +126,11 @@ public class APIHandler {
JsonObject profilesResponse = getResponse("https://api.hypixel.net/skyblock/profiles?uuid=" + UUID + "&key=" + key);
if (!profilesResponse.get("success").getAsBoolean()) {
String reason = profilesResponse.get("cause").getAsString();
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Failed with reason: " + reason));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "Failed with reason: " + reason));
return null;
}
if (profilesResponse.get("profiles").isJsonNull()) {
- player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This player doesn't appear to have played SkyBlock."));
+ player.addChatMessage(new ChatComponentText(TheMod.ERROR_COLOUR + "This player doesn't appear to have played SkyBlock."));
return null;
}