From 9713b856f8abdb003824fd3d0ef4bc8a8bfc5b06 Mon Sep 17 00:00:00 2001 From: nea Date: Sun, 7 Aug 2022 23:51:45 +0200 Subject: progress bar --- .../moe/nea/notenoughupdates/NotEnoughUpdates.kt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt') diff --git a/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt b/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt index 86baa8a..bede38a 100644 --- a/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt +++ b/src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt @@ -3,7 +3,6 @@ package moe.nea.notenoughupdates import com.mojang.brigadier.Command import com.mojang.brigadier.CommandDispatcher import io.github.cottonmc.cotton.gui.client.CottonClientScreen -import io.github.moulberry.repo.NEURepositoryException import io.ktor.client.* import io.ktor.client.plugins.* import io.ktor.client.plugins.contentnegotiation.* @@ -67,16 +66,17 @@ object NotEnoughUpdates : ModInitializer, ClientModInitializer { @Suppress("UNUSED_PARAMETER") _ctx: CommandBuildContext ) { - dispatcher.register(ClientCommandManager.literal("neureload").executes { - it.source.sendFeedback(Component.literal("Reloading repository from disk. This may lag a bit.")) - try { + dispatcher.register(ClientCommandManager.literal("neureload") + .then(ClientCommandManager.literal("fetch").executes { + it.source.sendFeedback(Component.literal("Trying to redownload the repository")) // TODO better reporting + RepoManager.launchAsyncUpdate() + Command.SINGLE_SUCCESS + }) + .executes { + it.source.sendFeedback(Component.literal("Reloading repository from disk. This may lag a bit.")) RepoManager.reload() - } catch (exc: NEURepositoryException) { - it.source.sendError(Component.literal("There has been an error reloading the repository. Please try again. IF this persists, delete the .notenoughupdates folder in your mincraft folder")) - exc.printStackTrace() - } - Command.SINGLE_SUCCESS - }) + Command.SINGLE_SUCCESS + }) dispatcher.register( ClientCommandManager.literal("neu") .then(ClientCommandManager.literal("repo").executes { -- cgit