diff options
author | nea <romangraef@gmail.com> | 2022-08-27 02:37:34 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-08-27 02:37:34 +0200 |
commit | 2019473c50dfe3f1c6fd071d123d49d43bc180c4 (patch) | |
tree | 56ae9b81672582bfab2993f6b4a110c8a98e6682 /src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt | |
parent | 973c13e84f8e091a6a920779103d96559dcd32a8 (diff) | |
download | firmament-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/commands/rome.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt b/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt new file mode 100644 index 0000000..1e59d78 --- /dev/null +++ b/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt @@ -0,0 +1,42 @@ +package moe.nea.notenoughupdates.commands + +import com.mojang.brigadier.CommandDispatcher +import io.github.cottonmc.cotton.gui.client.CottonClientScreen +import moe.nea.notenoughupdates.gui.repoGui +import moe.nea.notenoughupdates.repo.RepoManager +import moe.nea.notenoughupdates.util.ScreenUtil.setScreenLater +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource +import net.minecraft.text.Text + + +fun neuCommand() = literal("neu") { + thenLiteral("reload") { + thenLiteral("fetch") { + thenExecute { + source.sendFeedback(Text.literal("Trying to redownload the repository")) // TODO better reporting + RepoManager.launchAsyncUpdate() + } + } + thenExecute { + source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.disk")) + RepoManager.reload() + } + } + thenLiteral("repo") { + thenExecute { + setScreenLater(CottonClientScreen(repoGui())) + } + } +} + + +fun registerNeuCommand(dispatcher: CommandDispatcher<FabricClientCommandSource>) { + val neu = dispatcher.register(neuCommand()) + dispatcher.register(literal("alsoneu") { + redirect(neu) + }) +} + + + + |