diff options
author | Sychic <Sychic@github.com> | 2021-01-10 18:11:52 -0500 |
---|---|---|
committer | Sychic <Sychic@github.com> | 2021-01-11 21:38:22 -0500 |
commit | b9a74f0420d0cdba780fecfe92e1367e4f1cb358 (patch) | |
tree | 9bd17e5487ca5745fad2ab8807d0d73c2c87c94b /src/main/java/me/Danker | |
parent | caf6e89bffcf0b75843f3ec9b036a7f15bc48185 (diff) | |
download | SkyblockMod-b9a74f0420d0cdba780fecfe92e1367e4f1cb358.tar.gz SkyblockMod-b9a74f0420d0cdba780fecfe92e1367e4f1cb358.tar.bz2 SkyblockMod-b9a74f0420d0cdba780fecfe92e1367e4f1cb358.zip |
Ghost party argument. Planning on changing to individual partying later when I can figure the logic out.
Diffstat (limited to 'src/main/java/me/Danker')
-rw-r--r-- | src/main/java/me/Danker/commands/RepartyCommand.java | 63 |
1 files changed, 20 insertions, 43 deletions
diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java index f4cc43d..fd63f39 100644 --- a/src/main/java/me/Danker/commands/RepartyCommand.java +++ b/src/main/java/me/Danker/commands/RepartyCommand.java @@ -8,10 +8,20 @@ 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.ObfuscationReflectionHelper; +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 { @@ -81,58 +91,25 @@ public class RepartyCommand extends CommandBase implements ICommand { return; } - if (args.length > 0 && (args[0].toLowerCase().equals("g") || args[0].toLowerCase().equals("ghost"))) { - partyThread = new Thread(() -> { - EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - + boolean ghost = args.length > 0 && (args[0].toLowerCase().equals("g") || args[0].toLowerCase().equals("ghost")); - try { - player.sendChatMessage("/p disband"); - 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.YELLOW + members + "\n" + - DankersSkyblockMod.DELIMITER_COLOUR + "-----------------------------")); - inviting = true; - repartyFailList = new ArrayList<>(party); - while (inviting) { - 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; + if(ghost){ + party.clear(); + repartyFailList.clear(); } - party.clear(); - repartyFailList.clear(); - // MULTI THREAD DRIFTING partyThread = new Thread(() -> { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; try { - player.sendChatMessage("/pl"); - gettingParty = true; - while (gettingParty) { - Thread.sleep(10); + if(ghost){ + player.sendChatMessage("/pl"); + gettingParty = true; + while (gettingParty) { + Thread.sleep(10); + } } if (party.size() == 0) return; player.sendChatMessage("/p disband"); |