diff options
author | nea <romangraef@gmail.com> | 2022-08-07 23:51:45 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-08-07 23:51:45 +0200 |
commit | 9713b856f8abdb003824fd3d0ef4bc8a8bfc5b06 (patch) | |
tree | 72f24e1f42e8449c8fb993aca33d752008a13f7b /src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt | |
parent | dc4755eb79ab78f87b0e1e4ad6dac81912af0ee0 (diff) | |
download | Firmament-9713b856f8abdb003824fd3d0ef4bc8a8bfc5b06.tar.gz Firmament-9713b856f8abdb003824fd3d0ef4bc8a8bfc5b06.tar.bz2 Firmament-9713b856f8abdb003824fd3d0ef4bc8a8bfc5b06.zip |
progress bar
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/notenoughupdates/NotEnoughUpdates.kt | 20 |
1 files changed, 10 insertions, 10 deletions
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 { |