From 1b24fe5548a52a9416efc91284ffb4256c6c5610 Mon Sep 17 00:00:00 2001 From: Kaloyan Draganov Date: Sun, 20 Dec 2020 22:42:27 -0500 Subject: Reparty Command --- .../java/me/Danker/commands/RepartyCommand.java | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/main/java/me/Danker/commands/RepartyCommand.java (limited to 'src/main/java/me/Danker/commands/RepartyCommand.java') 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 -- 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/Danker/commands/RepartyCommand.java') 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 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/Danker/commands/RepartyCommand.java') 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 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/Danker/commands/RepartyCommand.java') 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 From 8b1fe2934a86a1cb64420cfc197dbc5c4faf8973 Mon Sep 17 00:00:00 2001 From: Kaloyan Draganov Date: Mon, 28 Dec 2020 20:56:43 -0500 Subject: Update to beta 7 & Merge fix --- build.gradle | 2 +- src/main/java/me/Danker/commands/DHelpCommand.java | 4 ++-- src/main/java/me/Danker/commands/RepartyCommand.java | 6 ++++++ src/main/java/me/Danker/commands/ToggleCommand.java | 5 +++-- 4 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/main/java/me/Danker/commands/RepartyCommand.java') diff --git a/build.gradle b/build.gradle index 3056755..1561870 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ plugins { id "net.minecraftforge.gradle.forge" version "2.0.2" } */ -version = "1.8.5-beta6" +version = "1.8.5-beta7" group= "me.Danker.DankersSkyblockMod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "Danker's Skyblock Mod" diff --git a/src/main/java/me/Danker/commands/DHelpCommand.java b/src/main/java/me/Danker/commands/DHelpCommand.java index 47ea76b..dd5395c 100644 --- a/src/main/java/me/Danker/commands/DHelpCommand.java +++ b/src/main/java/me/Danker/commands/DHelpCommand.java @@ -40,8 +40,8 @@ public class DHelpCommand extends CommandBase { 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" + EnumChatFormatting.GOLD + " /display [winter/festival/spooky/f(1-7)/session]" + EnumChatFormatting.AQUA + " - Text display for trackers. /display fishing winter displays winter sea creatures instead. /display auto automatically displays the loot for the slayer quest you have active.\n" + EnumChatFormatting.GOLD + " /resetloot " + EnumChatFormatting.AQUA + " - Resets loot for trackers. /resetloot confirm confirms the reset.\n" + - EnumChatFormatting.GOLD + " /move " + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + - EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + + EnumChatFormatting.GOLD + " /move " + EnumChatFormatting.AQUA + " - Moves text display to specified X and Y coordinates.\n" + + EnumChatFormatting.GOLD + " /scale " + EnumChatFormatting.AQUA + " - Scales text display to a specified multipler between 0.1x and 10x.\n" + EnumChatFormatting.GOLD + " /slayer [player]" + EnumChatFormatting.AQUA + " - Uses API to get slayer xp of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /skills [player]" + EnumChatFormatting.AQUA + " - Uses API to get skill levels of a person. If no name is provided, it checks yours.\n" + EnumChatFormatting.GOLD + " /lobbyskills" + EnumChatFormatting.AQUA + " - Uses API to find the average skills of the lobby, as well the three players with the highest skill average.\n" + diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java index 6442588..d3bf9e4 100644 --- a/src/main/java/me/Danker/commands/RepartyCommand.java +++ b/src/main/java/me/Danker/commands/RepartyCommand.java @@ -40,6 +40,11 @@ public class RepartyCommand extends CommandBase implements ICommand { return "/" + getCommandName(); } + @Override + public List getCommandAliases() { + return Collections.singletonList("rp"); + } + @Override public int getRequiredPermissionLevel() { return 0; @@ -56,6 +61,7 @@ public class RepartyCommand extends CommandBase implements ICommand { RepartyCommand.callTime = (double) System.currentTimeMillis() / 1000; try { + Thread.sleep(210); player.sendChatMessage("/p list"); System.out.println("Grabbing the party members..."); Thread.sleep(550); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 4138d9c..ce507e1 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -91,8 +91,9 @@ public class ToggleCommand extends CommandBase implements ICommand { "splitfishing", "chatmaddox", "spiritbearalerts", "aotd", "lividdagger", "flowerweapons", "sceptremessages", "petcolors", "dungeontimer", "golemalerts", "expertiselore", "skill50display", "outlinetext", "midasstaffmessages", - "implosionmessages", "healmessages", "caketimer", "lowhealthnotify", "autoskilltracker" - "lividsolver", "stopsalvagestarred", "notifyslayerslain", "necronnotifications", "bonzotimer", "blockbreakingfarms", "threemanpuzzle", "oruopuzzle", "blazepuzzle", + "implosionmessages", "healmessages", "caketimer", "lowhealthnotify", "autoskilltracker", + "lividsolver", "stopsalvagestarred", "notifyslayerslain", "necronnotifications", + "bonzotimer", "blockbreakingfarms", "threemanpuzzle", "oruopuzzle", "blazepuzzle", "creeperpuzzle", "waterpuzzle", "tictactoepuzzle", "watchermessage", "startswithterminal", "selectallterminal", "clickinorderterminal", "blockwrongterminalclicks", "itemframeonsealanterns", "ultrasequencer", "chronomatron", "superpairs", "hidetooltipsinaddons", "pickblock", "list"); -- cgit