diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-07-30 02:14:10 -0400 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2021-07-30 02:14:10 -0400 |
commit | d534e7e9da3c3d20825cda831f2814249e212d5a (patch) | |
tree | ec5e26865466531a0f041e17bf109929c910e39a /src/main/java/me/Danker | |
parent | 362ecd929a3b506535e31ad4329be8cec52e0bc6 (diff) | |
download | SkyblockMod-d534e7e9da3c3d20825cda831f2814249e212d5a.tar.gz SkyblockMod-d534e7e9da3c3d20825cda831f2814249e212d5a.tar.bz2 SkyblockMod-d534e7e9da3c3d20825cda831f2814249e212d5a.zip |
Auto accept reparty
Diffstat (limited to 'src/main/java/me/Danker')
6 files changed, 52 insertions, 2 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java index e02f12a..9258892 100644 --- a/src/main/java/me/Danker/DankersSkyblockMod.java +++ b/src/main/java/me/Danker/DankersSkyblockMod.java @@ -101,6 +101,7 @@ public class DankersSkyblockMod { public void init(FMLInitializationEvent event) throws UnsupportedAudioFileException, IOException, LineUnavailableException { MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new ArachneESP()); + MinecraftForge.EVENT_BUS.register(new AutoAcceptReparty()); MinecraftForge.EVENT_BUS.register(new AutoDisplay()); MinecraftForge.EVENT_BUS.register(new AutoSwapToPickBlock()); MinecraftForge.EVENT_BUS.register(new BlazeSolver()); diff --git a/src/main/java/me/Danker/commands/DankerGuiCommand.java b/src/main/java/me/Danker/commands/DankerGuiCommand.java index 7c0bbd6..d6b92eb 100644 --- a/src/main/java/me/Danker/commands/DankerGuiCommand.java +++ b/src/main/java/me/Danker/commands/DankerGuiCommand.java @@ -109,6 +109,7 @@ public class DankerGuiCommand extends CommandBase { debug.append("[gemstonelore][").append(ToggleCommand.gemstoneLore).append("]\n"); debug.append("[crystalhollowwaypoints][").append(ToggleCommand.crystalHollowWaypoints).append("]\n"); debug.append("[crystalautowaypoints][").append(ToggleCommand.crystalAutoWaypoints).append("]\n"); + debug.append("[autoacceptreparty][").append(ToggleCommand.autoAcceptReparty).append("]\n"); debug.append("[dungeonbossmusic][").append(ToggleCommand.dungeonBossMusic).append("]\n"); debug.append("[bloodroommusic][").append(ToggleCommand.bloodRoomMusic).append("]\n"); debug.append("[dungeonmusic][").append(ToggleCommand.dungeonMusic).append("]\n"); diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java index 061a277..c810eff 100644 --- a/src/main/java/me/Danker/commands/ToggleCommand.java +++ b/src/main/java/me/Danker/commands/ToggleCommand.java @@ -43,6 +43,7 @@ public class ToggleCommand extends CommandBase implements ICommand { public static boolean gemstoneLore; public static boolean crystalHollowWaypoints; public static boolean crystalAutoWaypoints; + public static boolean autoAcceptReparty; // Chat Messages public static boolean sceptreMessages; public static boolean midasStaffMessages; @@ -104,7 +105,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "ultrasequencer/chronomatron/superpairs/hidetooltipsinaddons/pickblock/" + "melodytooltips/highlightslayers/highlightarachne/highlightskeletonmasters/teammatesinradius/" + "gianthp/hidepetcandy/customcolorednames/endoffarmalert/gemstonelore/crystalhollowwaypoints/crystalautowaypoints/" + - "dungeonbossmusic/bloodroommusic/dungeonmusic/list>"; + "autoacceptreparty/dungeonbossmusic/bloodroommusic/dungeonmusic/list>"; } public static String usage(ICommandSender arg0) { @@ -134,7 +135,7 @@ public class ToggleCommand extends CommandBase implements ICommand { "hidetooltipsinaddons", "pickblock", "melodytooltips", "highlightslayers", "highlightskeletonmasters", "dungeonbossmusic", "bloodroommusic", "dungeonmusic", "teammatesinradius", "gianthp", "hidepetcandy", "customcolorednames", "endoffarmalert", - "gemstonelore", "crystalhollowwaypoints", "crystalautowaypoints", "list"); + "gemstonelore", "crystalhollowwaypoints", "crystalautowaypoints", "autoacceptreparty", "list"); } return null; } @@ -461,6 +462,11 @@ public class ToggleCommand extends CommandBase implements ICommand { ConfigHandler.writeBooleanConfig("toggles", "CrystalAutoWaypoints", crystalAutoWaypoints); player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Auto Crystal Hollows waypoints has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + crystalAutoWaypoints + DankersSkyblockMod.MAIN_COLOUR + ".")); break; + case "autoacceptreparty": + autoAcceptReparty = !autoAcceptReparty; + ConfigHandler.writeBooleanConfig("toggles", "AutoAcceptReparty", autoAcceptReparty); + player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Auto accept reparty has been set to " + DankersSkyblockMod.SECONDARY_COLOUR + autoAcceptReparty + DankersSkyblockMod.MAIN_COLOUR + ".")); + break; case "dungeonbossmusic": dungeonBossMusic = !dungeonBossMusic; CustomMusic.dungeonboss.stop(); @@ -534,6 +540,7 @@ public class ToggleCommand extends CommandBase implements ICommand { DankersSkyblockMod.TYPE_COLOUR + " Gemstone in lore: " + DankersSkyblockMod.VALUE_COLOUR + gemstoneLore + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Crystal Hollows waypoints: " + DankersSkyblockMod.VALUE_COLOUR + crystalHollowWaypoints + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Auto Crystal Hollows waypoints: " + DankersSkyblockMod.VALUE_COLOUR + crystalAutoWaypoints + "\n" + + DankersSkyblockMod.TYPE_COLOUR + " Auto accept reparty: " + DankersSkyblockMod.VALUE_COLOUR + autoAcceptReparty + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon boss music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonBossMusic + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom blood room music: " + DankersSkyblockMod.VALUE_COLOUR + bloodRoomMusic + "\n" + DankersSkyblockMod.TYPE_COLOUR + " Custom dungeon music: " + DankersSkyblockMod.VALUE_COLOUR + dungeonMusic diff --git a/src/main/java/me/Danker/features/AutoAcceptReparty.java b/src/main/java/me/Danker/features/AutoAcceptReparty.java new file mode 100644 index 0000000..a89b30b --- /dev/null +++ b/src/main/java/me/Danker/features/AutoAcceptReparty.java @@ -0,0 +1,33 @@ +package me.Danker.features; + +import me.Danker.commands.ToggleCommand; +import net.minecraft.client.Minecraft; +import net.minecraft.util.StringUtils; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class AutoAcceptReparty { + + String partyLeader = null; + long lastDisband = 0; + + @SubscribeEvent(receiveCanceled = true) + public void onChat(ClientChatReceivedEvent event) { + String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); + + if (ToggleCommand.autoAcceptReparty) { + String[] split = message.split("\\s"); + + if (message.contains("has disbanded the party!")) { + lastDisband = System.currentTimeMillis() / 1000; + partyLeader = split[0].contains("[") ? split[1] : split[0]; + } else if (message.contains("has invited you to join their party!")) { + String inviter = split[1].contains("[") ? split[2] : split[1]; + if (inviter.equals(partyLeader) && System.currentTimeMillis() / 1000 - lastDisband <= 120) { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/party accept " + partyLeader); + } + } + } + } + +} diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java index bed219a..f2d3bf3 100644 --- a/src/main/java/me/Danker/gui/DankerGui.java +++ b/src/main/java/me/Danker/gui/DankerGui.java @@ -70,6 +70,7 @@ public class DankerGui extends GuiScreen { private GuiButton customColouredNames; private GuiButton endOfFarmAlert; private GuiButton gemstoneLore; + private GuiButton autoAcceptReparty; // Chat Messages private GuiButton sceptreMessages; private GuiButton midasStaffMessages; @@ -161,6 +162,7 @@ public class DankerGui extends GuiScreen { customColouredNames = new FeatureButton("Custom Name Colors: " + Utils.getColouredBoolean(ToggleCommand.customColouredNames), "Replaces some player's usernames with a custom color."); endOfFarmAlert = new FeatureButton("Alert When Reaching End of Farm: " + Utils.getColouredBoolean(ToggleCommand.endOfFarmAlert), "Alerts when you go past coords set with /dsmfarmlength."); gemstoneLore = new FeatureButton("Applied Gemstones in Lore: " + Utils.getColouredBoolean(ToggleCommand.gemstoneLore), "Adds applied gemstones to item tooltip."); + autoAcceptReparty = new FeatureButton("Auto Accept Reparty: " + Utils.getColouredBoolean(ToggleCommand.autoAcceptReparty), "Automatically rejoins parties when disbanded and invited."); allButtons.clear(); allButtons.add(changeDisplay); @@ -210,6 +212,7 @@ public class DankerGui extends GuiScreen { allButtons.add(customColouredNames); allButtons.add(endOfFarmAlert); allButtons.add(gemstoneLore); + allButtons.add(autoAcceptReparty); search.setText(initSearchText); search.setVisible(true); @@ -466,6 +469,10 @@ public class DankerGui extends GuiScreen { ToggleCommand.gemstoneLore = !ToggleCommand.gemstoneLore; ConfigHandler.writeBooleanConfig("toggles", "GemstoneLore", ToggleCommand.gemstoneLore); gemstoneLore.displayString = "Applied Gemstones in Lore: " + Utils.getColouredBoolean(ToggleCommand.gemstoneLore); + } else if (button == autoAcceptReparty) { + ToggleCommand.autoAcceptReparty = !ToggleCommand.autoAcceptReparty; + ConfigHandler.writeBooleanConfig("toggles", "AutoAcceptReparty", ToggleCommand.autoAcceptReparty); + autoAcceptReparty.displayString = "Auto Accept Reparty: " + Utils.getColouredBoolean(ToggleCommand.autoAcceptReparty); } } diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index d5ff5bd..115f01b 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -219,6 +219,7 @@ public class ConfigHandler { ToggleCommand.gemstoneLore = initBoolean("toggles", "GemstoneLore", false); ToggleCommand.crystalHollowWaypoints = initBoolean("toggles", "CrystalHollowWaypoints", false); ToggleCommand.crystalAutoWaypoints = initBoolean("toggles", "CrystalAutoWaypoints", true); + ToggleCommand.autoAcceptReparty = initBoolean("toggles", "AutoAcceptReparty", false); // Chat Messages ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true); ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true); |