aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/commands')
-rw-r--r--src/main/kotlin/commands/Duration.kt1
-rw-r--r--src/main/kotlin/commands/dsl.kt140
-rw-r--r--src/main/kotlin/commands/rome.kt225
3 files changed, 214 insertions, 152 deletions
diff --git a/src/main/kotlin/commands/Duration.kt b/src/main/kotlin/commands/Duration.kt
index 42f143d..58ce5d8 100644
--- a/src/main/kotlin/commands/Duration.kt
+++ b/src/main/kotlin/commands/Duration.kt
@@ -7,7 +7,6 @@ import com.mojang.brigadier.exceptions.DynamicCommandExceptionType
import com.mojang.brigadier.suggestion.Suggestions
import com.mojang.brigadier.suggestion.SuggestionsBuilder
import java.util.concurrent.CompletableFuture
-import java.util.function.Function
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
import kotlin.time.DurationUnit
diff --git a/src/main/kotlin/commands/dsl.kt b/src/main/kotlin/commands/dsl.kt
index d1f0d8c..4f76c69 100644
--- a/src/main/kotlin/commands/dsl.kt
+++ b/src/main/kotlin/commands/dsl.kt
@@ -1,5 +1,3 @@
-
-
package moe.nea.firmament.commands
import com.mojang.brigadier.arguments.ArgumentType
@@ -7,14 +5,14 @@ import com.mojang.brigadier.builder.ArgumentBuilder
import com.mojang.brigadier.builder.RequiredArgumentBuilder
import com.mojang.brigadier.context.CommandContext
import com.mojang.brigadier.suggestion.SuggestionProvider
+import java.lang.reflect.ParameterizedType
+import java.lang.reflect.Type
+import java.lang.reflect.TypeVariable
+import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
import kotlinx.coroutines.launch
import moe.nea.firmament.Firmament
import moe.nea.firmament.util.MinecraftDispatcher
import moe.nea.firmament.util.iterate
-import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
-import java.lang.reflect.ParameterizedType
-import java.lang.reflect.Type
-import java.lang.reflect.TypeVariable
typealias DefaultSource = FabricClientCommandSource
@@ -22,97 +20,95 @@ typealias DefaultSource = FabricClientCommandSource
inline val <T : CommandContext<*>> T.context get() = this
operator fun <T : Any, C : CommandContext<*>> C.get(arg: TypeSafeArg<T>): T {
- return arg.get(this)
+ return arg.get(this)
}
fun literal(
- name: String,
- block: CaseInsensitiveLiteralCommandNode.Builder<DefaultSource>.() -> Unit
+ name: String,
+ block: CaseInsensitiveLiteralCommandNode.Builder<DefaultSource>.() -> Unit
): CaseInsensitiveLiteralCommandNode.Builder<DefaultSource> =
- CaseInsensitiveLiteralCommandNode.Builder<DefaultSource>(name).also(block)
+ CaseInsensitiveLiteralCommandNode.Builder<DefaultSource>(name).also(block)
private fun normalizeGeneric(argument: Type): Class<*> {
- return when (argument) {
- is Class<*> -> argument
- is TypeVariable<*> -> normalizeGeneric(argument.bounds[0])
- is ParameterizedType -> normalizeGeneric(argument.rawType)
- else -> Any::class.java
- }
+ return when (argument) {
+ is Class<*> -> argument
+ is TypeVariable<*> -> normalizeGeneric(argument.bounds[0])
+ is ParameterizedType -> normalizeGeneric(argument.rawType)
+ else -> Any::class.java
+ }
}
data class TypeSafeArg<T : Any>(val name: String, val argument: ArgumentType<T>) {
- val argClass by lazy {
- argument.javaClass
- .iterate<Class<in ArgumentType<T>>> {
- it.superclass
- }
- .flatMap {
- it.genericInterfaces.toList()
- }
- .filterIsInstance<ParameterizedType>()
- .find { it.rawType == ArgumentType::class.java }!!
- .let { normalizeGeneric(it.actualTypeArguments[0]) }
- }
-
- @JvmName("getWithThis")
- fun <S> CommandContext<S>.get(): T =
- get(this)
-
-
- fun <S> get(ctx: CommandContext<S>): T {
- try {
- return ctx.getArgument(name, argClass) as T
- } catch (e: Exception) {
- if (ctx.child != null) {
- return get(ctx.child)
- }
- throw e
- }
- }
+ val argClass by lazy {
+ argument.javaClass
+ .iterate<Class<in ArgumentType<T>>> {
+ it.superclass
+ }
+ .flatMap {
+ it.genericInterfaces.toList()
+ }
+ .filterIsInstance<ParameterizedType>()
+ .find { it.rawType == ArgumentType::class.java }!!
+ .let { normalizeGeneric(it.actualTypeArguments[0]) }
+ }
+
+ @JvmName("getWithThis")
+ fun <S> CommandContext<S>.get(): T =
+ get(this)
+
+
+ fun <S> get(ctx: CommandContext<S>): T {
+ try {
+ return ctx.getArgument(name, argClass) as T
+ } catch (e: Exception) {
+ if (ctx.child != null) {
+ return get(ctx.child)
+ }
+ throw e
+ }
+ }
}
fun <T : Any> argument(
- name: String,
- argument: ArgumentType<T>,
- block: RequiredArgumentBuilder<DefaultSource, T>.(TypeSafeArg<T>) -> Unit
+ name: String,
+ argument: ArgumentType<T>,
+ block: RequiredArgumentBuilder<DefaultSource, T>.(TypeSafeArg<T>) -> Unit
): RequiredArgumentBuilder<DefaultSource, T> =
- RequiredArgumentBuilder.argument<DefaultSource, T>(name, argument).also { block(it, TypeSafeArg(name, argument)) }
+ RequiredArgumentBuilder.argument<DefaultSource, T>(name, argument).also { block(it, TypeSafeArg(name, argument)) }
fun <T : ArgumentBuilder<DefaultSource, T>, AT : Any> T.thenArgument(
- name: String,
- argument: ArgumentType<AT>,
- block: RequiredArgumentBuilder<DefaultSource, AT>.(TypeSafeArg<AT>) -> Unit
+ name: String,
+ argument: ArgumentType<AT>,
+ block: RequiredArgumentBuilder<DefaultSource, AT>.(TypeSafeArg<AT>) -> Unit
): T = then(argument(name, argument, block))
fun <T : RequiredArgumentBuilder<DefaultSource, String>> T.suggestsList(provider: CommandContext<DefaultSource>.() -> Iterable<String>) {
- suggests(SuggestionProvider<DefaultSource> { context, builder ->
- provider(context)
- .asSequence()
- .filter { it.startsWith(builder.remaining, ignoreCase = true) }
- .forEach {
- builder.suggest(it)
- }
- builder.buildFuture()
- })
+ suggests(SuggestionProvider<DefaultSource> { context, builder ->
+ provider(context)
+ .asSequence()
+ .filter { it.startsWith(builder.remaining, ignoreCase = true) }
+ .forEach {
+ builder.suggest(it)
+ }
+ builder.buildFuture()
+ })
}
fun <T : ArgumentBuilder<DefaultSource, T>> T.thenLiteral(
- name: String,
- block: CaseInsensitiveLiteralCommandNode.Builder<DefaultSource>.() -> Unit
+ name: String,
+ block: CaseInsensitiveLiteralCommandNode.Builder<DefaultSource>.() -> Unit
): T =
- then(literal(name, block))
+ then(literal(name, block))
fun <T : ArgumentBuilder<DefaultSource, T>> T.then(node: ArgumentBuilder<DefaultSource, *>, block: T.() -> Unit): T =
- then(node).also(block)
-
-fun <T : ArgumentBuilder<DefaultSource, T>> T.thenExecute(block: suspend CommandContext<DefaultSource>.() -> Unit): T =
- executes {
- Firmament.coroutineScope.launch(MinecraftDispatcher) {
- block(it)
- }
- 1
- }
+ then(node).also(block)
+
+fun <T : ArgumentBuilder<DefaultSource, T>> T.thenExecute(block: CommandContext<DefaultSource>.() -> Unit): T =
+ executes {
+ block(it)
+ 1
+ }
diff --git a/src/main/kotlin/commands/rome.kt b/src/main/kotlin/commands/rome.kt
index c3eb03d..727e039 100644
--- a/src/main/kotlin/commands/rome.kt
+++ b/src/main/kotlin/commands/rome.kt
@@ -3,15 +3,19 @@ package moe.nea.firmament.commands
import com.mojang.brigadier.CommandDispatcher
import com.mojang.brigadier.arguments.IntegerArgumentType
import com.mojang.brigadier.arguments.StringArgumentType.string
-import io.ktor.client.statement.bodyAsText
+import java.net.http.HttpResponse
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
+import kotlinx.coroutines.launch
+import net.minecraft.commands.CommandBuildContext
import net.minecraft.nbt.NbtOps
-import net.minecraft.text.Text
-import net.minecraft.text.TextCodecs
+import net.minecraft.network.chat.Component
+import net.minecraft.network.chat.ComponentSerialization
+import moe.nea.firmament.Firmament
import moe.nea.firmament.apis.UrsaManager
import moe.nea.firmament.events.CommandEvent
import moe.nea.firmament.events.FirmamentEventBus
import moe.nea.firmament.features.debug.DebugLogger
+import moe.nea.firmament.features.debug.DeveloperFeatures
import moe.nea.firmament.features.debug.PowerUserTools
import moe.nea.firmament.features.inventory.buttons.InventoryButtons
import moe.nea.firmament.features.inventory.storageoverlay.StorageOverlayScreen
@@ -19,7 +23,6 @@ import moe.nea.firmament.features.inventory.storageoverlay.StorageOverviewScreen
import moe.nea.firmament.features.mining.MiningBlockInfoUi
import moe.nea.firmament.gui.config.AllConfigsGui
import moe.nea.firmament.gui.config.BooleanHandler
-import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.gui.config.ManagedOption
import moe.nea.firmament.init.MixinPlugin
import moe.nea.firmament.repo.HypixelStaticData
@@ -34,14 +37,16 @@ import moe.nea.firmament.util.SBData
import moe.nea.firmament.util.ScreenUtil
import moe.nea.firmament.util.SkyblockId
import moe.nea.firmament.util.accessors.messages
+import moe.nea.firmament.util.asBazaarStock
import moe.nea.firmament.util.collections.InstanceList
import moe.nea.firmament.util.collections.WeakCache
+import moe.nea.firmament.util.data.ManagedConfig
import moe.nea.firmament.util.mc.SNbtFormatter
import moe.nea.firmament.util.tr
import moe.nea.firmament.util.unformattedString
-fun firmamentCommand() = literal("firmament") {
+fun firmamentCommand(ctx: CommandBuildContext) = literal("firmament") {
thenLiteral("config") {
thenExecute {
AllConfigsGui.showAllGuis()
@@ -66,7 +71,7 @@ fun firmamentCommand() = literal("firmament") {
val configObj = ManagedConfig.allManagedConfigs.getAll().find { it.name == config }
if (configObj == null) {
source.sendFeedback(
- Text.stringifiedTranslatable(
+ Component.translatableEscape(
"firmament.command.toggle.no-config-found",
config
)
@@ -76,24 +81,24 @@ fun firmamentCommand() = literal("firmament") {
val propertyObj = configObj.allOptions[property]
if (propertyObj == null) {
source.sendFeedback(
- Text.stringifiedTranslatable("firmament.command.toggle.no-property-found", property)
+ Component.translatableEscape("firmament.command.toggle.no-property-found", property)
)
return@thenExecute
}
if (propertyObj.handler !is BooleanHandler) {
source.sendFeedback(
- Text.stringifiedTranslatable("firmament.command.toggle.not-a-toggle", property)
+ Component.translatableEscape("firmament.command.toggle.not-a-toggle", property)
)
return@thenExecute
}
propertyObj as ManagedOption<Boolean>
propertyObj.value = !propertyObj.value
- configObj.save()
+ configObj.markDirty()
source.sendFeedback(
- Text.stringifiedTranslatable(
+ Component.translatableEscape(
"firmament.command.toggle.toggled", configObj.labelText,
propertyObj.labelText,
- Text.translatable("firmament.toggle.${propertyObj.value}")
+ Component.translatable("firmament.toggle.${propertyObj.value}")
)
)
}
@@ -121,13 +126,13 @@ fun firmamentCommand() = literal("firmament") {
thenLiteral("storageoverview") {
thenExecute {
ScreenUtil.setScreenLater(StorageOverviewScreen())
- MC.player?.networkHandler?.sendChatCommand("storage")
+ MC.player?.connection?.sendCommand("storage")
}
}
thenLiteral("storage") {
thenExecute {
ScreenUtil.setScreenLater(StorageOverlayScreen())
- MC.player?.networkHandler?.sendChatCommand("storage")
+ MC.player?.connection?.sendCommand("storage")
}
}
thenLiteral("repo") {
@@ -143,13 +148,13 @@ fun firmamentCommand() = literal("firmament") {
thenLiteral("reload") {
thenLiteral("fetch") {
thenExecute {
- source.sendFeedback(Text.translatable("firmament.repo.reload.network")) // TODO better reporting
+ source.sendFeedback(Component.translatable("firmament.repo.reload.network")) // TODO better reporting
RepoManager.launchAsyncUpdate()
}
}
thenExecute {
- source.sendFeedback(Text.translatable("firmament.repo.reload.disk"))
- RepoManager.reload()
+ source.sendFeedback(Component.translatable("firmament.repo.reload.disk"))
+ Firmament.coroutineScope.launch { RepoManager.reload() }
}
}
}
@@ -158,33 +163,33 @@ fun firmamentCommand() = literal("firmament") {
suggestsList { RepoManager.neuRepo.items.items.keys }
thenExecute {
val itemName = SkyblockId(get(item))
- source.sendFeedback(Text.stringifiedTranslatable("firmament.price", itemName.neuItem))
- val bazaarData = HypixelStaticData.bazaarData[itemName]
+ source.sendFeedback(Component.translatableEscape("firmament.price", itemName.neuItem))
+ val bazaarData = HypixelStaticData.bazaarData[itemName.asBazaarStock]
if (bazaarData != null) {
- source.sendFeedback(Text.translatable("firmament.price.bazaar"))
+ source.sendFeedback(Component.translatable("firmament.price.bazaar"))
source.sendFeedback(
- Text.stringifiedTranslatable("firmament.price.bazaar.productid", bazaarData.productId.bazaarId)
+ Component.translatableEscape("firmament.price.bazaar.productid", bazaarData.productId.bazaarId)
)
source.sendFeedback(
- Text.stringifiedTranslatable(
+ Component.translatableEscape(
"firmament.price.bazaar.buy.price",
FirmFormatters.formatCommas(bazaarData.quickStatus.buyPrice, 1)
)
)
source.sendFeedback(
- Text.stringifiedTranslatable(
+ Component.translatableEscape(
"firmament.price.bazaar.buy.order",
bazaarData.quickStatus.buyOrders
)
)
source.sendFeedback(
- Text.stringifiedTranslatable(
+ Component.translatableEscape(
"firmament.price.bazaar.sell.price",
FirmFormatters.formatCommas(bazaarData.quickStatus.sellPrice, 1)
)
)
source.sendFeedback(
- Text.stringifiedTranslatable(
+ Component.translatableEscape(
"firmament.price.bazaar.sell.order",
bazaarData.quickStatus.sellOrders
)
@@ -193,7 +198,7 @@ fun firmamentCommand() = literal("firmament") {
val lowestBin = HypixelStaticData.lowestBin[itemName]
if (lowestBin != null) {
source.sendFeedback(
- Text.stringifiedTranslatable(
+ Component.translatableEscape(
"firmament.price.lowestbin",
FirmFormatters.formatCommas(lowestBin, 1)
)
@@ -202,11 +207,11 @@ fun firmamentCommand() = literal("firmament") {
}
}
}
- thenLiteral("dev") {
+ thenLiteral(DeveloperFeatures.DEVELOPER_SUBCOMMAND) {
thenLiteral("simulate") {
thenArgument("message", RestArgumentType) { message ->
thenExecute {
- MC.instance.messageHandler.onGameMessage(Text.literal(get(message)), false)
+ MC.instance.chatListener.handleSystemMessage(Component.literal(get(message)), false)
}
}
}
@@ -219,15 +224,28 @@ fun firmamentCommand() = literal("firmament") {
val enabled = DebugLogger.EnabledLogs.data
if (tagText in enabled) {
enabled.remove(tagText)
- source.sendFeedback(Text.literal("Disabled $tagText debug logging"))
+ source.sendFeedback(Component.literal("Disabled $tagText debug logging"))
} else {
enabled.add(tagText)
- source.sendFeedback(Text.literal("Enabled $tagText debug logging"))
+ source.sendFeedback(Component.literal("Enabled $tagText debug logging"))
}
}
}
}
}
+ thenLiteral("screens") {
+ thenExecute {
+ MC.sendChat(
+ Component.literal(
+ """
+ |Screen: ${MC.screen} (${MC.screen?.title})
+ |Screen Handler: ${MC.handledScreen?.menu} ${MC.handledScreen?.menu?.containerId}
+ |Player Screen Handler: ${MC.player?.containerMenu} ${MC.player?.containerMenu?.containerId}
+ """.trimMargin()
+ )
+ )
+ }
+ }
thenLiteral("blocks") {
thenExecute {
ScreenUtil.setScreenLater(MiningBlockInfoUi.makeScreen())
@@ -235,17 +253,17 @@ fun firmamentCommand() = literal("firmament") {
}
thenLiteral("dumpchat") {
thenExecute {
- MC.inGameHud.chatHud.messages.forEach {
- val nbt = TextCodecs.CODEC.encodeStart(NbtOps.INSTANCE, it.content).orThrow
+ MC.inGameHud.chat.messages.forEach {
+ val nbt = ComponentSerialization.CODEC.encodeStart(NbtOps.INSTANCE, it.content).orThrow
println(nbt)
}
}
thenArgument("search", string()) { search ->
thenExecute {
- MC.inGameHud.chatHud.messages
+ MC.inGameHud.chat.messages
.filter { this[search] in it.content.unformattedString }
.forEach {
- val nbt = TextCodecs.CODEC.encodeStart(NbtOps.INSTANCE, it.content).orThrow
+ val nbt = ComponentSerialization.CODEC.encodeStart(NbtOps.INSTANCE, it.content).orThrow
println(SNbtFormatter.prettify(nbt))
}
}
@@ -253,23 +271,28 @@ fun firmamentCommand() = literal("firmament") {
}
thenLiteral("sbdata") {
thenExecute {
- source.sendFeedback(Text.stringifiedTranslatable("firmament.sbinfo.profile", SBData.profileId))
+ source.sendFeedback(Component.translatableEscape("firmament.sbinfo.profile", SBData.profileId))
val locrawInfo = SBData.locraw
if (locrawInfo == null) {
- source.sendFeedback(Text.translatable("firmament.sbinfo.nolocraw"))
+ source.sendFeedback(Component.translatable("firmament.sbinfo.nolocraw"))
} else {
- source.sendFeedback(Text.stringifiedTranslatable("firmament.sbinfo.server", locrawInfo.server))
- source.sendFeedback(Text.stringifiedTranslatable("firmament.sbinfo.gametype", locrawInfo.gametype))
- source.sendFeedback(Text.stringifiedTranslatable("firmament.sbinfo.mode", locrawInfo.mode))
- source.sendFeedback(Text.stringifiedTranslatable("firmament.sbinfo.map", locrawInfo.map))
- source.sendFeedback(tr("firmament.sbinfo.custommining", "Custom Mining: ${formatBool(locrawInfo.skyblockLocation?.hasCustomMining ?: false)}"))
+ source.sendFeedback(Component.translatableEscape("firmament.sbinfo.server", locrawInfo.server))
+ source.sendFeedback(Component.translatableEscape("firmament.sbinfo.gametype", locrawInfo.gametype))
+ source.sendFeedback(Component.translatableEscape("firmament.sbinfo.mode", locrawInfo.mode))
+ source.sendFeedback(Component.translatableEscape("firmament.sbinfo.map", locrawInfo.map))
+ source.sendFeedback(
+ tr(
+ "firmament.sbinfo.custommining",
+ "Custom Mining: ${formatBool(locrawInfo.skyblockLocation?.hasCustomMining ?: false)}"
+ )
+ )
}
}
}
thenLiteral("copyEntities") {
thenExecute {
val player = MC.player ?: return@thenExecute
- player.world.getOtherEntities(player, player.boundingBox.expand(12.0))
+ player.level.getEntities(player, player.boundingBox.inflate(12.0))
.forEach(PowerUserTools::showEntity)
PowerUserTools.showEntity(player)
}
@@ -277,9 +300,11 @@ fun firmamentCommand() = literal("firmament") {
thenLiteral("callUrsa") {
thenArgument("path", string()) { path ->
thenExecute {
- source.sendFeedback(Text.translatable("firmament.ursa.debugrequest.start"))
- val text = UrsaManager.request(this[path].split("/")).bodyAsText()
- source.sendFeedback(Text.stringifiedTranslatable("firmament.ursa.debugrequest.result", text))
+ Firmament.coroutineScope.launch {
+ source.sendFeedback(Component.translatable("firmament.ursa.debugrequest.start"))
+ val text = UrsaManager.request(get(path).split("/"), HttpResponse.BodyHandlers.ofString())
+ source.sendFeedback(Component.translatableEscape("firmament.ursa.debugrequest.result", text))
+ }
}
}
}
@@ -288,70 +313,112 @@ fun firmamentCommand() = literal("firmament") {
source.sendFeedback(tr("firmament.event.start", "Event Bus Readout:"))
FirmamentEventBus.allEventBuses.forEach { eventBus ->
val prefixName = eventBus.eventType.typeName.removePrefix("moe.nea.firmament")
- source.sendFeedback(tr(
- "firmament.event.bustype",
- "- $prefixName:"))
+ source.sendFeedback(
+ tr(
+ "firmament.event.bustype",
+ "- $prefixName:"
+ )
+ )
eventBus.handlers.forEach { handler ->
- source.sendFeedback(tr(
- "firmament.event.handler",
- " * ${handler.label}"))
+ source.sendFeedback(
+ tr(
+ "firmament.event.handler",
+ " * ${handler.label}"
+ )
+ )
}
}
}
}
thenLiteral("caches") {
thenExecute {
- source.sendFeedback(Text.literal("Caches:"))
+ source.sendFeedback(Component.literal("Caches:"))
WeakCache.allInstances.getAll().forEach {
- source.sendFeedback(Text.literal(" - ${it.name}: ${it.size}"))
+ source.sendFeedback(Component.literal(" - ${it.name}: ${it.size}"))
}
- source.sendFeedback(Text.translatable("Instance lists:"))
+ source.sendFeedback(Component.translatable("Instance lists:"))
InstanceList.allInstances.getAll().forEach {
- source.sendFeedback(Text.literal(" - ${it.name}: ${it.size}"))
+ source.sendFeedback(Component.literal(" - ${it.name}: ${it.size}"))
}
}
}
thenLiteral("mixins") {
thenExecute {
- source.sendFeedback(Text.translatable("firmament.mixins.start"))
- MixinPlugin.appliedMixins
- .map { it.removePrefix(MixinPlugin.mixinPackage) }
- .forEach {
- source.sendFeedback(Text.literal(" - ").withColor(0xD020F0)
- .append(Text.literal(it).withColor(0xF6BA20)))
- }
+ MixinPlugin.instances.forEach { plugin ->
+ source.sendFeedback(tr("firmament.mixins.start.package", "Mixins (base ${plugin.mixinPackage}):"))
+ plugin.appliedMixins
+ .map { it.removePrefix(plugin.mixinPackage) }
+ .forEach {
+ source.sendFeedback(
+ Component.literal(" - ").withColor(0xD020F0)
+ .append(Component.literal(it).withColor(0xF6BA20))
+ )
+ }
+ }
}
}
thenLiteral("repo") {
thenExecute {
source.sendFeedback(tr("firmament.repo.info.ref", "Repo Upstream: ${RepoManager.getRepoRef()}"))
- source.sendFeedback(tr("firmament.repo.info.downloadedref",
- "Downloaded ref: ${RepoDownloadManager.latestSavedVersionHash}"))
- source.sendFeedback(tr("firmament.repo.info.location",
- "Saved location: ${debugPath(RepoDownloadManager.repoSavedLocation)}"))
- source.sendFeedback(tr("firmament.repo.info.reloadstatus",
- "Incomplete: ${
- formatBool(RepoManager.neuRepo.isIncomplete,
- trueIsGood = false)
- }, Unstable ${formatBool(RepoManager.neuRepo.isUnstable, trueIsGood = false)}"))
- source.sendFeedback(tr("firmament.repo.info.items",
- "Loaded items: ${RepoManager.neuRepo.items?.items?.size}"))
- source.sendFeedback(tr("firmament.repo.info.itemcache",
- "ItemCache flawless: ${formatBool(ItemCache.isFlawless)}"))
- source.sendFeedback(tr("firmament.repo.info.itemdir",
- "Items on disk: ${debugPath(RepoDownloadManager.repoSavedLocation.resolve("items"))}"))
+ source.sendFeedback(
+ tr(
+ "firmament.repo.info.downloadedref",
+ "Downloaded ref: ${RepoDownloadManager.latestSavedVersionHash}"
+ )
+ )
+ source.sendFeedback(
+ tr(
+ "firmament.repo.info.location",
+ "Saved location: ${debugPath(RepoDownloadManager.repoSavedLocation)}"
+ )
+ )
+ source.sendFeedback(
+ tr(
+ "firmament.repo.info.reloadstatus",
+ "Incomplete: ${
+ formatBool(
+ RepoManager.neuRepo.isIncomplete,
+ trueIsGood = false
+ )
+ }, Unstable ${formatBool(RepoManager.neuRepo.isUnstable, trueIsGood = false)}"
+ )
+ )
+ source.sendFeedback(
+ tr(
+ "firmament.repo.info.items",
+ "Loaded items: ${RepoManager.neuRepo.items?.items?.size}"
+ )
+ )
+ source.sendFeedback(
+ tr(
+ "firmament.repo.info.overlays",
+ "Overlays: ${RepoManager.overlayData.overlays.size}"
+ )
+ )
+ source.sendFeedback(
+ tr(
+ "firmament.repo.info.itemcache",
+ "ItemCache flawless: ${formatBool(ItemCache.isFlawless)}"
+ )
+ )
+ source.sendFeedback(
+ tr(
+ "firmament.repo.info.itemdir",
+ "Items on disk: ${debugPath(RepoDownloadManager.repoSavedLocation.resolve("items"))}"
+ )
+ )
}
}
}
thenExecute {
AllConfigsGui.showAllGuis()
}
- CommandEvent.SubCommand.publish(CommandEvent.SubCommand(this@literal))
+ CommandEvent.SubCommand.publish(CommandEvent.SubCommand(this@literal, ctx))
}
-fun registerFirmamentCommand(dispatcher: CommandDispatcher<FabricClientCommandSource>) {
- val firmament = dispatcher.register(firmamentCommand())
+fun registerFirmamentCommand(dispatcher: CommandDispatcher<FabricClientCommandSource>, ctx: CommandBuildContext) {
+ val firmament = dispatcher.register(firmamentCommand(ctx))
dispatcher.register(literal("firm") {
redirect(firmament)
})