diff options
Diffstat (limited to 'src/main/java/me/Danker/handlers')
-rw-r--r-- | src/main/java/me/Danker/handlers/APIHandler.java | 19 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 25 |
2 files changed, 35 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; } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 2b6c0f7..98cc35e 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -11,6 +11,7 @@ import me.Danker.commands.ScaleCommand; import me.Danker.commands.ToggleCommand; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; @@ -334,6 +335,7 @@ public class ConfigHandler { if (!hasKey("misc", "display")) writeStringConfig("misc", "display", "off"); if (!hasKey("misc", "autoDisplay")) writeBooleanConfig("misc", "autoDisplay", false); if (!hasKey("misc", "skill50Time")) writeIntConfig("misc", "skill50Time", 3); + if (!hasKey("misc", "trueChatMaddoxEnabled")) writeBooleanConfig("misc", "trueChatMaddoxEnabled", true); ScaledResolution scaled = new ScaledResolution(Minecraft.getMinecraft()); int height = scaled.getScaledHeight(); @@ -353,6 +355,17 @@ public class ConfigHandler { if (!hasKey("scales", "skill50Scale")) writeDoubleConfig("scales", "skill50Scale", 1); if (!hasKey("scales", "lividHpScale")) writeDoubleConfig("scales", "lividHpScale", 1); + if (!hasKey("colors", "main")) writeStringConfig("colors", "main", "" + EnumChatFormatting.GREEN); + if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", "" + EnumChatFormatting.DARK_GREEN); + if (!hasKey("colors", "delimiter")) writeStringConfig("colors", "delimiter", "" + EnumChatFormatting.AQUA); + if (!hasKey("colors", "error")) writeStringConfig("colors", "error", "" + EnumChatFormatting.RED); + if (!hasKey("colors", "type")) writeStringConfig("colors", "type", "" + EnumChatFormatting.GREEN); + if (!hasKey("colors", "value")) writeStringConfig("colors", "value", "" + EnumChatFormatting.DARK_GREEN); + if (!hasKey("colors", "skillAverage")) writeStringConfig("colors", "skillAverage", "" + EnumChatFormatting.GOLD); + if (!hasKey("colors", "answer")) writeStringConfig("colors", "answer", "" + EnumChatFormatting.DARK_GREEN); + if (!hasKey("colors", "skill50Display")) writeStringConfig("colors", "skill50Display", "" + EnumChatFormatting.AQUA); + if (!hasKey("colors", "coordsDisplay")) writeStringConfig("colors", "coordsDisplay", "" + EnumChatFormatting.WHITE); + final ToggleCommand tf = new ToggleCommand(); tf.gpartyToggled = getBoolean("toggles", "GParty"); tf.coordsToggled = getBoolean("toggles", "Coords"); @@ -523,6 +536,7 @@ public class ConfigHandler { ds.display = getString("misc", "display"); ds.auto = getBoolean("misc", "autoDisplay"); TheMod.SKILL_TIME = getInt("misc", "skill50Time") * 20; + tf.trueChatMaddoxEnabled = getBoolean("misc", "trueChatMaddoxEnabled"); final MoveCommand moc = new MoveCommand(); moc.coordsXY[0] = getInt("locations", "coordsX"); @@ -542,6 +556,17 @@ public class ConfigHandler { sc.dungeonTimerScale = getDouble("scales", "dungeonTimerScale"); sc.skill50Scale = getDouble("scales", "skill50Scale"); sc.lividHpScale = getDouble("scales", "lividHpScale"); + + TheMod.MAIN_COLOUR = getString("colors", "main"); + TheMod.SECONDARY_COLOUR = getString("colors", "secondary"); + TheMod.DELIMITER_COLOUR = getString("colors", "delimiter"); + TheMod.ERROR_COLOUR = getString("colors", "error"); + TheMod.TYPE_COLOUR = getString("colors", "type"); + TheMod.VALUE_COLOUR = getString("colors", "value"); + TheMod.SKILL_AVERAGE_COLOUR = getString("colors", "skillAverage"); + TheMod.ANSWER_COLOUR = getString("colors", "answer"); + TheMod.SKILL_50_COLOUR = getString("colors", "skill50Display"); + TheMod.COORDS_COLOUR = getString("colors", "coordsDisplay"); } } |