aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/SetKeyCommand.kt43
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/IQTest.kt2
2 files changed, 44 insertions, 1 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/SetKeyCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/SetKeyCommand.kt
new file mode 100644
index 00000000..1a0ccbf5
--- /dev/null
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/misc/SetKeyCommand.kt
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2023 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.commands.misc
+
+import com.mojang.brigadier.arguments.StringArgumentType.string
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
+import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
+import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@NEUAutoSubscribe
+class SetKeyCommand {
+ @SubscribeEvent
+ fun onCommands(event: RegisterBrigadierCommandEvent) {
+ event.command("neusetkey") {
+ thenArgument("key", string()) { key ->
+ thenExecute {
+ NotEnoughUpdates.INSTANCE.config.apiData.apiKey = this[key]
+ reply("Set your key to ${this[key]}")
+
+ }
+ }.withHelp("Set your API key found at https://developer.hypixel.net/")
+ }
+ }
+}
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 157050b3..c06335b1 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",
+ "Please type out the answer to §a$question\n§cIf you just want to set your api key do §6/neusetkey <key>",
-1,
javaClass.getField("answer"),
this,