aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/RepartyCommand.java
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2020-12-31 21:03:55 -0500
committerGitHub <noreply@github.com>2020-12-31 21:03:55 -0500
commitb65d69d3d9a4548dbec534260453321da83bd0eb (patch)
treefaac32fe45a8ab0323e132977756a9404f998a79 /src/main/java/me/Danker/commands/RepartyCommand.java
parente00e8cc6b29b8c6826459c7d39e40b265640d22d (diff)
parent65ce2e04dbef87146f85979e92fced052652a7b2 (diff)
downloadSkyblockMod-b65d69d3d9a4548dbec534260453321da83bd0eb.tar.gz
SkyblockMod-b65d69d3d9a4548dbec534260453321da83bd0eb.tar.bz2
SkyblockMod-b65d69d3d9a4548dbec534260453321da83bd0eb.zip
Merge pull request #57 from flame-cat/development
Features & Changes: Repartying, Auto Start/Stop Skill Tracker, Moved "Edit Locations" Button
Diffstat (limited to 'src/main/java/me/Danker/commands/RepartyCommand.java')
-rw-r--r--src/main/java/me/Danker/commands/RepartyCommand.java98
1 files changed, 98 insertions, 0 deletions
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..d3bf9e4
--- /dev/null
+++ b/src/main/java/me/Danker/commands/RepartyCommand.java
@@ -0,0 +1,98 @@
+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;
+ 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() {
+ return "reparty";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/" + getCommandName();
+ }
+
+ @Override
+ public List<String> getCommandAliases() {
+ return Collections.singletonList("rp");
+ }
+
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ party.clear();
+ repartyFailList.clear();
+
+ // MULTI THREAD DRIFTING
+ new Thread(() -> {
+ EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
+ RepartyCommand.callTime = (double) System.currentTimeMillis() / 1000;
+
+ 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("/p disband");
+ Thread.sleep(210);
+
+ 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"));
+
+ for (int i = 0; i < RepartyCommand.party.size(); i++) {
+ RepartyCommand.currentMember = RepartyCommand.party.get(i);
+ player.sendChatMessage("/p " + RepartyCommand.currentMember);
+ Thread.sleep(400);
+ }
+
+ 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();
+ }
+ }).start();
+ }
+} \ No newline at end of file