diff options
author | jani270 <69345714+jani270@users.noreply.github.com> | 2023-08-05 15:18:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-05 15:18:16 +0200 |
commit | 286d07910e7df7dc5bd0d22f8df3f53361a010c8 (patch) | |
tree | f3a3b1b0c6437c8b9c18dfa5354fa3428644d77b | |
parent | 2c33629da66bcef0a9300a737f4493eadb5c1b41 (diff) | |
download | NotEnoughUpdates-286d07910e7df7dc5bd0d22f8df3f53361a010c8.tar.gz NotEnoughUpdates-286d07910e7df7dc5bd0d22f8df3f53361a010c8.tar.bz2 NotEnoughUpdates-286d07910e7df7dc5bd0d22f8df3f53361a010c8.zip |
Starting to remove api key mentions from NEU (#781)
* Starting to remove api key mentions from NEU
* remove api key error popup
* ooops
---------
Co-authored-by: nopo <nopotheemail@gmail.com>
12 files changed, 11 insertions, 104 deletions
@@ -52,8 +52,7 @@ Ever since Moulberry has stopped working on NEU, other contributors have been wo - If you have java installed, double click the file, click `install` - If not, press the windows key + R; type `%appdata%`; click on the folder called `.minecraft`; click on the folder called `mods` and drag the mods file in here. 3. Open the Minecraft launcher and run your forge installation you set up earlier. -4. Then, hop onto Skyblock and run the command `/api new`. Your api key is automatically filled out and all features should work. -5. Type `/neu`. If you see the NotEnoughUpdates menu, you have done this correctly! +4. Type `/neu`. If you see the NotEnoughUpdates menu, you have done this correctly! ## Features 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) -> { diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt index 1cd9ccdf..d4dd0e1e 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.kt @@ -31,20 +31,20 @@ class HelpCommand { val neuHelpMessages = listOf( "§5§lNotEnoughUpdates commands", "§6/neu §7- Opens the main NEU GUI.", - "§6/pv §b?{name} §2ⴵ §r§7- Opens the profile viewer", + "§6/pv §b?{name} §r§7- Opens the profile viewer", "§6/neusouls {on/off/clear/unclear} §r§7- Shows waypoints to fairy souls.", "§6/neubuttons §r§7- Opens a GUI which allows you to customize inventory buttons.", "§6/neuec §r§7- Opens the enchant colour GUI.", "§6/neucosmetics §r§7- Opens the cosmetic GUI.", "§6/neurename §r§7- Opens the NEU Item Customizer.", - "§6/cata §b?{name} §2ⴵ §r§7- Opens the profile viewer's Catacombs page.", + "§6/cata §b?{name} §r§7- Opens the profile viewer's Catacombs page.", "§6/neulinks §r§7- Shows links to NEU/Moulberry.", "§6/neuoverlay §r§7- Opens GUI Editor for quickcommands and searchbar.", "§6/neucalendar §r§7- Opens NEU's custom calendar GUI.", "§6/neucalc §r§7- Run calculations.", "", "§6§lOld commands:", - "§6/peek §b?{user} §2ⴵ §r§7- Shows quick stats for a user.", + "§6/peek §b?{user} §r§7- Shows quick stats for a user.", "", "§6§lDebug commands:", "§6/neustats §r§7- Copies helpful info to the clipboard.", @@ -62,8 +62,6 @@ class HelpCommand { ) val helpInfo = listOf( "", - "§7Commands marked with a §2\"ⴵ\"§7 require an api key. You can set your api key via \"/api new\" or by manually putting it in the api field in \"/neu\"", - "", "§7Arguments marked with a §b\"?\"§7 are optional.", "", "§6§lScroll up to see everything" diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/IQTest.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/IQTest.kt index c06335b1..157050b3 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/IQTest.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/IQTest.kt @@ -66,7 +66,7 @@ object IQTest { val answerOption = ProcessedOption( "IQ Test Question", - "Please type out the answer to §a$question\n§cIf you just want to set your api key do §6/neusetkey <key>", + "Please type out the answer to §a$question", -1, javaClass.getField("answer"), this, |