aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-08-27 02:37:34 +0200
committernea <romangraef@gmail.com>2022-08-27 02:37:34 +0200
commit2019473c50dfe3f1c6fd071d123d49d43bc180c4 (patch)
tree56ae9b81672582bfab2993f6b4a110c8a98e6682 /src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt
parent973c13e84f8e091a6a920779103d96559dcd32a8 (diff)
downloadFirmament-2019473c50dfe3f1c6fd071d123d49d43bc180c4.tar.gz
Firmament-2019473c50dfe3f1c6fd071d123d49d43bc180c4.tar.bz2
Firmament-2019473c50dfe3f1c6fd071d123d49d43bc180c4.zip
move commands to its own place
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt')
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt b/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt
index 35671a3..4868fbf 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt
@@ -1,22 +1,18 @@
package moe.nea.notenoughupdates
-import com.mojang.brigadier.Command
import com.mojang.brigadier.CommandDispatcher
-import io.github.cottonmc.cotton.gui.client.CottonClientScreen
import io.ktor.client.*
import io.ktor.client.plugins.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.serialization.kotlinx.json.*
import kotlinx.coroutines.*
import kotlinx.serialization.json.Json
+import moe.nea.notenoughupdates.commands.registerNeuCommand
import moe.nea.notenoughupdates.dbus.NEUDbusObject
-import moe.nea.notenoughupdates.gui.repoGui
import moe.nea.notenoughupdates.repo.RepoManager
import moe.nea.notenoughupdates.util.ConfigHolder
-import moe.nea.notenoughupdates.util.ScreenUtil.setScreenLater
import net.fabricmc.api.ClientModInitializer
import net.fabricmc.api.ModInitializer
-import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents
@@ -24,7 +20,6 @@ import net.fabricmc.loader.api.FabricLoader
import net.fabricmc.loader.api.Version
import net.fabricmc.loader.api.metadata.ModMetadata
import net.minecraft.command.CommandRegistryAccess
-import net.minecraft.text.Text
import org.apache.logging.log4j.LogManager
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder
import java.nio.file.Files
@@ -70,24 +65,7 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer {
@Suppress("UNUSED_PARAMETER")
_ctx: CommandRegistryAccess
) {
- dispatcher.register(ClientCommandManager.literal("neureload")
- .then(ClientCommandManager.literal("fetch").executes {
- it.source.sendFeedback(Text.literal("Trying to redownload the repository")) // TODO better reporting
- RepoManager.launchAsyncUpdate()
- Command.SINGLE_SUCCESS
- })
- .executes {
- it.source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.disk"))
- RepoManager.reload()
- Command.SINGLE_SUCCESS
- })
- dispatcher.register(
- ClientCommandManager.literal("neu")
- .then(ClientCommandManager.literal("repo").executes {
- setScreenLater(CottonClientScreen(repoGui()))
- Command.SINGLE_SUCCESS
- })
- )
+ registerNeuCommand(dispatcher)
}
override fun onInitialize() {