aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker
diff options
context:
space:
mode:
authorSychic <Sychic@github.com>2020-12-19 15:37:39 -0500
committerSychic <Sychic@github.com>2020-12-19 15:37:39 -0500
commit7777fe8a544a347013c4790e16b061eca5b5e0de (patch)
treef98544548019bde3dacd9913d9b1159d88164e35 /src/main/java/me/Danker
parent2ea0943f42c428aa946f5163083a891529657f41 (diff)
downloadSkyblockMod-7777fe8a544a347013c4790e16b061eca5b5e0de.tar.gz
SkyblockMod-7777fe8a544a347013c4790e16b061eca5b5e0de.tar.bz2
SkyblockMod-7777fe8a544a347013c4790e16b061eca5b5e0de.zip
Grab party with a button. Manual command still works, this just grabs from the current party.
Diffstat (limited to 'src/main/java/me/Danker')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java41
-rw-r--r--src/main/java/me/Danker/commands/SetPartyCommand.java20
-rw-r--r--src/main/java/me/Danker/commands/SetkeyCommand.java1
3 files changed, 60 insertions, 2 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 95c5436..e253646 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -97,7 +97,7 @@ public class DankersSkyblockMod
static int tickAmount = 1;
static String lastMaddoxCommand = "/cb placeholder";
static double lastMaddoxTime = 0;
- static KeyBinding[] keyBindings = new KeyBinding[3];
+ static KeyBinding[] keyBindings = new KeyBinding[4];
static boolean usingLabymod = false;
static boolean usingOAM = false;
static boolean OAMWarning = false;
@@ -274,6 +274,7 @@ public class DankersSkyblockMod
keyBindings[0] = new KeyBinding("Open Maddox Menu", Keyboard.KEY_M, "Danker's Skyblock Mod");
keyBindings[1] = new KeyBinding("Start/Stop Skill Tracker", Keyboard.KEY_NUMPAD5, "Danker's Skyblock Mod");
keyBindings[2] = new KeyBinding("Reparty", Keyboard.KEY_P,"Danker's Skyblock Mod");
+ keyBindings[3] = new KeyBinding("Get Party", Keyboard.KEY_O, "Danker's Skyblock Mod");
for (KeyBinding keyBinding : keyBindings) {
ClientRegistry.registerKeyBinding(keyBinding);
@@ -384,6 +385,39 @@ public class DankersSkyblockMod
public void onChat(ClientChatReceivedEvent event) {
String message = StringUtils.stripControlCodes(event.message.getUnformattedText());
+ if(SetPartyCommand.gettingParty){
+ if(message.contains("-----------------------------")){
+ switch(SetPartyCommand.delimiter){
+ case 0:
+ System.out.println("Delimiter Cancelled");
+ SetPartyCommand.delimiter++;
+ event.setCanceled(true);
+ return;
+ case 1:
+ System.out.println("Done Querying Party");
+ SetPartyCommand.gettingParty = false;
+ SetPartyCommand.delimiter = 0;
+ event.setCanceled(true);
+ return;
+ }
+ } else if(message.contains("Party M")){
+ // Looks for number between parentheses
+ Matcher members = (Pattern.compile("^.*?\\([^\\d]*(\\d+)[^\\d]*\\).*$")).matcher(message);
+ if(members.find()){
+ System.out.println("Number of members read: " + members.group(1));
+ event.setCanceled(true);
+ return;
+ }
+ System.out.println("Reading Party");
+ SetPartyCommand.partyResponse += message.substring(message.indexOf(":") + 2);
+ event.setCanceled(true);
+ return;
+ } else if (message.contains("Party Leader")){
+ event.setCanceled(true);
+ return;
+ }
+ }
+
if (!Utils.inSkyblock) return;
// Action Bar
@@ -2995,6 +3029,11 @@ public class DankersSkyblockMod
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
+ //Check for pressing O to read party
+ if(keyBindings[3].isPressed()){
+ SetPartyCommand.getParty();
+ }
+
// Check for pressing P for reparty
if (keyBindings[2].isPressed()) {
if(!SetPartyCommand.set){
diff --git a/src/main/java/me/Danker/commands/SetPartyCommand.java b/src/main/java/me/Danker/commands/SetPartyCommand.java
index f840527..40551d3 100644
--- a/src/main/java/me/Danker/commands/SetPartyCommand.java
+++ b/src/main/java/me/Danker/commands/SetPartyCommand.java
@@ -10,9 +10,14 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
+import java.util.Arrays;
+
public class SetPartyCommand extends CommandBase implements ICommand {
public static boolean set = false;
+ public static int delimiter = 0;
+ public static boolean gettingParty;
+ public static String partyResponse = "";
@Override
public String getCommandName() { return "setparty"; }
@@ -43,4 +48,19 @@ public class SetPartyCommand extends CommandBase implements ICommand {
set = true;
}
+
+ public static void getParty() {
+ gettingParty = true;
+ partyResponse = "";
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/pl");
+ (new Thread(() ->{
+ try{
+ Thread.sleep(500);
+ RepartyCommand.players = Arrays.stream(partyResponse.split(" ")).filter(e -> !e.contains("[") && !e.contains("●")).toArray(String[]::new);
+ set = true;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ })).start();
+ }
}
diff --git a/src/main/java/me/Danker/commands/SetkeyCommand.java b/src/main/java/me/Danker/commands/SetkeyCommand.java
index db5fb9a..ee4b5a5 100644
--- a/src/main/java/me/Danker/commands/SetkeyCommand.java
+++ b/src/main/java/me/Danker/commands/SetkeyCommand.java
@@ -38,5 +38,4 @@ public class SetkeyCommand extends CommandBase implements ICommand {
ConfigHandler.writeStringConfig("api", "APIKey", arg1[0]);
player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Set API key to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[0]));
}
-
}