diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-11-26 16:10:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-26 16:10:11 -0500 |
commit | 016814851e46acdbc7a8fce44746eb67feef5905 (patch) | |
tree | b39ca6496c233efe327dcdff0379f50b5cc6e243 /src/main/java/me/Danker/handlers/APIHandler.java | |
parent | 292f5dde43c3e00b78e1d4e772ae336340b0a834 (diff) | |
parent | 16f1cd3c009184e8c8f5c75b9afae9ca531d2fee (diff) | |
download | SkyblockMod-016814851e46acdbc7a8fce44746eb67feef5905.tar.gz SkyblockMod-016814851e46acdbc7a8fce44746eb67feef5905.tar.bz2 SkyblockMod-016814851e46acdbc7a8fce44746eb67feef5905.zip |
Merge pull request #30 from bowser0000/development
Diffstat (limited to 'src/main/java/me/Danker/handlers/APIHandler.java')
-rw-r--r-- | src/main/java/me/Danker/handlers/APIHandler.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main/java/me/Danker/handlers/APIHandler.java b/src/main/java/me/Danker/handlers/APIHandler.java index b8d52dc..c96aa50 100644 --- a/src/main/java/me/Danker/handlers/APIHandler.java +++ b/src/main/java/me/Danker/handlers/APIHandler.java @@ -14,10 +14,10 @@ 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; -import net.minecraft.util.EnumChatFormatting; public class APIHandler { public static JsonObject getResponse(String urlString) { @@ -54,16 +54,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 +94,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 +125,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; } |