diff options
Diffstat (limited to 'src/main/java/me/Danker/commands/RepartyCommand.java')
-rw-r--r-- | src/main/java/me/Danker/commands/RepartyCommand.java | 40 |
1 files changed, 25 insertions, 15 deletions
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<String> party = new ArrayList<>(); + public static List<String> 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<String> 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(); } |