aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/Danker')
-rw-r--r--src/main/java/me/Danker/DankersSkyblockMod.java6
-rw-r--r--src/main/java/me/Danker/utils/Utils.java14
2 files changed, 16 insertions, 4 deletions
diff --git a/src/main/java/me/Danker/DankersSkyblockMod.java b/src/main/java/me/Danker/DankersSkyblockMod.java
index 07aa188..bf1d466 100644
--- a/src/main/java/me/Danker/DankersSkyblockMod.java
+++ b/src/main/java/me/Danker/DankersSkyblockMod.java
@@ -424,6 +424,12 @@ public class DankersSkyblockMod {
public void onChat(ClientChatReceivedEvent event) {
String message = StringUtils.stripControlCodes(event.message.getUnformattedText());
+ if (message.startsWith("Your new API key is ") && Utils.isOnHypixel()) {
+ String apiKey = event.message.getSiblings().get(0).getChatStyle().getChatClickEvent().getValue();
+ ConfigHandler.writeStringConfig("api", "APIKey", apiKey);
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Set API key to " + DankersSkyblockMod.SECONDARY_COLOUR + apiKey));
+ }
+
if (!Utils.inSkyblock) return;
// Action Bar
diff --git a/src/main/java/me/Danker/utils/Utils.java b/src/main/java/me/Danker/utils/Utils.java
index 3f54b7d..abda6a3 100644
--- a/src/main/java/me/Danker/utils/Utils.java
+++ b/src/main/java/me/Danker/utils/Utils.java
@@ -27,9 +27,7 @@ import net.minecraft.util.*;
import org.lwjgl.opengl.GL11;
import java.awt.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
+import java.util.*;
import java.util.List;
import java.util.regex.Matcher;
@@ -122,7 +120,15 @@ public class Utils {
drawHeight += mc.fontRendererObj.FONT_HEIGHT;
}
}
-
+
+ public static boolean isOnHypixel () {
+ Minecraft mc = Minecraft.getMinecraft();
+ if (mc != null && mc.theWorld != null && !mc.isSingleplayer()) {
+ return mc.getCurrentServerData().serverIP.toLowerCase().contains("hypixel");
+ }
+ return false;
+ }
+
public static void checkForSkyblock() {
Minecraft mc = Minecraft.getMinecraft();
if (mc != null && mc.theWorld != null && !mc.isSingleplayer()) {