aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NewApiKeyHelper.java43
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiData.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java25
9 files changed, 6 insertions, 96 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
index 0817a7f9..508db557 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
@@ -216,14 +216,6 @@ public class ChatListener {
SBInfo.getInstance().setCurrentProfile(unformatted
.substring("Your profile was changed to: ".length())
.split(" ")[0].trim());
- } else if (unformatted.startsWith("Your new API key is ")) {
- NotEnoughUpdates.INSTANCE.config.apiData.apiKey =
- unformatted.substring("Your new API key is ".length()).substring(
- 0,
- 36
- );
- Utils.addChatMessage(EnumChatFormatting.YELLOW + "[NEU] API Key automatically configured");
- NotEnoughUpdates.INSTANCE.saveConfig();
} else if (unformatted.startsWith("Player List Info is now disabled!")) {
SBInfo.getInstance().hasNewTab = false;
} else if (unformatted.startsWith("Player List Info is now enabled!")) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
index 00877e63..56074648 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -939,7 +939,7 @@ public class RenderListener {
Utils.playPressSound();
NotEnoughUpdates.profileViewer.loadPlayerByName(username, profile -> {
if (profile == null) {
- Utils.addChatMessage("${RED}Invalid player name/API key. Maybe the API is down? Try /api new.");
+ Utils.addChatMessage("${RED}Invalid player name. Maybe the API is down?");
} else {
profile.resetCache();
ProfileViewerUtils.saveSearch(username);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NewApiKeyHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NewApiKeyHelper.java
deleted file mode 100644
index 6036d93b..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NewApiKeyHelper.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
- *
- * This file is part of NotEnoughUpdates.
- *
- * NotEnoughUpdates is free software: you can redistribute it
- * and/or modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * NotEnoughUpdates is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
- */
-
-package io.github.moulberry.notenoughupdates.miscfeatures;
-
-import net.minecraft.client.Minecraft;
-import net.minecraft.network.play.client.C01PacketChatMessage;
-import net.minecraft.util.ChatComponentText;
-
-public class NewApiKeyHelper {
- private static final NewApiKeyHelper INSTANCE = new NewApiKeyHelper();
-
- public static NewApiKeyHelper getInstance() {
- return INSTANCE;
- }
-
- public void hookPacketChatMessage(C01PacketChatMessage packet) {
- String message = packet.getMessage().toLowerCase();
- if (message.equals("/api new")) return;
-
- if (message.replace(" ", "").startsWith("/apinew")) {
- Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
- "§e[NotEnoughUpdates] §7You just executed §c" + packet.getMessage() +
- "§7. Did you mean to execute §e/api new§7?"));
- }
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java
index 4bb91109..49f357e6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java
@@ -25,7 +25,6 @@ import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers;
import io.github.moulberry.notenoughupdates.miscfeatures.ItemCooldowns;
import io.github.moulberry.notenoughupdates.miscfeatures.MiningStuff;
-import io.github.moulberry.notenoughupdates.miscfeatures.NewApiKeyHelper;
import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.multiplayer.WorldClient;
@@ -128,7 +127,6 @@ public class MixinNetHandlerPlayClient {
StorageManager.getInstance().clientSendWindowClick((C0EPacketClickWindow) packet);
}
if (packet instanceof C01PacketChatMessage) {
- NewApiKeyHelper.getInstance().hookPacketChatMessage((C01PacketChatMessage) packet);
if (AntiCoopAdd.getInstance().onPacketChatMessage((C01PacketChatMessage) packet)) {
ci.cancel();
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiData.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiData.java
index ef871b83..9cf302aa 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiData.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiData.java
@@ -40,7 +40,7 @@ public class ApiData {
@Expose
@ConfigOption(
name = "Api Key",
- desc = "Hypixel API key\nYou can run §a/api new§r to autofill this value.",
+ desc = "Hypixel API key.",
searchTags = "apikey"
)
@ConfigEditorText
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java
index 7e407298..61ca6bb4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java
@@ -33,17 +33,6 @@ import java.util.List;
public class ProfileViewer {
- @ConfigOption(
- name = "Profile Viewer info",
- desc =
- "The Profile Viewer requires you to have an \u00A72api key\u00A77 set (if you don't have one set do \u00A72/api new\u00A77)\n"
- )
- @ConfigEditorFSR(
- runnableId = 12,
- buttonText = ""
- )
- public boolean pvInfo = false;
-
@Expose
@ConfigOption(
name = "Open Profile Viewer",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java
index 520adcb1..a7c2658c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java
@@ -42,8 +42,7 @@ public class SkillOverlays {
@ConfigOption(
name = "Skill Overlay info",
desc =
- "The skill trackers need you to have an \u00A72api key\u00A77 set (if you don't have one set do \u00A72/api new\u00A77)\n" +
- "For the overlays to show you need a \u00A7bmathematical hoe\u00A77 or an axe with \u00A7bcultivating\u00A77 " +
+ "For the overlays to show you need a \u00A7bmathematical hoe\u00A77 or an axe with \u00A7bcultivating\u00A77 " +
"enchant for farming, a pickaxe with \u00A7bcompact\u00A77 for mining or a rod with \u00A7bexpertise\u00A77"
)
@ConfigEditorFSR(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
index 4e3ef022..198abb54 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -431,7 +431,7 @@ public class GuiProfileViewer extends GuiScreen {
Utils.drawStringCentered(str, guiLeft + sizeX / 2f, guiTop + 101, true, 0);
//This is just here to inform the player what to do
- //like typing /api new or telling them to go find a psychotherapist
+ //like telling them to go find a psychotherapist
long timeDiff = System.currentTimeMillis() - startTime;
if (timeDiff > 20000) {
@@ -440,12 +440,12 @@ public class GuiProfileViewer extends GuiScreen {
guiLeft + sizeX / 2f, guiTop + 111, true, 0
);
Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "Try \"/api new\".",
+ EnumChatFormatting.YELLOW + "Might be hypixel's fault.",
guiLeft + sizeX / 2f, guiTop + 121, true, 0
);
if (timeDiff > 60000) {
Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "Might be hypixel's fault.",
+ EnumChatFormatting.YELLOW + "Might be our fault :/.",
guiLeft + sizeX / 2f, guiTop + 131, true, 0
);
if (timeDiff > 180000) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java
index 3b6aed84..e96043fa 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java
@@ -26,7 +26,6 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.events.ProfileDataLoadedEvent;
import io.github.moulberry.notenoughupdates.util.kotlin.KotlinTypeAdapterFactory;
import net.minecraft.client.Minecraft;
-import net.minecraft.util.EnumChatFormatting;
import org.apache.commons.io.IOUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URIBuilder;
@@ -53,7 +52,6 @@ import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.time.Duration;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
@@ -288,29 +286,6 @@ public class ApiUtil {
}
}
} catch (IOException e) {
- if (conn instanceof HttpURLConnection) {
- try {
- int code = ((HttpURLConnection) conn).getResponseCode();
- if (code == 403 && baseUrl != null && baseUrl.startsWith("https://api.hypixel.net/")) {
- if (!notifiedOfInvalidApiKey) {
- NotificationHandler.displayNotification(Arrays.asList(
- EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "API request failed",
- EnumChatFormatting.RED + "A Request failed because your API key is invalid/not present",
- EnumChatFormatting.RED + "Please run " + EnumChatFormatting.BOLD + EnumChatFormatting.GOLD +
- "/api new " +
- EnumChatFormatting.RESET + EnumChatFormatting.RED + "to fix this.",
- EnumChatFormatting.RED +
- "If you don't do this, several API related features, such as the profile viewer, will not work.",
- EnumChatFormatting.GRAY+"Press X on your keyboard to close this notification."
- ), true, false);
- notifiedOfInvalidApiKey = true;
- }
- return "";
- }
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- }
throw new RuntimeException(e); // We can rethrow, since supplyAsync catches exceptions.
}
}, executorService).handle((obj, t) -> {