aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbowser0000 <bowser0000@gmail.com>2022-04-16 19:05:53 -0400
committerbowser0000 <bowser0000@gmail.com>2022-04-16 19:05:53 -0400
commit1e2036e6ca3b10595ba27691ab4ee0a87d31f052 (patch)
treec6a3c5d0c81c90303b57fa14941ad256e464679c /src
parent33da58bc40a76e7ac8d93a880effdefda0dcd060 (diff)
downloadSkyblockMod-1e2036e6ca3b10595ba27691ab4ee0a87d31f052.tar.gz
SkyblockMod-1e2036e6ca3b10595ba27691ab4ee0a87d31f052.tar.bz2
SkyblockMod-1e2036e6ca3b10595ba27691ab4ee0a87d31f052.zip
Add automatically joining skyblock
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java1
-rw-r--r--src/main/java/me/Danker/commands/ToggleCommand.java1
-rw-r--r--src/main/java/me/Danker/features/AutoJoinSkyblock.java41
-rw-r--r--src/main/java/me/Danker/gui/DankerGui.java7
-rw-r--r--src/main/java/me/Danker/handlers/ConfigHandler.java1
5 files changed, 51 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 39653ca..07ba904 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -106,6 +106,7 @@ public class DankersSkyblockMod {
MinecraftForge.EVENT_BUS.register(new ArrowTerminalSolver());
MinecraftForge.EVENT_BUS.register(new AutoAcceptReparty());
MinecraftForge.EVENT_BUS.register(new AutoDisplay());
+ MinecraftForge.EVENT_BUS.register(new AutoJoinSkyblock());
MinecraftForge.EVENT_BUS.register(new AutoSwapToPickBlock());
MinecraftForge.EVENT_BUS.register(new BlazeSolver());
MinecraftForge.EVENT_BUS.register(new BlockPlacingFlowers());
diff --git a/src/main/java/me/Danker/commands/ToggleCommand.java b/src/main/java/me/Danker/commands/ToggleCommand.java
index 8bce0b3..9c56958 100644
--- a/src/main/java/me/Danker/commands/ToggleCommand.java
+++ b/src/main/java/me/Danker/commands/ToggleCommand.java
@@ -49,6 +49,7 @@ public class ToggleCommand extends CommandBase implements ICommand {
public static boolean alerts;
public static boolean dungeonScore;
public static boolean hideArmour;
+ public static boolean autoJoinSkyblock;
// Chat Messages
public static boolean sceptreMessages;
public static boolean midasStaffMessages;
diff --git a/src/main/java/me/Danker/features/AutoJoinSkyblock.java b/src/main/java/me/Danker/features/AutoJoinSkyblock.java
new file mode 100644
index 0000000..91d6039
--- /dev/null
+++ b/src/main/java/me/Danker/features/AutoJoinSkyblock.java
@@ -0,0 +1,41 @@
+package me.Danker.features;
+
+import me.Danker.commands.ToggleCommand;
+import me.Danker.utils.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.network.FMLNetworkEvent;
+
+public class AutoJoinSkyblock {
+
+ static boolean joinedServer = false;
+
+ @SubscribeEvent
+ public void onConnect(FMLNetworkEvent.ClientConnectedToServerEvent event) {
+ if (ToggleCommand.autoJoinSkyblock && !joinedServer) {
+ joinedServer = true;
+ new Thread(() -> {
+ EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
+
+ try {
+ while (player == null) {
+ Thread.sleep(100);
+ player = Minecraft.getMinecraft().thePlayer;
+ }
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ if (Utils.isOnHypixel()) player.sendChatMessage("/play sb");
+ }).start();
+ }
+ }
+
+ @SubscribeEvent
+ public void onDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
+ joinedServer = false;
+ }
+
+}
diff --git a/src/main/java/me/Danker/gui/DankerGui.java b/src/main/java/me/Danker/gui/DankerGui.java
index fb84b0a..2900489 100644
--- a/src/main/java/me/Danker/gui/DankerGui.java
+++ b/src/main/java/me/Danker/gui/DankerGui.java
@@ -87,6 +87,7 @@ public class DankerGui extends GuiScreen {
private GuiButton bonzoTimer;
private GuiButton dungeonScore;
private GuiButton hideArmour;
+ private GuiButton autoJoinSkyblock;
// Chat Messages
private GuiButton sceptreMessages;
private GuiButton midasStaffMessages;
@@ -178,6 +179,7 @@ public class DankerGui extends GuiScreen {
abilityCooldown = new FeatureButton("Ability Cooldowns: " + Utils.getColouredBoolean(ToggleCommand.abilityCooldowns), "Displays ability cooldowns.");
dungeonScore = new FeatureButton("Dungeon Score Display: " + Utils.getColouredBoolean(ToggleCommand.dungeonScore), "Displays an estimated dungeon score with secrets.");
hideArmour = new FeatureButton("Hide Player Armour: " + Utils.getColouredBoolean(ToggleCommand.hideArmour), "Makes player armour invisible, showing their skin.");
+ autoJoinSkyblock = new FeatureButton("Automatically Join Skyblock: " + Utils.getColouredBoolean(ToggleCommand.autoJoinSkyblock), "Automatically join Skyblock when you join Hypixel.\nYou have an addiction.");
allButtons.clear();
allButtons.add(changeDisplay);
@@ -235,6 +237,7 @@ public class DankerGui extends GuiScreen {
allButtons.add(abilityCooldown);
allButtons.add(dungeonScore);
allButtons.add(hideArmour);
+ allButtons.add(autoJoinSkyblock);
search.setText(initSearchText);
search.setVisible(true);
@@ -518,6 +521,10 @@ public class DankerGui extends GuiScreen {
ToggleCommand.hideArmour = !ToggleCommand.hideArmour;
ConfigHandler.writeBooleanConfig("toggles", "HideArmour", ToggleCommand.hideArmour);
hideArmour.displayString = "Hide Player Armour: " + Utils.getColouredBoolean(ToggleCommand.hideArmour);
+ } else if (button == autoJoinSkyblock) {
+ ToggleCommand.autoJoinSkyblock = !ToggleCommand.autoJoinSkyblock;
+ ConfigHandler.writeBooleanConfig("toggles", "AutoJoinSkyblock", ToggleCommand.autoJoinSkyblock);
+ autoJoinSkyblock.displayString = "Automatically Join Skyblock: " + Utils.getColouredBoolean(ToggleCommand.autoJoinSkyblock);
}
}
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java
index 14386e4..21fa57f 100644
--- a/src/main/java/me/Danker/handlers/ConfigHandler.java
+++ b/src/main/java/me/Danker/handlers/ConfigHandler.java
@@ -242,6 +242,7 @@ public class ConfigHandler {
ToggleCommand.alerts = initBoolean("toggles", "Alerts", false);
ToggleCommand.dungeonScore = initBoolean("toggles", "DungeonScore", false);
ToggleCommand.hideArmour = initBoolean("toggles", "HideArmour", false);
+ ToggleCommand.autoJoinSkyblock = initBoolean("toggles", "AutoJoinSkyblock", false);
// Chat Messages
ToggleCommand.sceptreMessages = initBoolean("toggles", "SceptreMessages", true);
ToggleCommand.midasStaffMessages = initBoolean("toggles", "MidasStaffMessages", true);