From 98a0f0b734727697c9e8072ee08842175ddbf539 Mon Sep 17 00:00:00 2001 From: Quantizr Date: Sun, 13 Dec 2020 23:21:43 -0800 Subject: Added Prevent Placing FoT/Spirit Sceptre on grass/dirt --- src/main/java/me/Danker/DankersSkyblockMod.java | 13 +++++++++++++ src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- src/main/java/me/Danker/commands/ToggleCommand.java | 11 +++++++++-- src/main/java/me/Danker/gui/DankerGui.java | 8 ++++++++ src/main/java/me/Danker/handlers/ConfigHandler.java | 2 ++ 5 files changed, 33 insertions(+), 3 deletions(-) (limited to 'src/main/java/me') diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 64a1f5b..a148574 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -2861,6 +2861,11 @@ public class DankersSkyblockMod Blocks.oak_door, Blocks.skull )); + ArrayList flowerPlaceable = new ArrayList<>(Arrays.asList( + Blocks.grass, + Blocks.dirt, + Blocks.flower_pot + )); if (Utils.inDungeons) { interactables.add(Blocks.coal_block); interactables.add(Blocks.stained_hardened_clay); @@ -2873,6 +2878,14 @@ public class DankersSkyblockMod event.setCanceled(true); } } + if(flowerPlaceable.contains(block)){ + if (ToggleCommand.flowerWeaponsToggled && item.getDisplayName().contains("Flower of Truth")) { + event.setCanceled(true); + } + if (ToggleCommand.flowerWeaponsToggled && item.getDisplayName().contains("Spirit Sceptre")) { + event.setCanceled(true); + } + } } } diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 395f40d..aea4921 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-7)/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 172411c..bd56cc3 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -39,6 +39,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean stopSalvageStarredToggled; public static boolean watcherReadyToggled; public static boolean swapToPickBlockToggled; + public static boolean flowerWeaponsToggled; // Puzzle Solvers public static boolean threeManToggled; public static boolean oruoToggled; @@ -64,7 +65,7 @@ public class ToggleCommand extends CommandBase implements ICommand { @Override public String getCommandUsage(ICommandSender arg0) { return "/" + getCommandName() + " "; @@ -80,7 +81,7 @@ public class ToggleCommand extends CommandBase implements ICommand { if (args.length == 1) { return getListOfStringsMatchingLastWord(args, "gparty", "coords", "golden", "slayercount", "rngesusalerts", "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", - "sceptremessages", "petcolors", "dungeontimer", "golemalerts", + "flowerweapons", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", "implosionmessages", "healmessages", "caketimer", "lowhealthnotify", "lividsolver", "stopsalvagestarred", "threemanpuzzle", "oruopuzzle", "blazepuzzle", @@ -151,6 +152,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "LividDagger", lividDaggerToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Block Livid Dagger ability been set to " + DankersSkyblockMod.SECONDARY_COLOUR + lividDaggerToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "flowerweapons": + flowerWeaponsToggled = !flowerWeaponsToggled; + ConfigHandler.writeBooleanConfig("toggles", "FlowerWeapons", flowerWeaponsToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Prevent Placing FoT/Spirit Sceptre been set to " + DankersSkyblockMod.SECONDARY_COLOUR + flowerWeaponsToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "sceptremessages": sceptreMessages = !sceptreMessages; ConfigHandler.writeBooleanConfig("toggles", "SceptreMessages", sceptreMessages); @@ -308,6 +314,7 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Spirit Bear alerts: " + DankersSkyblockMod.VALUE_COLOUR + spiritBearAlerts + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Block AOTD ability: " + DankersSkyblockMod.VALUE_COLOUR + aotdToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Block Livid Dagger ability: " + DankersSkyblockMod.VALUE_COLOUR + lividDaggerToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Prevent Placing FoT/Spirit Sceptre: " + DankersSkyblockMod.VALUE_COLOUR + flowerWeaponsToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Spirit Sceptre messages: " + DankersSkyblockMod.VALUE_COLOUR + sceptreMessages + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Midas Staff messages: " + DankersSkyblockMod.VALUE_COLOUR + midasStaffMessages + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Implosion messages: " + DankersSkyblockMod.VALUE_COLOUR + implosionMessages + "\n" + diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 613e968..90815ad 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -55,6 +55,7 @@ public class DankerGui extends GuiScreen { private GuiButton lividSolver; private GuiButton stopSalvageStarred; private GuiButton watcherReadyMessage; + private GuiButton flowerWeapons; private GuiButton pickBlock; public DankerGui(int page) { @@ -117,6 +118,8 @@ public class DankerGui extends GuiScreen { stopSalvageStarred = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Stop Salvaging Starred Items: " + Utils.getColouredBoolean(ToggleCommand.stopSalvageStarredToggled)); watcherReadyMessage = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled)); splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); + flowerWeapons = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled)); + switch (page) { case 1: this.buttonList.add(changeDisplay); @@ -165,6 +168,7 @@ public class DankerGui extends GuiScreen { this.buttonList.add(stopSalvageStarred); this.buttonList.add(watcherReadyMessage); this.buttonList.add(splitFishing); + this.buttonList.add(flowerWeapons); this.buttonList.add(backPage); break; } @@ -317,6 +321,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.swapToPickBlockToggled = !ToggleCommand.swapToPickBlockToggled; ConfigHandler.writeBooleanConfig("toggles", "PickBlock", ToggleCommand.swapToPickBlockToggled); pickBlock.displayString = "Auto-Swap to Pick Block: " + Utils.getColouredBoolean(ToggleCommand.swapToPickBlockToggled); + } else if (button == flowerWeapons) { + ToggleCommand.flowerWeaponsToggled = !ToggleCommand.flowerWeaponsToggled; + ConfigHandler.writeBooleanConfig("toggles", "FlowerWeapons", ToggleCommand.flowerWeaponsToggled); + flowerWeapons.displayString = "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index a0e446f..bc62b4b 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -194,6 +194,7 @@ public class ConfigHandler { if (!hasKey("toggles", "StopSalvageStarred")) writeBooleanConfig("toggles", "StopSalvageStarred", false); if (!hasKey("toggles", "WatcherReadyMessage")) writeBooleanConfig("toggles", "WatcherReadyMessage", false); if (!hasKey("toggles", "PickBlock")) writeBooleanConfig("toggles", "PickBlock", false); + if (!hasKey("toggles", "FlowerWeapons")) writeBooleanConfig("toggles", "FlowerWeapons", false); // Puzzle Solvers if (!hasKey("toggles", "ThreeManPuzzle")) writeBooleanConfig("toggles", "ThreeManPuzzle", false); if (!hasKey("toggles", "OruoPuzzle")) writeBooleanConfig("toggles", "OruoPuzzle", false); @@ -458,6 +459,7 @@ public class ConfigHandler { ToggleCommand.stopSalvageStarredToggled = getBoolean("toggles", "StopSalvageStarred"); ToggleCommand.watcherReadyToggled = getBoolean("toggles", "WatcherReadyMessage"); ToggleCommand.swapToPickBlockToggled = getBoolean("toggles", "PickBlock"); + ToggleCommand.flowerWeaponsToggled = getBoolean("toggles", "FlowerWeapons"); // Puzzle Solvers ToggleCommand.threeManToggled = getBoolean("toggles", "ThreeManPuzzle"); ToggleCommand.oruoToggled = getBoolean("toggles", "OruoPuzzle"); -- cgit From dc78cd7e258cf9f074652111627be02d419241ab Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 14 Dec 2020 22:15:15 -0800 Subject: fix indent --- src/main/java/me/Danker/gui/DankerGui.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/me') diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 6cba141..0a4f0a3 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -120,7 +120,7 @@ public class DankerGui extends GuiScreen { watcherReadyMessage = new GuiButton(0, width / 2 - 100, (int) (height * 0.2), "Display Watcher Ready Message: " + Utils.getColouredBoolean(ToggleCommand.watcherReadyToggled)); splitFishing = new GuiButton(0, width / 2 - 100, (int) (height * 0.3), "Split Fishing Display: " + Utils.getColouredBoolean(ToggleCommand.splitFishing)); notifySlayerSlain = new GuiButton(0, width / 2 - 100, (int) (height * 0.4), "Notify when Slayer Slain: " + Utils.getColouredBoolean(ToggleCommand.notifySlayerSlainToggled)); - flowerWeapons = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled)); + flowerWeapons = new GuiButton(0, width / 2 - 100, (int) (height * 0.5), "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled)); switch (page) { case 1: -- cgit From 638892cc5fe10a379ae5734b8d6e9e2caff1fa00 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 14 Dec 2020 22:17:19 -0800 Subject: indent still wrong bc im bad --- src/main/java/me/Danker/gui/DankerGui.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/me') diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 0a4f0a3..dbb6c11 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -171,7 +171,7 @@ public class DankerGui extends GuiScreen { this.buttonList.add(watcherReadyMessage); this.buttonList.add(splitFishing); this.buttonList.add(notifySlayerSlain); - this.buttonList.add(flowerWeapons); + this.buttonList.add(flowerWeapons); this.buttonList.add(backPage); break; } -- cgit