From db03ce14fde088c15dc366e70d937338de8721dc Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 14 Nov 2020 18:39:14 -0500 Subject: Add option to hide heal messages --- src/main/java/me/Danker/TheMod.java | 25 ++++++++++++++-------- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/ToggleCommand.java | 12 ++++++++--- src/main/java/me/Danker/gui/DankerGui.java | 21 ++++++++++++------ .../java/me/Danker/handlers/ConfigHandler.java | 2 ++ 5 files changed, 42 insertions(+), 20 deletions(-) (limited to 'src/main/java/me') diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java index 4131a39..bed2b69 100644 --- a/src/main/java/me/Danker/TheMod.java +++ b/src/main/java/me/Danker/TheMod.java @@ -398,6 +398,22 @@ public class TheMod if (message.contains(":")) return; + // Spirit Sceptre + if (!tc.sceptreMessages && message.contains("Your Spirit Sceptre hit ")) { + event.setCanceled(true); + return; + } + // Midas Staff + if (!tc.midasStaffMessages && message.contains("Your Molten Wave hit ")) { + event.setCanceled(true); + return; + } + // Heals + if (!tc.healMessages && message.contains(" health!") && (message.contains("You healed ") || message.contains(" healed you for "))) { + event.setCanceled(true); + return; + } + if (ToggleCommand.oruoToggled && Utils.inDungeons) { // Don't set every answer to wrong with this question if (message.contains("What SkyBlock year is it?")) triviaAnswers = null; @@ -997,15 +1013,6 @@ public class TheMod if (tc.spiritBearAlerts && message.contains("The Spirit Bear has appeared!")) { Utils.createTitle(EnumChatFormatting.DARK_PURPLE + "SPIRIT BEAR", 2); } - - // Spirit Sceptre - if (!tc.sceptreMessages && message.contains("Your Spirit Sceptre hit ")) { - event.setCanceled(true); - } - // Midas Staff - if (!tc.midasStaffMessages && message.contains("Your Molten Wave hit ")) { - event.setCanceled(true); - } } @SubscribeEvent diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 90c2be8..abbc3c8 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -34,7 +34,7 @@ public class DHelpCommand extends CommandBase { EnumChatFormatting.GOLD + " Commands, " + EnumChatFormatting.GREEN + " Keybinds.\n" + EnumChatFormatting.GOLD + " /dhelp" + EnumChatFormatting.AQUA + " - Returns this message.\n" + EnumChatFormatting.GOLD + " /dsm" + EnumChatFormatting.AQUA + " - Opens the GUI for Danker's Skyblock Mod.\n" + - EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + + EnumChatFormatting.GOLD + " /toggle " + EnumChatFormatting.AQUA + " - Toggles features. /toggle list returns values of every toggle.\n" + EnumChatFormatting.GOLD + " /setkey " + EnumChatFormatting.AQUA + " - Sets API key.\n" + EnumChatFormatting.GOLD + " /getkey" + EnumChatFormatting.AQUA + " - Returns key set with /setkey and copies it to your clipboard.\n" + EnumChatFormatting.GOLD + " /loot [winter/festival/spooky/f(1-6)/session]" + EnumChatFormatting.AQUA + " - Returns loot received from slayer quests or fishing stats. /loot fishing winter returns winter sea creatures instead.\n" + diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 473c29a..25b3ff3 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -33,6 +33,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean skill50DisplayToggled; public static boolean outlineTextToggled; public static boolean midasStaffMessages; + public static boolean healMessages; public static boolean cakeTimerToggled; public static boolean lividSolverToggled; // Puzzle Solvers @@ -50,7 +51,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " "; + "outlinetext/midasstaffmessages/healmessages/caketimer/lividsolver/threemanpuzzle/oruopuzzle/blazepuzzle/creeperpuzzle/list>"; } @Override @@ -65,8 +66,8 @@ public class ToggleCommand extends CommandBase implements ICommand { "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", - "caketimer", "lividsolver", "threemanpuzzle", "oruopuzzle", "blazepuzzle", - "creeperpuzzle", "list"); + "healmessages", "caketimer", "lividsolver", "threemanpuzzle", "oruopuzzle", + "blazepuzzle", "creeperpuzzle", "list"); } return null; } @@ -153,6 +154,10 @@ public class ToggleCommand extends CommandBase implements ICommand { midasStaffMessages = !midasStaffMessages; cf.writeBooleanConfig("toggles", "MidasStaffMessages", midasStaffMessages); player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Midas Staff messages have been set to " + TheMod.SECONDARY_COLOUR + midasStaffMessages + TheMod.MAIN_COLOUR + ".")); + } else if (arg1[0].equalsIgnoreCase("healmessages")) { + healMessages = !healMessages; + cf.writeBooleanConfig("toggles", "HealMessages", healMessages); + player.addChatMessage(new ChatComponentText(TheMod.MAIN_COLOUR + "Heal messages have been set to " + TheMod.SECONDARY_COLOUR + healMessages + TheMod.MAIN_COLOUR + ".")); } else if (arg1[0].equalsIgnoreCase("caketimer")) { cakeTimerToggled = !cakeTimerToggled; cf.writeBooleanConfig("toggles", "CakeTimer", cakeTimerToggled); @@ -196,6 +201,7 @@ public class ToggleCommand extends CommandBase implements ICommand { TheMod.TYPE_COLOUR + " Skill 50 display: " + TheMod.VALUE_COLOUR + skill50DisplayToggled + "\n" + TheMod.TYPE_COLOUR + " Outline displayed text: " + TheMod.VALUE_COLOUR + outlineTextToggled + "\n" + TheMod.TYPE_COLOUR + " Midas Staff messages: " + TheMod.VALUE_COLOUR + midasStaffMessages + "\n" + + TheMod.TYPE_COLOUR + " Heal messages: " + TheMod.VALUE_COLOUR + healMessages + "\n" + TheMod.TYPE_COLOUR + " Cake timer: " + TheMod.VALUE_COLOUR + cakeTimerToggled + "\n" + TheMod.TYPE_COLOUR + " Livid solver: " + TheMod.VALUE_COLOUR + lividSolverToggled + "\n" + TheMod.TYPE_COLOUR + " Three man puzzle solver: " + TheMod.VALUE_COLOUR + threeManToggled + "\n" + diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 1bf7911..d77df14 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -47,6 +47,7 @@ public class DankerGui extends GuiScreen { private GuiButton skill50Display; private GuiButton outlineText; private GuiButton midasStaffMessages; + private GuiButton healMessages; private GuiButton cakeTimer; private GuiButton lividSolver; @@ -94,13 +95,14 @@ public class DankerGui extends GuiScreen { spiritBearAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Spirit Bear Spawn Alerts: " + Utils.getColouredBoolean(ToggleCommand.spiritBearAlerts)); sceptreMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Spirit Sceptre Messages: " + Utils.getColouredBoolean(ToggleCommand.sceptreMessages)); midasStaffMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Midas Staff Messages: " + Utils.getColouredBoolean(ToggleCommand.midasStaffMessages)); - goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); - petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); - expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); - lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); + healMessages = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages)); + goldenEnch = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Golden T10/T6/T4 Enchantments: " + Utils.getColouredBoolean(ToggleCommand.goldenToggled)); + petColours = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Colour Pet Backgrounds: " + Utils.getColouredBoolean(ToggleCommand.petColoursToggled)); + expertiseLore = new GuiButton(0, width / 2 - 100, (int) (height * 0.7), "Expertise Kills In Lore: " + Utils.getColouredBoolean(ToggleCommand.expertiseLoreToggled)); // Page 4 - golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); - rngesusAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); + lividSolver = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Find Correct Livid: " + Utils.getColouredBoolean(ToggleCommand.lividSolverToggled)); + golemAlerts = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Alert When Golem Spawns: " + Utils.getColouredBoolean(ToggleCommand.golemAlertToggled)); + rngesusAlert = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "RNGesus Alerts: " + Utils.getColouredBoolean(ToggleCommand.rngesusAlerts)); if (page == 1) { this.buttonList.add(changeDisplay); @@ -125,13 +127,14 @@ public class DankerGui extends GuiScreen { this.buttonList.add(spiritBearAlert); this.buttonList.add(sceptreMessages); this.buttonList.add(midasStaffMessages); + this.buttonList.add(healMessages); this.buttonList.add(goldenEnch); this.buttonList.add(petColours); this.buttonList.add(expertiseLore); - this.buttonList.add(lividSolver); this.buttonList.add(nextPage); this.buttonList.add(backPage); } else if (page == 4) { + this.buttonList.add(lividSolver); this.buttonList.add(golemAlerts); this.buttonList.add(rngesusAlert); this.buttonList.add(backPage); @@ -257,6 +260,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.cakeTimerToggled = !ToggleCommand.cakeTimerToggled; ConfigHandler.writeBooleanConfig("toggles", "CakeTimer", ToggleCommand.cakeTimerToggled); cakeTimer.displayString = "Cake Timer: " + Utils.getColouredBoolean(ToggleCommand.cakeTimerToggled); + } else if (button == healMessages) { + ToggleCommand.healMessages = !ToggleCommand.healMessages; + ConfigHandler.writeBooleanConfig("toggles", "HealMessages", ToggleCommand.healMessages); + healMessages.displayString = "Heal Messages: " + Utils.getColouredBoolean(ToggleCommand.healMessages); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 7473e43..131076d 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -191,6 +191,7 @@ public class ConfigHandler { if (!hasKey("toggles", "Skill50Display")) writeBooleanConfig("toggles", "Skill50Display", false); if (!hasKey("toggles", "OutlineText")) writeBooleanConfig("toggles", "OutlineText", false); if (!hasKey("toggles", "MidasStaffMessages")) writeBooleanConfig("toggles", "MidasStaffMessages", true); + if (!hasKey("toggles", "HealMessages")) writeBooleanConfig("toggles", "HealMessages", true); if (!hasKey("toggles", "CakeTimer")) writeBooleanConfig("toggles", "CakeTimer", false); if (!hasKey("toggles", "LividSolver")) writeBooleanConfig("toggles", "LividSolver", false); // Puzzle Solvers @@ -391,6 +392,7 @@ public class ConfigHandler { tf.skill50DisplayToggled = getBoolean("toggles", "Skill50Display"); tf.outlineTextToggled = getBoolean("toggles", "OutlineText"); tf.midasStaffMessages = getBoolean("toggles", "MidasStaffMessages"); + tf.healMessages = getBoolean("toggles", "HealMessages"); tf.cakeTimerToggled = getBoolean("toggles", "CakeTimer"); tf.lividSolverToggled = getBoolean("toggles", "LividSolver"); // Puzzle Solvers -- cgit