aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--src/main/java/me/Danker/TheMod.java118
-rw-r--r--src/main/java/me/Danker/commands/BlockSlayerCommand.java97
-rw-r--r--src/main/java/me/Danker/commands/DHelpCommand.java1
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java9
5 files changed, 183 insertions, 45 deletions
diff --git a/README.md b/README.md
index b125559..7276989 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@ Discord Server: https://discord.gg/QsEkNQS
- RNGesus drop alerts (toggleable)
- Click in chat to open Maddox (toggleable)
- Maddox Menu keybind
+- Block starting other slayer quests
- Fishing tracker (with graphic display) (scalable)
- Dungeons tracker (with graphic display) (scalable)
- Pet background colors based on level
@@ -37,6 +38,7 @@ Discord Server: https://discord.gg/QsEkNQS
- /armor [player] - Uses API to get armour of a person. If no name is provided, it checks yours.
- /importfishing - Imports your fishing stats from your latest profile to your fishing tracker using the API.
- /sbplayers - Uses API to find how many players are on each Skyblock island.
+- /blockslayer <zombie/spider/wolf> <1/2/3/4> - Stops you from starting a slayer quest other than the one specified.
## Keybinds
- Open Maddox menu - M by default.
@@ -45,5 +47,4 @@ Discord Server: https://discord.gg/QsEkNQS
- Slayer tracker for token drops and 20% chance drops uses a 12x12x12 bounding box centered on the player to detect the drops. If you are out of the range of the item drop, it will not count on the tracker.
- API commands may take a while depending on your internet connection. The API may also go down.
- If you use too many API commands too fast, you can and will get rate-limited.
-- An incorrect API key will result in an HTTP error code of 403.
- Importing fishing uses your sea creature kills, which may not always be exactly correct (e.x. someone else kills your sea creature).
diff --git a/src/main/java/me/Danker/TheMod.java b/src/main/java/me/Danker/TheMod.java
index 7a1f219..195f348 100644
--- a/src/main/java/me/Danker/TheMod.java
+++ b/src/main/java/me/Danker/TheMod.java
@@ -18,6 +18,7 @@ import com.google.gson.JsonObject;
import me.Danker.commands.ArmourCommand;
import me.Danker.commands.BankCommand;
+import me.Danker.commands.BlockSlayerCommand;
import me.Danker.commands.ChatMaddoxCommand;
import me.Danker.commands.DHelpCommand;
import me.Danker.commands.DisplayCommand;
@@ -47,6 +48,9 @@ import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.event.ClickEvent;
import net.minecraft.event.ClickEvent.Action;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ContainerChest;
+import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
@@ -171,6 +175,7 @@ public class TheMod
ClientCommandHandler.instance.registerCommand(new ScaleCommand());
ClientCommandHandler.instance.registerCommand(new ChatMaddoxCommand());
ClientCommandHandler.instance.registerCommand(new SkyblockPlayersCommand());
+ ClientCommandHandler.instance.registerCommand(new BlockSlayerCommand());
}
// Update checker
@@ -1596,50 +1601,75 @@ public class TheMod
if (Mouse.getEventButton() != 0 && Mouse.getEventButton() != 1) return; // Left click or right click
if (event.gui instanceof GuiChest) {
- LootCommand lc = new LootCommand();
- ConfigHandler cf = new ConfigHandler();
- GuiChest inventory = (GuiChest) event.gui;
- Slot mouseSlot = inventory.getSlotUnderMouse();
- if (mouseSlot == null || mouseSlot.getStack() == null) return;
- ItemStack item = mouseSlot.getStack();
-
- if (item.getDisplayName().contains("Open Reward Chest")) {
- List<String> tooltip = item.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
- for (String lineUnclean : tooltip) {
- String line = StringUtils.stripControlCodes(lineUnclean);
- if (line.contains("FREE")) {
- break;
- } else if (line.contains(" Coins")) {
- int coinsSpent = Integer.parseInt(line.substring(0, line.indexOf(" ")).replaceAll(",", ""));
-
- List<String> scoreboard = ScoreboardHandler.getSidebarLines();
- for (String s : scoreboard) {
- String sCleaned = ScoreboardHandler.cleanSB(s);
- if (sCleaned.contains("The Catacombs (")) {
- if (sCleaned.contains("F1")) {
- lc.f1CoinsSpent += coinsSpent;
- lc.f1CoinsSpentSession += coinsSpent;
- cf.writeDoubleConfig("catacombs", "floorOneCoins", lc.f1CoinsSpent);
- } else if (sCleaned.contains("F2")) {
- lc.f2CoinsSpent += coinsSpent;
- lc.f2CoinsSpentSession += coinsSpent;
- cf.writeDoubleConfig("catacombs", "floorTwoCoins", lc.f2CoinsSpent);
- } else if (sCleaned.contains("F3")) {
- lc.f3CoinsSpent += coinsSpent;
- lc.f3CoinsSpentSession += coinsSpent;
- cf.writeDoubleConfig("catacombs", "floorThreeCoins", lc.f3CoinsSpent);
- } else if (sCleaned.contains("F4")) {
- lc.f4CoinsSpent += coinsSpent;
- lc.f4CoinsSpentSession += coinsSpent;
- cf.writeDoubleConfig("catacombs", "floorFourCoins", lc.f4CoinsSpent);
- }
- break;
- }
- }
- break;
- }
- }
- }
+ Container containerChest = ((GuiChest) event.gui).inventorySlots;
+ if (containerChest instanceof ContainerChest) {
+ // a lot of declarations here, if you get scarred, my bad
+ LootCommand lc = new LootCommand();
+ ConfigHandler cf = new ConfigHandler();
+ GuiChest chest = (GuiChest) event.gui;
+ IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory();
+ Slot mouseSlot = chest.getSlotUnderMouse();
+ if (mouseSlot == null || mouseSlot.getStack() == null) return;
+ ItemStack item = mouseSlot.getStack();
+ String inventoryName = inventory.getDisplayName().getUnformattedText();
+
+ if (inventoryName.endsWith(" Chest") && item.getDisplayName().contains("Open Reward Chest")) {
+ List<String> tooltip = item.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
+ for (String lineUnclean : tooltip) {
+ String line = StringUtils.stripControlCodes(lineUnclean);
+ if (line.contains("FREE")) {
+ break;
+ } else if (line.contains(" Coins")) {
+ int coinsSpent = Integer.parseInt(line.substring(0, line.indexOf(" ")).replaceAll(",", ""));
+
+ List<String> scoreboard = ScoreboardHandler.getSidebarLines();
+ for (String s : scoreboard) {
+ String sCleaned = ScoreboardHandler.cleanSB(s);
+ if (sCleaned.contains("The Catacombs (")) {
+ if (sCleaned.contains("F1")) {
+ lc.f1CoinsSpent += coinsSpent;
+ lc.f1CoinsSpentSession += coinsSpent;
+ cf.writeDoubleConfig("catacombs", "floorOneCoins", lc.f1CoinsSpent);
+ } else if (sCleaned.contains("F2")) {
+ lc.f2CoinsSpent += coinsSpent;
+ lc.f2CoinsSpentSession += coinsSpent;
+ cf.writeDoubleConfig("catacombs", "floorTwoCoins", lc.f2CoinsSpent);
+ } else if (sCleaned.contains("F3")) {
+ lc.f3CoinsSpent += coinsSpent;
+ lc.f3CoinsSpentSession += coinsSpent;
+ cf.writeDoubleConfig("catacombs", "floorThreeCoins", lc.f3CoinsSpent);
+ } else if (sCleaned.contains("F4")) {
+ lc.f4CoinsSpent += coinsSpent;
+ lc.f4CoinsSpentSession += coinsSpent;
+ cf.writeDoubleConfig("catacombs", "floorFourCoins", lc.f4CoinsSpent);
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ } if (!BlockSlayerCommand.onlySlayerName.equals("")) {
+ if (inventoryName.equals("Slayer")) {
+ if (!item.getDisplayName().contains("Revenant Horror") && !item.getDisplayName().contains("Tarantula Broodfather") && !item.getDisplayName().contains("Sven Packmaster")) return;
+ if (!item.getDisplayName().contains(BlockSlayerCommand.onlySlayerName)) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Danker's Skyblock Mod has stopped you from starting this quest (Set to " + BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber + ")"));
+ Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, (float) 0.5);
+ event.setCanceled(true);
+ }
+ } else if (inventoryName.equals("Revenant Horror") || inventoryName.equals("Tarantula Broodfather") || inventoryName.equals("Sven Packmaster")) {
+ if (item.getDisplayName().contains("Revenant Horror") || item.getDisplayName().contains("Tarantula Broodfather") || item.getDisplayName().contains("Sven Packmaster")) {
+ // Only check number as they passed the above check
+ String slayerNumber = item.getDisplayName().substring(item.getDisplayName().lastIndexOf(" ") + 1, item.getDisplayName().length());
+ if (!slayerNumber.equals(BlockSlayerCommand.onlySlayerNumber)) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Danker's Skyblock Mod has stopped you from starting this quest (Set to " + BlockSlayerCommand.onlySlayerName + " " + BlockSlayerCommand.onlySlayerNumber + ")"));
+ Minecraft.getMinecraft().thePlayer.playSound("note.bass", 1, (float) 0.5);
+ event.setCanceled(true);
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/src/main/java/me/Danker/commands/BlockSlayerCommand.java b/src/main/java/me/Danker/commands/BlockSlayerCommand.java
new file mode 100644
index 0000000..f88a334
--- /dev/null
+++ b/src/main/java/me/Danker/commands/BlockSlayerCommand.java
@@ -0,0 +1,97 @@
+package me.Danker.commands;
+
+import java.util.List;
+
+import me.Danker.handlers.ConfigHandler;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+
+public class BlockSlayerCommand extends CommandBase {
+
+ public static String onlySlayerName = "";
+ public static String onlySlayerNumber = "";
+
+ @Override
+ public String getCommandName() {
+ return "blockslayer";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender arg0) {
+ return "/" + getCommandName() + " <zombie/spider/wolf> <1/2/3/4>";
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ if (args.length == 1) {
+ return getListOfStringsMatchingLastWord(args, "zombie", "spider", "wolf");
+ } else if (args.length == 2) {
+ return getListOfStringsMatchingLastWord(args, "1", "2", "3", "4");
+ }
+ return null;
+ }
+
+ @Override
+ public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
+ final EntityPlayer player = (EntityPlayer)arg0;
+ final ConfigHandler cf = new ConfigHandler();
+
+ if (arg1.length == 0 || (arg1.length == 1 && !arg1[0].equalsIgnoreCase("off"))) {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0)));
+ return;
+ }
+
+ if (arg1[0].equalsIgnoreCase("zombie")) {
+ onlySlayerName = "Revenant Horror";
+ } else if (arg1[0].equalsIgnoreCase("spider")) {
+ onlySlayerName = "Tarantula Broodfather";
+ } else if (arg1[0].equalsIgnoreCase("wolf")) {
+ onlySlayerName = "Sven Packmaster";
+ } else if (arg1[0].equalsIgnoreCase("off")) {
+ onlySlayerName = "";
+ onlySlayerNumber = "";
+ cf.writeStringConfig("toggles", "BlockSlayer", "");
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Slayer blocking turned off."));
+ return;
+ } else {
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0)));
+ return;
+ }
+
+ int slayerNumber = Integer.parseInt(arg1[1]);
+ // Just manually set to roman numeral, I don't wanna put a whole converter in here
+ switch (slayerNumber) {
+ case 1:
+ onlySlayerNumber = "I";
+ break;
+ case 2:
+ onlySlayerNumber = "II";
+ break;
+ case 3:
+ onlySlayerNumber = "III";
+ break;
+ case 4:
+ onlySlayerNumber = "IV";
+ break;
+ default:
+ onlySlayerName = "";
+ onlySlayerNumber = "";
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Usage: " + getCommandUsage(arg0)));
+ return;
+ }
+
+ cf.writeStringConfig("toggles", "BlockSlayer", onlySlayerName + " " + onlySlayerNumber);
+ player.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN + "Slayer blocking set to " + EnumChatFormatting.DARK_GREEN + onlySlayerName + " " + onlySlayerNumber));
+ }
+
+}
diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java
index 52db06b..43f6e94 100644
--- a/src/main/java/me/Danker/commands/DHelpCommand.java
+++ b/src/main/java/me/Danker/commands/DHelpCommand.java
@@ -49,6 +49,7 @@ public class DHelpCommand extends CommandBase {
EnumChatFormatting.GOLD + " /armor [player]" + EnumChatFormatting.AQUA + " - Uses API to get armour of a person. If no name is provided, it checks yours.\n" +
EnumChatFormatting.GOLD + " /importfishing" + EnumChatFormatting.AQUA + " - Imports your fishing stats from your latest profile to your fishing tracker using the API.\n" +
EnumChatFormatting.GOLD + " /sbplayers" + EnumChatFormatting.AQUA + " - Uses API to find how many players are on each Skyblock island.\n" +
+ EnumChatFormatting.GOLD + " /blockslayer <zombie/spider/wolf> <1/2/3/4>" + EnumChatFormatting.AQUA + " - Stops you from starting a slayer quest other than the one specified.\n" +
EnumChatFormatting.GREEN + " Open Maddox Menu" + EnumChatFormatting.AQUA + " - M by default.\n"));
}
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index 34aaffe..f14c4c4 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -2,6 +2,7 @@ package me.Danker.handlers;
import java.io.File;
+import me.Danker.commands.BlockSlayerCommand;
import me.Danker.commands.DisplayCommand;
import me.Danker.commands.LootCommand;
import me.Danker.commands.MoveCommand;
@@ -181,6 +182,7 @@ public class ConfigHandler {
if (!hasKey("toggles", "SceptreMessages")) writeBooleanConfig("toggles", "SceptreMessages", true);
if (!hasKey("toggles", "PetColors")) writeBooleanConfig("toggles", "PetColors", false);
if (!hasKey("toggles", "DungeonTimer")) writeBooleanConfig("toggles", "DungeonTimer", false);
+ if (!hasKey("toggles", "BlockSlayer")) writeStringConfig("toggles", "BlockSlayer", "");
if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", "");
@@ -312,6 +314,13 @@ public class ConfigHandler {
tf.petColoursToggled = getBoolean("toggles", "PetColors");
tf.dungeonTimerToggled = getBoolean("toggles", "DungeonTimer");
+ final BlockSlayerCommand bs = new BlockSlayerCommand();
+ String onlySlayer = getString("toggles", "BlockSlayer");
+ if (!onlySlayer.equals("")) {
+ bs.onlySlayerName = onlySlayer.substring(0, onlySlayer.lastIndexOf(" "));
+ bs.onlySlayerNumber = onlySlayer.substring(onlySlayer.lastIndexOf(" ") + 1, onlySlayer.length());
+ }
+
final LootCommand lc = new LootCommand();
// Wolf
lc.wolfSvens = getInt("wolf", "svens");