aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands
diff options
context:
space:
mode:
authorSychic <Sychic@github.com>2021-01-05 22:50:33 -0500
committerSychic <Sychic@github.com>2021-01-05 22:50:33 -0500
commit320dab0e8050e4d771c339c3c836035a0a8df990 (patch)
treeff5464464b7edb37a9acf1b6637d15d5efdcad24 /src/main/java/me/Danker/commands
parent9fa3405d2ac107488634af3fc7302954d90f4b17 (diff)
downloadSkyblockMod-320dab0e8050e4d771c339c3c836035a0a8df990.tar.gz
SkyblockMod-320dab0e8050e4d771c339c3c836035a0a8df990.tar.bz2
SkyblockMod-320dab0e8050e4d771c339c3c836035a0a8df990.zip
Reparty Edits: Change message cancelling and reparty fail handling. (also add a miscellanous logger for debugging)
Diffstat (limited to 'src/main/java/me/Danker/commands')
-rw-r--r--src/main/java/me/Danker/commands/RepartyCommand.java105
1 files changed, 76 insertions, 29 deletions
diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java
index d3bf9e4..92836c5 100644
--- a/src/main/java/me/Danker/commands/RepartyCommand.java
+++ b/src/main/java/me/Danker/commands/RepartyCommand.java
@@ -1,9 +1,9 @@
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.client.gui.GuiNewChat;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommand;
@@ -13,6 +13,7 @@ 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.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -25,10 +26,16 @@ import java.util.regex.Pattern;
public class RepartyCommand extends CommandBase implements ICommand {
public static double callTime = 0;
- public static boolean inviteFailed = false;
+ public static boolean gettingParty = false;
+ public static int Delimiter = 0;
+ public static boolean disbanding = false;
+ public static boolean inviting = false;
+ public static boolean failInviting = false;
public static String currentMember;
public static List<String> party = new ArrayList<>();
public static List<String> repartyFailList = new ArrayList<>();
+ public static List<String> joinList = new ArrayList<>();
+ public static Thread partyThread = null;
@Override
public String getCommandName() {
@@ -52,47 +59,87 @@ public class RepartyCommand extends CommandBase implements ICommand {
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ if (args.length > 0 && (args[0].startsWith("fail") || args[0].equals("f"))) {
+ partyThread = new Thread(() -> {
+ EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
+ RepartyCommand.callTime = (double) System.currentTimeMillis() / 1000;
+ GuiNewChat chat = Minecraft.getMinecraft().ingameGUI.getChatGUI();
+
+
+ try {
+ player.sendChatMessage("/p " + String.join(" ", repartyFailList));
+ String members = String.join(EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.YELLOW, repartyFailList);
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n" +
+ DankersSkyblockMod.MAIN_COLOUR + "Partying:" + EnumChatFormatting.WHITE + "\n- " +
+ EnumChatFormatting.YELLOW + members + "\n" +
+ DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------"));
+ failInviting = true;
+ while (failInviting) {
+ Thread.sleep(10);
+ }
+ if (repartyFailList.size() > 0) {
+ String repartyFails = String.join("\n- " + EnumChatFormatting.RED, repartyFailList);
+ player.addChatMessage(new ChatComponentText(DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------\n" +
+ DankersSkyblockMod.MAIN_COLOUR + "Failed to invite:" + EnumChatFormatting.WHITE + "\n- " +
+ EnumChatFormatting.RED + repartyFails + "\n" +
+ DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------"));
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ });
+
+ partyThread.start();
+
+ return;
+ }
+
+
party.clear();
repartyFailList.clear();
// MULTI THREAD DRIFTING
- new Thread(() -> {
+ partyThread = new Thread(() -> {
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
RepartyCommand.callTime = (double) System.currentTimeMillis() / 1000;
-
+ GuiNewChat chat = Minecraft.getMinecraft().ingameGUI.getChatGUI();
+
+
try {
- Thread.sleep(210);
- player.sendChatMessage("/p list");
- System.out.println("Grabbing the party members...");
- Thread.sleep(550);
- if (RepartyCommand.party.size() == 0) return;
-
+ player.sendChatMessage("/pl");
+ gettingParty = true;
+ while (gettingParty) {
+ Thread.sleep(10);
+ }
+ if (party.size() == 0) return;
player.sendChatMessage("/p disband");
- Thread.sleep(210);
-
- String members = String.join(EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.GOLD, RepartyCommand.party);
+ disbanding = true;
+ while (disbanding) {
+ Thread.sleep(10);
+ }
+ player.sendChatMessage("/p " + String.join(" ", party));
+ String members = String.join(EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.YELLOW, 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"));
-
- for (int i = 0; i < RepartyCommand.party.size(); i++) {
- RepartyCommand.currentMember = RepartyCommand.party.get(i);
- player.sendChatMessage("/p " + RepartyCommand.currentMember);
- Thread.sleep(400);
+ DankersSkyblockMod.MAIN_COLOUR + "Repartying:" + EnumChatFormatting.WHITE + "\n- " +
+ EnumChatFormatting.YELLOW + members + "\n" +
+ DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------"));
+ inviting = true;
+ repartyFailList = new ArrayList<>(party);
+ while (inviting) {
+ Thread.sleep(10);
}
-
- if (RepartyCommand.repartyFailList.size() > 0) {
- Thread.sleep(300);
- String failedMembers = String.join(EnumChatFormatting.WHITE + "\n- " + EnumChatFormatting.GOLD, RepartyCommand.repartyFailList);
+ if (repartyFailList.size() > 0) {
+ String repartyFails = String.join("\n- " + EnumChatFormatting.RED, 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"));
+ DankersSkyblockMod.MAIN_COLOUR + "Failed to invite:" + EnumChatFormatting.WHITE + "\n- " +
+ EnumChatFormatting.RED + repartyFails + "\n" +
+ DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------"));
}
} catch (InterruptedException e) {
e.printStackTrace();
}
- }).start();
+ });
+
+ partyThread.start();
}
} \ No newline at end of file