From eb4bf8a8191add4fd50dbc0daa088ec42bf8eb6d Mon Sep 17 00:00:00 2001 From: Kal Draganov Date: Mon, 14 Dec 2020 18:49:29 -0500 Subject: Move EditLocations Button to Main Moved editLocations GUI button to the main pages. --- src/main/java/me/Danker/gui/DankerGui.java | 6 ++++++ src/main/java/me/Danker/gui/DisplayGui.java | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) (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 613e968..de99686 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -24,6 +24,7 @@ public class DankerGui extends GuiScreen { private GuiButton nextPage; private GuiButton githubLink; private GuiButton discordLink; + private GuiButton editLocations; private GuiButton changeDisplay; private GuiButton onlySlayer; private GuiButton puzzleSolvers; @@ -80,6 +81,7 @@ public class DankerGui extends GuiScreen { nextPage = new GuiButton(0, width / 2 + 20, (int) (height * 0.8), 80, 20, "Next >"); githubLink = new GuiButton(0, 2, height - 50, 80, 20, "GitHub"); discordLink = new GuiButton(0, 2, height - 30, 80, 20, "Discord"); + editLocations = new GuiButton(0, 2, 5, 100, 20, "Edit Locations"); // Page 1 changeDisplay = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Change Display Settings"); @@ -117,6 +119,7 @@ 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)); + switch (page) { case 1: this.buttonList.add(changeDisplay); @@ -172,6 +175,7 @@ public class DankerGui extends GuiScreen { this.buttonList.add(githubLink); this.buttonList.add(discordLink); this.buttonList.add(closeGUI); + this.buttonList.add(editLocations); } @Override @@ -191,6 +195,8 @@ public class DankerGui extends GuiScreen { DankersSkyblockMod.guiToOpen = "dankergui" + (page + 1); } else if (button == backPage) { DankersSkyblockMod.guiToOpen = "dankergui" + (page - 1); + } else if (button == editLocations) { + DankersSkyblockMod.guiToOpen = "editlocations"; } else if (button == githubLink) { try { Desktop.getDesktop().browse(new URI("https://github.com/bowser0000/SkyblockMod")); diff --git a/src/main/java/me/Danker/gui/DisplayGui.java b/src/main/java/me/Danker/gui/DisplayGui.java index f498a67..2f704b3 100644 --- a/src/main/java/me/Danker/gui/DisplayGui.java +++ b/src/main/java/me/Danker/gui/DisplayGui.java @@ -15,7 +15,6 @@ public class DisplayGui extends GuiScreen { private boolean addSession = false; private GuiButton goBack; - private GuiButton editLocations; private GuiButton off; private GuiButton showSession; private GuiButton zombie; @@ -49,7 +48,6 @@ public class DisplayGui extends GuiScreen { int width = sr.getScaledWidth(); goBack = new GuiButton(0, 2, height - 30, 100, 20, "Go Back"); - editLocations = new GuiButton(0, 2, height - 55, 100, 20, "Edit Locations"); showSession = new GuiButton(0, width / 2 - 100, (int) (height * 0.1), "Current Session Only: " + Utils.getColouredBoolean(addSession)); off = new GuiButton(0, width / 2 - 210, (int) (height * 0.2), "Off"); auto = new GuiButton(0, width / 2 + 10, (int) (height * 0.2), "Auto"); @@ -87,7 +85,6 @@ public class DisplayGui extends GuiScreen { this.buttonList.add(catacombsF5); this.buttonList.add(catacombsF6); this.buttonList.add(catacombsF7); - this.buttonList.add(editLocations); this.buttonList.add(goBack); } @@ -116,8 +113,6 @@ public class DisplayGui extends GuiScreen { public void actionPerformed(GuiButton button) { if (button == goBack) { DankersSkyblockMod.guiToOpen = "dankergui1"; - } else if (button == editLocations) { - DankersSkyblockMod.guiToOpen = "editlocations"; } else if (button == showSession) { addSession = !addSession; showSession.displayString = "Current Session Only: " + Utils.getColouredBoolean(addSession); -- cgit From 1b24fe5548a52a9416efc91284ffb4256c6c5610 Mon Sep 17 00:00:00 2001 From: Kaloyan Draganov Date: Sun, 20 Dec 2020 22:42:27 -0500 Subject: Reparty Command --- src/main/java/me/Danker/DankersSkyblockMod.java | 46 +++++++++++-- .../java/me/Danker/commands/RepartyCommand.java | 78 ++++++++++++++++++++++ .../java/me/Danker/handlers/ConfigHandler.java | 3 +- 3 files changed, 122 insertions(+), 5 deletions(-) create mode 100644 src/main/java/me/Danker/commands/RepartyCommand.java (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 bfd776d..8688bee 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -185,7 +185,9 @@ public class DankersSkyblockMod public static int PET_70_TO_79; public static int PET_80_TO_89; public static int PET_90_TO_99; - public static int PET_100; + public static int PET_100; + + public static List partyList = new ArrayList<>(); @EventHandler public void init(FMLInitializationEvent event) { @@ -300,7 +302,8 @@ public class DankersSkyblockMod ClientCommandHandler.instance.registerCommand(new DungeonsCommand()); ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); - ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); + ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); + ClientCommandHandler.instance.registerCommand(new RepartyCommand()); } @EventHandler @@ -353,7 +356,42 @@ public class DankersSkyblockMod @SubscribeEvent(priority = EventPriority.HIGHEST) public void onChat(ClientChatReceivedEvent event) { String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); - + + // Reparty command + if (System.currentTimeMillis() / 1000 - RepartyCommand.callTime <= 1.5) { + if (!(message.contains("----") || message.contains("disbanded") || message.contains("seconds to accept") || message.contains("●") || message.contains("Party Members"))) { + return; + } + + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + + Pattern party_start_pattern = Pattern.compile("^Party Members \\((\\d+)\\)$"); + Pattern leader_pattern = Pattern.compile("^Party Leader: (?:\\[.+?] )?(\\w+) ●$"); + Pattern members_pattern = Pattern.compile(" (?:\\[.+?] )?(\\w+) ●"); + + Matcher party_start = party_start_pattern.matcher(message); + Matcher leader = leader_pattern.matcher(message); + Matcher members = members_pattern.matcher(message); + + + if (party_start.matches() && Integer.parseInt(party_start.group(1)) == 1) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "You cannot reparty yourself.")); + } + else if (leader.matches() && !(leader.group(1).equals(player.getName()))) { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "You are not party leader.")); + } + else { + while (members.find()) { + String partyMember = members.group(1); + if (!partyMember.equals(player.getName())) { + partyList.add(partyMember); + } + } + } + + event.setCanceled(true); + } + if (!Utils.inSkyblock) return; // Action Bar @@ -540,7 +578,7 @@ public class DankersSkyblockMod } } } - + if (ToggleCommand.golemAlertToggled) { if (message.contains("The ground begins to shake as an Endstone Protector rises from below!")) { Utils.createTitle(EnumChatFormatting.RED + "GOLEM SPAWNING!", 3); diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java new file mode 100644 index 0000000..3ade5e9 --- /dev/null +++ b/src/main/java/me/Danker/commands/RepartyCommand.java @@ -0,0 +1,78 @@ +package me.Danker.commands; + +import me.Danker.DankersSkyblockMod; +import me.Danker.utils.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.*; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.client.event.*; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.eventhandler.EventPriority; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.*; +import java.text.NumberFormat; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +public class RepartyCommand extends CommandBase implements ICommand { + public static double callTime = 0; + + @Override + public String getCommandName() { return "reparty"; } + + @Override + public String getCommandUsage(ICommandSender sender) { return "/" + getCommandName(); } + + @Override + public int getRequiredPermissionLevel() { return 0; } + + @Override + public void processCommand(ICommandSender sender, String[] args) throws CommandException { + // MULTI THREAD DRIFTING + new Thread(() -> { + final EntityPlayer player_unused = (EntityPlayer) sender; + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + callTime = System.currentTimeMillis() / 1000; + + try { + player.sendChatMessage("/p list"); + Thread.sleep(700); + + List party = DankersSkyblockMod.partyList; + if (party.size() == 0) { + DankersSkyblockMod.partyList.clear(); + return; + } + + player.sendChatMessage("/p disband"); + Thread.sleep(250); + + String members = String.join(DankersSkyblockMod.SECONDARY_COLOUR + "\n- " + EnumChatFormatting.GOLD, party); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n" + + DankersSkyblockMod.MAIN_COLOUR + "Repartying:" + DankersSkyblockMod.SECONDARY_COLOUR + "\n- " + + EnumChatFormatting.GOLD + members + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n")); + Thread.sleep(250); + + for (int i = 0; i < party.size(); i++) { + player.sendChatMessage("/p " + party.get(i)); + Thread.sleep(250); + } + + DankersSkyblockMod.partyList.clear(); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + }).start(); + } +} \ No newline at end of file diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 7bf6ce2..f7ca598 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -411,7 +411,8 @@ public class ConfigHandler { if (!hasKey("colors", "main")) writeStringConfig("colors", "main", EnumChatFormatting.GREEN.toString()); if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); - if (!hasKey("colors", "delimiter")) writeStringConfig("colors", "delimiter", EnumChatFormatting.AQUA.toString()); + if (!hasKey("colors", "delimiter")) writeStringConfig("colors", "delimiter", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.STRIKETHROUGH.toString()); + if (!getString("colors", "delimiter").contains(EnumChatFormatting.STRIKETHROUGH.toString())) writeStringConfig("colors", "delimiter", getString("colors", "delimiter") + EnumChatFormatting.STRIKETHROUGH.toString()); if (!hasKey("colors", "error")) writeStringConfig("colors", "error", EnumChatFormatting.RED.toString()); if (!hasKey("colors", "type")) writeStringConfig("colors", "type", EnumChatFormatting.GREEN.toString()); if (!hasKey("colors", "value")) writeStringConfig("colors", "value", EnumChatFormatting.DARK_GREEN.toString()); -- cgit From 98acb1f3394ae0529acb3325ea8535bad238b4bc Mon Sep 17 00:00:00 2001 From: Kaloyan Draganov Date: Mon, 21 Dec 2020 08:15:26 -0500 Subject: Fix trashy formatting --- src/main/java/me/Danker/commands/RepartyCommand.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/main/java/me') diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java index 3ade5e9..7835d1f 100644 --- a/src/main/java/me/Danker/commands/RepartyCommand.java +++ b/src/main/java/me/Danker/commands/RepartyCommand.java @@ -27,19 +27,24 @@ public class RepartyCommand extends CommandBase implements ICommand { public static double callTime = 0; @Override - public String getCommandName() { return "reparty"; } + public String getCommandName() { + return "reparty"; + } @Override - public String getCommandUsage(ICommandSender sender) { return "/" + getCommandName(); } + public String getCommandUsage(ICommandSender sender) { + return "/" + getCommandName(); + } @Override - public int getRequiredPermissionLevel() { return 0; } + public int getRequiredPermissionLevel() { + return 0; + } @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { // MULTI THREAD DRIFTING new Thread(() -> { - final EntityPlayer player_unused = (EntityPlayer) sender; EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; callTime = System.currentTimeMillis() / 1000; @@ -69,8 +74,7 @@ public class RepartyCommand extends CommandBase implements ICommand { } DankersSkyblockMod.partyList.clear(); - } - catch (InterruptedException e) { + } catch (InterruptedException e) { e.printStackTrace(); } }).start(); -- cgit From 87217e662d02187730e1b5209e21f5e1ac970826 Mon Sep 17 00:00:00 2001 From: Kaloyan Draganov Date: Mon, 21 Dec 2020 08:16:05 -0500 Subject: Update ConfigHandler.java --- src/main/java/me/Danker/handlers/ConfigHandler.java | 1 - 1 file changed, 1 deletion(-) (limited to 'src/main/java/me') diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index f7ca598..93425e5 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -412,7 +412,6 @@ public class ConfigHandler { if (!hasKey("colors", "main")) writeStringConfig("colors", "main", EnumChatFormatting.GREEN.toString()); if (!hasKey("colors", "secondary")) writeStringConfig("colors", "secondary", EnumChatFormatting.DARK_GREEN.toString()); if (!hasKey("colors", "delimiter")) writeStringConfig("colors", "delimiter", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.STRIKETHROUGH.toString()); - if (!getString("colors", "delimiter").contains(EnumChatFormatting.STRIKETHROUGH.toString())) writeStringConfig("colors", "delimiter", getString("colors", "delimiter") + EnumChatFormatting.STRIKETHROUGH.toString()); if (!hasKey("colors", "error")) writeStringConfig("colors", "error", EnumChatFormatting.RED.toString()); if (!hasKey("colors", "type")) writeStringConfig("colors", "type", EnumChatFormatting.GREEN.toString()); if (!hasKey("colors", "value")) writeStringConfig("colors", "value", EnumChatFormatting.DARK_GREEN.toString()); -- cgit From c0748e602681150987c7ec2d81cdb9f1b2b4282a Mon Sep 17 00:00:00 2001 From: Kaloyan Draganov Date: Mon, 21 Dec 2020 08:28:22 -0500 Subject: Change Message Color --- src/main/java/me/Danker/commands/RepartyCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/me') diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java index 7835d1f..fbcea7f 100644 --- a/src/main/java/me/Danker/commands/RepartyCommand.java +++ b/src/main/java/me/Danker/commands/RepartyCommand.java @@ -61,9 +61,9 @@ public class RepartyCommand extends CommandBase implements ICommand { player.sendChatMessage("/p disband"); Thread.sleep(250); - String members = String.join(DankersSkyblockMod.SECONDARY_COLOUR + "\n- " + EnumChatFormatting.GOLD, party); + String members = String.join(EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.GOLD, party); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n" + - DankersSkyblockMod.MAIN_COLOUR + "Repartying:" + DankersSkyblockMod.SECONDARY_COLOUR + "\n- " + + DankersSkyblockMod.MAIN_COLOUR + "Repartying:" + EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.GOLD + members + "\n" + DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n")); Thread.sleep(250); -- cgit From 25dd122d60da623fb79073c7d3f9cabf178b7cc3 Mon Sep 17 00:00:00 2001 From: Kaloyan Draganov Date: Wed, 23 Dec 2020 10:34:43 -0500 Subject: Auto Start/Stop Skill Tracker --- src/main/java/me/Danker/DankersSkyblockMod.java | 47 ++++++--- src/main/java/me/Danker/commands/DHelpCommand.java | 2 +- .../java/me/Danker/commands/DankerGuiCommand.java | 1 + .../me/Danker/commands/SkillTrackerCommand.java | 107 +++++++++++---------- .../java/me/Danker/commands/ToggleCommand.java | 11 ++- src/main/java/me/Danker/gui/DankerGui.java | 11 ++- .../java/me/Danker/handlers/ConfigHandler.java | 2 + 7 files changed, 116 insertions(+), 65 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 8688bee..d239e3e 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -103,6 +103,9 @@ public class DankersSkyblockMod static Entity livid = null; public static double cakeTime; + public static List partyList = new ArrayList<>(); + public static List repartyFailList = new ArrayList<>(); + public static final ResourceLocation CAKE_ICON = new ResourceLocation("dsm", "icons/cake.png"); static String[] riddleSolutions = {"The reward is not in my chest!", "At least one of them is lying, and the reward is not in", @@ -159,6 +162,7 @@ public class DankersSkyblockMod static double alchemyXP = 0; public static double alchemyXPGained = 0; static double xpLeft = 0; + static double timeSinceGained = 0; public static String MAIN_COLOUR; public static String SECONDARY_COLOUR; @@ -186,8 +190,6 @@ public class DankersSkyblockMod public static int PET_80_TO_89; public static int PET_90_TO_99; public static int PET_100; - - public static List partyList = new ArrayList<>(); @EventHandler public void init(FMLInitializationEvent event) { @@ -358,7 +360,7 @@ public class DankersSkyblockMod String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); // Reparty command - if (System.currentTimeMillis() / 1000 - RepartyCommand.callTime <= 1.5) { + if (System.currentTimeMillis() / 1000 - RepartyCommand.callTime <= 3) { if (!(message.contains("----") || message.contains("disbanded") || message.contains("seconds to accept") || message.contains("●") || message.contains("Party Members"))) { return; } @@ -367,7 +369,7 @@ public class DankersSkyblockMod Pattern party_start_pattern = Pattern.compile("^Party Members \\((\\d+)\\)$"); Pattern leader_pattern = Pattern.compile("^Party Leader: (?:\\[.+?] )?(\\w+) ●$"); - Pattern members_pattern = Pattern.compile(" (?:\\[.+?] )?(\\w+) ●"); + Pattern members_pattern = Pattern.compile(" (?:\\[.+?] )?(\\w+) ●"); Matcher party_start = party_start_pattern.matcher(message); Matcher leader = leader_pattern.matcher(message); @@ -396,16 +398,30 @@ public class DankersSkyblockMod // Action Bar if (event.type == 2) { - String[] actionBarSections = event.message.getUnformattedText().split(" {3,}"); - for (String section : actionBarSections) { + EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; + String[] actionBarSections = event.message.getUnformattedText().split(" {3,}"); + + for (String section : actionBarSections) { if (section.contains("+") && section.contains("/") && section.contains("(")) { if (!section.contains("Runecrafting") && !section.contains("Carpentry")) { - int limit = section.contains("Farming") || section.contains("Enchanting") ? 60 : 50; - double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); + if (ToggleCommand.autoSkillTrackerToggled && System.currentTimeMillis() / 1000 - timeSinceGained <= 2) { + if (skillStopwatch.isStarted() && skillStopwatch.isSuspended()) { + skillStopwatch.resume(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); + } else if (!skillStopwatch.isStarted()) { + skillStopwatch.start(); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); + } + } + timeSinceGained = System.currentTimeMillis() / 1000; + + int limit = section.contains("Farming") || section.contains("Enchanting") ? 60 : 50; + double currentXP = Double.parseDouble(section.substring(section.indexOf("(") + 1, section.indexOf("/")).replace(",", "")); int xpToLevelUp = Integer.parseInt(section.substring(section.indexOf("/") + 1, section.indexOf(")")).replaceAll(",", "")); xpLeft = xpToLevelUp - currentXP; int previousXP = Utils.getPastXpEarned(xpToLevelUp, limit); - double totalXP = currentXP + previousXP; + double totalXP = currentXP + previousXP; + String skill = section.substring(section.indexOf(" ") + 1, section.lastIndexOf(" ")); switch (skill) { case "Farming": @@ -2377,7 +2393,7 @@ public class DankersSkyblockMod Utils.checkForSkyblock(); Utils.checkForDungeons(); } - + if (DisplayCommand.auto && world != null && player != null) { List scoreboard = ScoreboardHandler.getSidebarLines(); boolean found = false; @@ -2691,7 +2707,7 @@ public class DankersSkyblockMod correctTicTacToeButton = new AxisAlignedBB(drawX, drawY, drawZ, drawX + 1, drawY + 1, drawZ + 1); } } - } + } tickAmount = 0; } @@ -3250,6 +3266,7 @@ public class DankersSkyblockMod GuiChest chest = (GuiChest) event.gui; IInventory inventory = ((ContainerChest) containerChest).getLowerChestInventory(); String inventoryName = inventory.getDisplayName().getUnformattedText(); + if (ToggleCommand.swapToPickBlockToggled) { if (inventoryName.startsWith("Chronomatron (") || inventoryName.startsWith("Superpairs (") || inventoryName.startsWith("Ultrasequencer (") || inventoryName.startsWith("What starts with:") || inventoryName.startsWith("Select all the") || inventoryName.startsWith("Navigate the maze!") || inventoryName.startsWith("Correct all the panes!") || inventoryName.startsWith("Click in order!") || inventoryName.startsWith("Harp -")) { if (!pickBlockBindSwapped) { @@ -3271,6 +3288,14 @@ public class DankersSkyblockMod pickBlockBindSwapped = false; } } + + if (ToggleCommand.autoSkillTrackerToggled) { + if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) { + skillStopwatch.suspend(); + mc.thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker paused.")); + } + } + clickInOrderSlots = new Slot[36]; lastChronomatronRound = 0; chronomatronPattern.clear(); diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index f16f598..d6ce908 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/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 380086a..d596d65 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -61,6 +61,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[lividsolver][").append(ToggleCommand.lividSolverToggled).append("]\n"); debug.append("[stopsalvagestarred][").append(ToggleCommand.stopSalvageStarredToggled).append("]\n"); debug.append("[notifyslayerslain][").append(ToggleCommand.notifySlayerSlainToggled).append("]\n"); + debug.append("[autoskilltracker][").append(ToggleCommand.autoSkillTrackerToggled).append("]\n"); debug.append("[threemanpuzzle][").append(ToggleCommand.threeManToggled).append("]\n"); debug.append("[oruopuzzle][").append(ToggleCommand.oruoToggled).append("]\n"); debug.append("[blazepuzzle][").append(ToggleCommand.blazeToggled).append("]\n"); diff --git a/src/main/java/me/Danker/commands/SkillTrackerCommand.java b/src/main/java/me/Danker/commands/SkillTrackerCommand.java index 7642070..e341f43 100644 --- a/src/main/java/me/Danker/commands/SkillTrackerCommand.java +++ b/src/main/java/me/Danker/commands/SkillTrackerCommand.java @@ -13,6 +13,7 @@ import org.apache.commons.lang3.time.StopWatch; import java.util.List; public class SkillTrackerCommand extends CommandBase { + public static boolean running = false; @Override public String getCommandName() { @@ -39,55 +40,63 @@ public class SkillTrackerCommand extends CommandBase { @Override public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException { - EntityPlayer player = (EntityPlayer) arg0; - - if (arg1.length < 1) { - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); - return; - } - - switch (arg1[0].toLowerCase()) { - case "start": - case "resume": - if (DankersSkyblockMod.skillStopwatch.isStarted() && DankersSkyblockMod.skillStopwatch.isSuspended()) { - DankersSkyblockMod.skillStopwatch.resume(); - } else if (!DankersSkyblockMod.skillStopwatch.isStarted()) { - DankersSkyblockMod.skillStopwatch.start(); - } - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); - break; - case "pause": - case "stop": - if (DankersSkyblockMod.skillStopwatch.isStarted() && !DankersSkyblockMod.skillStopwatch.isSuspended()) { - DankersSkyblockMod.skillStopwatch.suspend(); - } else { - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker paused.")); - } - break; - case "reset": - DankersSkyblockMod.skillStopwatch = new StopWatch(); - DankersSkyblockMod.farmingXPGained = 0; - DankersSkyblockMod.miningXPGained = 0; - DankersSkyblockMod.combatXPGained = 0; - DankersSkyblockMod.foragingXPGained = 0; - DankersSkyblockMod.fishingXPGained = 0; - DankersSkyblockMod.enchantingXPGained = 0; - DankersSkyblockMod.alchemyXPGained = 0; - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker reset.")); - break; - case "hide": - DankersSkyblockMod.showSkillTracker = false; - ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker hidden.")); - break; - case "show": - DankersSkyblockMod.showSkillTracker = true; - ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker shown.")); - break; - default: + // MULTI THREAD DRIFTING + new Thread(() -> { + EntityPlayer player = (EntityPlayer) arg0; + + if (arg1.length < 1) { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); - } - } + return; + } + + try { + Thread.sleep(200); + switch (arg1[0].toLowerCase()) { + case "start": + case "resume": + if (DankersSkyblockMod.skillStopwatch.isStarted() && DankersSkyblockMod.skillStopwatch.isSuspended()) { + DankersSkyblockMod.skillStopwatch.resume(); + } else if (!DankersSkyblockMod.skillStopwatch.isStarted()) { + DankersSkyblockMod.skillStopwatch.start(); + } + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); + break; + case "pause": + case "stop": + if (DankersSkyblockMod.skillStopwatch.isStarted() && !DankersSkyblockMod.skillStopwatch.isSuspended()) { + DankersSkyblockMod.skillStopwatch.suspend(); + } else { + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker paused.")); + } + break; + case "reset": + DankersSkyblockMod.skillStopwatch = new StopWatch(); + DankersSkyblockMod.farmingXPGained = 0; + DankersSkyblockMod.miningXPGained = 0; + DankersSkyblockMod.combatXPGained = 0; + DankersSkyblockMod.foragingXPGained = 0; + DankersSkyblockMod.fishingXPGained = 0; + DankersSkyblockMod.enchantingXPGained = 0; + DankersSkyblockMod.alchemyXPGained = 0; + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker reset.")); + break; + case "hide": + DankersSkyblockMod.showSkillTracker = false; + ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", false); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker hidden.")); + break; + case "show": + DankersSkyblockMod.showSkillTracker = true; + ConfigHandler.writeBooleanConfig("misc", "showSkillTracker", true); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker shown.")); + break; + default: + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0))); + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + }).start(); + } } diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 15693ef..0054c10 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -41,6 +41,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean swapToPickBlockToggled; public static boolean flowerWeaponsToggled; public static boolean notifySlayerSlainToggled; + public static boolean autoSkillTrackerToggled; // Puzzle Solvers public static boolean threeManToggled; public static boolean oruoToggled; @@ -70,7 +71,7 @@ public class ToggleCommand extends CommandBase implements ICommand { return "/" + getCommandName() + " "; } @@ -88,7 +89,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "flowerweapons", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", "implosionmessages", "healmessages", "caketimer", "lowhealthnotify", - "lividsolver", "stopsalvagestarred", "notifyslayerslain", "threemanpuzzle", "oruopuzzle", "blazepuzzle", + "lividsolver", "stopsalvagestarred", "notifyslayerslain", "autoskilltracker", "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal", "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list"); @@ -237,6 +238,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "NotifySlayerSlain", notifySlayerSlainToggled); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Notify when slayer slain has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + notifySlayerSlainToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "autoskilltracker": + autoSkillTrackerToggled = !autoSkillTrackerToggled; + ConfigHandler.writeBooleanConfig("toggles", "AutoSkillTracker", autoSkillTrackerToggled); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Auto start/stop skill tracker has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + autoSkillTrackerToggled + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "threemanpuzzle": threeManToggled = !threeManToggled; ConfigHandler.writeBooleanConfig("toggles", "ThreeManPuzzle", threeManToggled); @@ -346,6 +352,7 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Outline displayed text: " + DankersSkyblockMod.VALUE_COLOUR + outlineTextToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Cake timer: " + DankersSkyblockMod.VALUE_COLOUR + cakeTimerToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Low health notify: " + DankersSkyblockMod.VALUE_COLOUR + lowHealthNotifyToggled + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Auto start/stop skill tracker: " + DankersSkyblockMod.VALUE_COLOUR + autoSkillTrackerToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Livid solver: " + DankersSkyblockMod.VALUE_COLOUR + lividSolverToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Three man puzzle solver: " + DankersSkyblockMod.VALUE_COLOUR + threeManToggled + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Oruo trivia solver: " + DankersSkyblockMod.VALUE_COLOUR + oruoToggled + "\n" + diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index 69ccbe4..85780bd 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -59,6 +59,7 @@ public class DankerGui extends GuiScreen { private GuiButton flowerWeapons; private GuiButton pickBlock; private GuiButton notifySlayerSlain; + private GuiButton autoSkillTracker; public DankerGui(int page) { this.page = page; @@ -122,7 +123,8 @@ 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)); + autoSkillTracker = new GuiButton(0, width / 2 - 100, (int) (height * 0.6), "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled)); switch (page) { case 1: @@ -173,7 +175,8 @@ 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(autoSkillTracker); this.buttonList.add(backPage); break; } @@ -337,6 +340,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.flowerWeaponsToggled = !ToggleCommand.flowerWeaponsToggled; ConfigHandler.writeBooleanConfig("toggles", "FlowerWeapons", ToggleCommand.flowerWeaponsToggled); flowerWeapons.displayString = "Prevent Placing FoT/Spirit Sceptre: " + Utils.getColouredBoolean(ToggleCommand.flowerWeaponsToggled); + } else if (button == autoSkillTracker) { + ToggleCommand.autoSkillTrackerToggled = !ToggleCommand.autoSkillTrackerToggled; + ConfigHandler.writeBooleanConfig("toggles", "AutoSkillTracker", ToggleCommand.autoSkillTrackerToggled); + autoSkillTracker.displayString = "Auto Start/Stop Skill Tracker: " + Utils.getColouredBoolean(ToggleCommand.autoSkillTrackerToggled); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 93425e5..1ee1414 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -196,6 +196,7 @@ public class ConfigHandler { if (!hasKey("toggles", "PickBlock")) writeBooleanConfig("toggles", "PickBlock", false); if (!hasKey("toggles", "FlowerWeapons")) writeBooleanConfig("toggles", "FlowerWeapons", false); if (!hasKey("toggles", "NotifySlayerSlain")) writeBooleanConfig("toggles", "NotifySlayerSlain", false); + if (!hasKey("toggles", "AutoSkillTracker")) writeBooleanConfig("toggles", "AutoSkillTracker", false); // Puzzle Solvers if (!hasKey("toggles", "ThreeManPuzzle")) writeBooleanConfig("toggles", "ThreeManPuzzle", false); if (!hasKey("toggles", "OruoPuzzle")) writeBooleanConfig("toggles", "OruoPuzzle", false); @@ -464,6 +465,7 @@ public class ConfigHandler { ToggleCommand.notifySlayerSlainToggled = getBoolean("toggles", "NotifySlayerSlain"); ToggleCommand.swapToPickBlockToggled = getBoolean("toggles", "PickBlock"); ToggleCommand.flowerWeaponsToggled = getBoolean("toggles", "FlowerWeapons"); + ToggleCommand.autoSkillTrackerToggled = getBoolean("toggles", "AutoSkillTracker"); // Puzzle Solvers ToggleCommand.threeManToggled = getBoolean("toggles", "ThreeManPuzzle"); ToggleCommand.oruoToggled = getBoolean("toggles", "OruoPuzzle"); -- cgit From 822bccd3221eab32a4bdd5c1e800ba37c262d44f Mon Sep 17 00:00:00 2001 From: flame-cat Date: Wed, 23 Dec 2020 17:13:20 -0500 Subject: Remove Msgs From Auto Skill Tracker Remove the chat messages when the skill tracker automatically starts/stops. If they're using the feature, they'll have the tracker shown anyway --- src/main/java/me/Danker/DankersSkyblockMod.java | 6 +++--- 1 file changed, 3 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 d239e3e..a6cc772 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -381,6 +381,9 @@ public class DankersSkyblockMod } else if (leader.matches() && !(leader.group(1).equals(player.getName()))) { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "You are not party leader.")); + } + else if (message.Contains("Couldn't find a player") || message.Contains("cannot invite that player")) { + } else { while (members.find()) { @@ -407,10 +410,8 @@ public class DankersSkyblockMod if (ToggleCommand.autoSkillTrackerToggled && System.currentTimeMillis() / 1000 - timeSinceGained <= 2) { if (skillStopwatch.isStarted() && skillStopwatch.isSuspended()) { skillStopwatch.resume(); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); } else if (!skillStopwatch.isStarted()) { skillStopwatch.start(); - player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker started.")); } } timeSinceGained = System.currentTimeMillis() / 1000; @@ -3292,7 +3293,6 @@ public class DankersSkyblockMod if (ToggleCommand.autoSkillTrackerToggled) { if (skillStopwatch.isStarted() && !skillStopwatch.isSuspended()) { skillStopwatch.suspend(); - mc.thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker paused.")); } } -- cgit From c23aabd86e5cf33d69afc6368f7a4ad28afaeea0 Mon Sep 17 00:00:00 2001 From: flame-cat Date: Sun, 27 Dec 2020 15:31:13 -0500 Subject: Add Error Message to Reparty --- src/main/java/me/Danker/DankersSkyblockMod.java | 18 ++++------ .../java/me/Danker/commands/RepartyCommand.java | 40 ++++++++++++++-------- 2 files changed, 31 insertions(+), 27 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 a6cc772..ce02128 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -78,7 +78,7 @@ import java.util.regex.Pattern; public class DankersSkyblockMod { public static final String MODID = "Danker's Skyblock Mod"; - public static final String VERSION = "1.8.5-beta5"; + public static final String VERSION = "1.8.5-beta6"; static double checkItemsNow = 0; static double itemsChecked = 0; @@ -103,9 +103,6 @@ public class DankersSkyblockMod static Entity livid = null; public static double cakeTime; - public static List partyList = new ArrayList<>(); - public static List repartyFailList = new ArrayList<>(); - public static final ResourceLocation CAKE_ICON = new ResourceLocation("dsm", "icons/cake.png"); static String[] riddleSolutions = {"The reward is not in my chest!", "At least one of them is lying, and the reward is not in", @@ -360,8 +357,8 @@ public class DankersSkyblockMod String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); // Reparty command - if (System.currentTimeMillis() / 1000 - RepartyCommand.callTime <= 3) { - if (!(message.contains("----") || message.contains("disbanded") || message.contains("seconds to accept") || message.contains("●") || message.contains("Party Members"))) { + if (System.currentTimeMillis() / 1000 - RepartyCommand.callTime <= 5) { + if (!(message.contains("----") || message.contains("disbanded") || message.contains("seconds to accept") || message.contains("●") || message.contains("Party Members") || message.contains("Couldn't find a player") || message.contains("cannot invite that player") || message.length() == 0)) { return; } @@ -370,30 +367,27 @@ public class DankersSkyblockMod Pattern party_start_pattern = Pattern.compile("^Party Members \\((\\d+)\\)$"); Pattern leader_pattern = Pattern.compile("^Party Leader: (?:\\[.+?] )?(\\w+) ●$"); Pattern members_pattern = Pattern.compile(" (?:\\[.+?] )?(\\w+) ●"); - Matcher party_start = party_start_pattern.matcher(message); Matcher leader = leader_pattern.matcher(message); Matcher members = members_pattern.matcher(message); - if (party_start.matches() && Integer.parseInt(party_start.group(1)) == 1) { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "You cannot reparty yourself.")); } else if (leader.matches() && !(leader.group(1).equals(player.getName()))) { player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "You are not party leader.")); } - else if (message.Contains("Couldn't find a player") || message.Contains("cannot invite that player")) { - + else if (message.contains("Couldn't find a player") || message.contains("You cannot invite that player")) { + RepartyCommand.repartyFailList.add(RepartyCommand.currentMember); } else { while (members.find()) { String partyMember = members.group(1); if (!partyMember.equals(player.getName())) { - partyList.add(partyMember); + RepartyCommand.party.add(partyMember); } } } - event.setCanceled(true); } diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java index fbcea7f..6442588 100644 --- a/src/main/java/me/Danker/commands/RepartyCommand.java +++ b/src/main/java/me/Danker/commands/RepartyCommand.java @@ -25,6 +25,10 @@ import java.util.regex.Pattern; public class RepartyCommand extends CommandBase implements ICommand { public static double callTime = 0; + public static boolean inviteFailed = false; + public static String currentMember; + public static List party = new ArrayList<>(); + public static List repartyFailList = new ArrayList<>(); @Override public String getCommandName() { @@ -43,37 +47,43 @@ public class RepartyCommand extends CommandBase implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { + party.clear(); + repartyFailList.clear(); + // MULTI THREAD DRIFTING new Thread(() -> { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - callTime = System.currentTimeMillis() / 1000; + RepartyCommand.callTime = (double) System.currentTimeMillis() / 1000; try { player.sendChatMessage("/p list"); - Thread.sleep(700); - - List party = DankersSkyblockMod.partyList; - if (party.size() == 0) { - DankersSkyblockMod.partyList.clear(); - return; - } + System.out.println("Grabbing the party members..."); + Thread.sleep(550); + if (RepartyCommand.party.size() == 0) return; player.sendChatMessage("/p disband"); - Thread.sleep(250); + Thread.sleep(210); - String members = String.join(EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.GOLD, party); + String members = String.join(EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.GOLD, RepartyCommand.party); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n" + DankersSkyblockMod.MAIN_COLOUR + "Repartying:" + EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.GOLD + members + "\n" + DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n")); - Thread.sleep(250); - for (int i = 0; i < party.size(); i++) { - player.sendChatMessage("/p " + party.get(i)); - Thread.sleep(250); + for (int i = 0; i < RepartyCommand.party.size(); i++) { + RepartyCommand.currentMember = RepartyCommand.party.get(i); + player.sendChatMessage("/p " + RepartyCommand.currentMember); + Thread.sleep(400); } - DankersSkyblockMod.partyList.clear(); + if (RepartyCommand.repartyFailList.size() > 0) { + Thread.sleep(300); + String failedMembers = String.join(EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.GOLD, RepartyCommand.repartyFailList); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n" + + DankersSkyblockMod.ERROR_COLOUR + "Unable to Invite:" + EnumChatFormatting.WHITE + "\n- " + + EnumChatFormatting.GOLD + failedMembers + "\n" + + DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n")); + } } catch (InterruptedException e) { e.printStackTrace(); } -- cgit