From caf6e89bffcf0b75843f3ec9b036a7f15bc48185 Mon Sep 17 00:00:00 2001 From: Sychic Date: Mon, 11 Jan 2021 21:35:34 -0500 Subject: Messed up ghost party argument, actually sends reparty now --- .../java/me/Danker/commands/RepartyCommand.java | 53 ++++++++++++++++------ 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java index 92836c5..f4cc43d 100644 --- a/src/main/java/me/Danker/commands/RepartyCommand.java +++ b/src/main/java/me/Danker/commands/RepartyCommand.java @@ -8,30 +8,18 @@ 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 { - public static double callTime = 0; 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 party = new ArrayList<>(); public static List repartyFailList = new ArrayList<>(); public static List joinList = new ArrayList<>(); @@ -62,7 +50,6 @@ public class RepartyCommand extends CommandBase implements ICommand { 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(); @@ -94,6 +81,44 @@ 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; + + + 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; + } party.clear(); repartyFailList.clear(); @@ -101,8 +126,6 @@ public class RepartyCommand extends CommandBase implements ICommand { // MULTI THREAD DRIFTING partyThread = new Thread(() -> { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - RepartyCommand.callTime = (double) System.currentTimeMillis() / 1000; - GuiNewChat chat = Minecraft.getMinecraft().ingameGUI.getChatGUI(); try { -- cgit From b9a74f0420d0cdba780fecfe92e1367e4f1cb358 Mon Sep 17 00:00:00 2001 From: Sychic Date: Sun, 10 Jan 2021 18:11:52 -0500 Subject: Ghost party argument. Planning on changing to individual partying later when I can figure the logic out. --- .../java/me/Danker/commands/RepartyCommand.java | 63 +++++++--------------- 1 file 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"); -- cgit From 1d7a5d903a91c87291b5b13d275465e6d00fc13f Mon Sep 17 00:00:00 2001 From: Sychic Date: Sun, 24 Jan 2021 20:47:01 -0500 Subject: Add compatibilty to yield for other reparty commands --- src/main/java/me/Danker/DankersSkyblockMod.java | 62 ++++++++++++---------- .../java/me/Danker/commands/RepartyCommand.java | 34 ++++++------ .../java/me/Danker/handlers/ConfigHandler.java | 3 ++ 3 files changed, 56 insertions(+), 43 deletions(-) diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index 8285bec..019ffe6 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -15,6 +15,7 @@ import net.minecraft.client.gui.*; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.command.ICommand; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.item.EntityItemFrame; @@ -312,36 +313,39 @@ public class DankersSkyblockMod { ClientCommandHandler.instance.registerCommand(new LobbySkillsCommand()); ClientCommandHandler.instance.registerCommand(new DankerGuiCommand()); ClientCommandHandler.instance.registerCommand(new SkillTrackerCommand()); - ClientCommandHandler.instance.registerCommand(new RepartyCommand()); } @EventHandler public void postInit(final FMLPostInitializationEvent event) { Package[] packages = Package.getPackages(); for(Package p : packages){ - DSMLogger.info(p); if(p.getName().startsWith("com.spiderfrog.gadgets") || p.getName().startsWith("com.spiderfrog.oldanimations")){ usingOAM = true; - break; } } System.out.println("OAM detection: " + usingOAM); - usingLabymod = Loader.isModLoaded("labymod"); System.out.println("LabyMod detection: " + usingLabymod); + + if(!ClientCommandHandler.instance.getCommands().containsKey("reparty")) { + ClientCommandHandler.instance.registerCommand(new RepartyCommand()); + } else if (ConfigHandler.getBoolean("commands", "reparty")) { + for(Map.Entry entry : ClientCommandHandler.instance.getCommands().entrySet()) { + if (entry.getKey().equals("reparty") || entry.getKey().equals("rp")) { + entry.setValue(new RepartyCommand()); + } + } + } + } @SubscribeEvent public void onGuiOpenEvent(GuiOpenEvent event){ if(event.gui instanceof GuiMainMenu && usingOAM && !OAMWarning){ - System.out.println("Gui opened: Instance of GuiMainMenu."); if(!(event.gui instanceof WarningGui)){ - System.out.println("No instance of WarningGui"); event.gui = new WarningGuiRedirect(new WarningGui()); OAMWarning = true; - }else{ - System.out.println("Instance of WarningGui"); } } } @@ -500,16 +504,17 @@ public class DankersSkyblockMod { // Inviting if (RepartyCommand.inviting) { if (message.contains("-----")) { - if (RepartyCommand.Delimiter >= RepartyCommand.party.size() * 2 - 1) { - event.setCanceled(true); - RepartyCommand.Delimiter = 0; - System.out.println("Done Inviting!"); - RepartyCommand.inviting = false; - return; - } else { - RepartyCommand.Delimiter++; - event.setCanceled(true); - return; + switch (RepartyCommand.Delimiter) { + case 1: + event.setCanceled(true); + RepartyCommand.Delimiter = 0; + System.out.println("Player Invited!"); + RepartyCommand.inviting = false; + return; + case 0: + RepartyCommand.Delimiter++; + event.setCanceled(true); + return; } } else if (message.endsWith(" to the party! They have 60 seconds to accept.")) { Pattern invitePattern = Pattern.compile("(?:(?:\\[.+?] )?(?:\\w+) invited )(?:\\[.+?] )?(\\w+)"); @@ -527,16 +532,17 @@ public class DankersSkyblockMod { // Fail Inviting if (RepartyCommand.failInviting) { if (message.contains("-----")) { - if (RepartyCommand.Delimiter >= RepartyCommand.repartyFailList.size() * 2 - 1) { - event.setCanceled(true); - RepartyCommand.Delimiter = 0; - System.out.println("Done Inviting!"); - RepartyCommand.inviting = false; - return; - } else { - RepartyCommand.Delimiter++; - event.setCanceled(true); - return; + switch (RepartyCommand.Delimiter) { + case 1: + event.setCanceled(true); + RepartyCommand.Delimiter = 0; + System.out.println("Player Invited!"); + RepartyCommand.inviting = false; + return; + case 0: + RepartyCommand.Delimiter++; + event.setCanceled(true); + return; } } else if (message.endsWith(" to the party! They have 60 seconds to accept.")) { Pattern invitePattern = Pattern.compile("(?:(?:\\[.+?] )?(?:\\w+) invited )(?:\\[.+?] )?(\\w+)"); diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java index fd63f39..d436f90 100644 --- a/src/main/java/me/Danker/commands/RepartyCommand.java +++ b/src/main/java/me/Danker/commands/RepartyCommand.java @@ -32,7 +32,6 @@ public class RepartyCommand extends CommandBase implements ICommand { public static boolean failInviting = false; public static List party = new ArrayList<>(); public static List repartyFailList = new ArrayList<>(); - public static List joinList = new ArrayList<>(); public static Thread partyThread = null; @Override @@ -57,6 +56,9 @@ public class RepartyCommand extends CommandBase implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { + if (args.length > 0 && args[0].startsWith("sbe")) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("ew imagine using sbe which breaks mojang tos")); + } if (args.length > 0 && (args[0].startsWith("fail") || args[0].equals("f"))) { partyThread = new Thread(() -> { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; @@ -91,12 +93,8 @@ public class RepartyCommand extends CommandBase implements ICommand { return; } - boolean ghost = args.length > 0 && (args[0].toLowerCase().equals("g") || args[0].toLowerCase().equals("ghost")); - - if(ghost){ - party.clear(); - repartyFailList.clear(); - } + party.clear(); + repartyFailList.clear(); // MULTI THREAD DRIFTING partyThread = new Thread(() -> { @@ -104,12 +102,10 @@ public class RepartyCommand extends CommandBase implements ICommand { try { - if(ghost){ - player.sendChatMessage("/pl"); - gettingParty = true; - while (gettingParty) { - Thread.sleep(10); - } + player.sendChatMessage("/pl"); + gettingParty = true; + while (gettingParty) { + Thread.sleep(10); } if (party.size() == 0) return; player.sendChatMessage("/p disband"); @@ -117,14 +113,22 @@ public class RepartyCommand extends CommandBase implements ICommand { while (disbanding) { Thread.sleep(10); } - player.sendChatMessage("/p " + String.join(" ", party)); +// 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); + for (String invitee : party) { + player.sendChatMessage("/p " + invitee); + inviting = true; + while (inviting) { + Thread.sleep(10); + } + Thread.sleep(100); + } +// inviting = true; while (inviting) { Thread.sleep(10); } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index 9f11aac..9038218 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -452,6 +452,9 @@ public class ConfigHandler { if (!hasKey("colors", "pet80To89")) writeIntConfig("colors", "pet80To89", 0x5C1F35); // idk weird magenta if (!hasKey("colors", "pet90To99")) writeIntConfig("colors", "pet90To99", 0x9E794E); // Brown if (!hasKey("colors", "pet100")) writeIntConfig("colors", "pet100", 0xF2D249); // Gold + + //Commands + if (!hasKey("commands", "reparty")) writeBooleanConfig("commands", "reparty", false); ToggleCommand.gpartyToggled = getBoolean("toggles", "GParty"); ToggleCommand.coordsToggled = getBoolean("toggles", "Coords"); -- cgit From 658ce92df9f08d0da53e53bf61f059f0b15f222f Mon Sep 17 00:00:00 2001 From: Sychic Date: Sun, 24 Jan 2021 20:53:24 -0500 Subject: cleanup --- src/main/java/me/Danker/commands/RepartyCommand.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/main/java/me/Danker/commands/RepartyCommand.java b/src/main/java/me/Danker/commands/RepartyCommand.java index d436f90..9614daa 100644 --- a/src/main/java/me/Danker/commands/RepartyCommand.java +++ b/src/main/java/me/Danker/commands/RepartyCommand.java @@ -8,20 +8,11 @@ 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 { @@ -56,9 +47,6 @@ public class RepartyCommand extends CommandBase implements ICommand { @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { - if (args.length > 0 && args[0].startsWith("sbe")) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("ew imagine using sbe which breaks mojang tos")); - } if (args.length > 0 && (args[0].startsWith("fail") || args[0].equals("f"))) { partyThread = new Thread(() -> { EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; -- cgit