aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle.kts3
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt10
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt20
3 files changed, 21 insertions, 12 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index e5465a1..1fb3d25 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -25,8 +25,11 @@ loom {
}
runs {
named("client") {
+ /*
vmArg("-XX:+AllowEnhancedClassRedefinition")
vmArg("-XX:HotswapAgent=fatjar")
+
+ */
}
}
}
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt b/src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt
index c21eab8..6190d88 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/commands/dsl.kt
@@ -5,13 +5,19 @@ import com.mojang.brigadier.builder.ArgumentBuilder
import com.mojang.brigadier.builder.LiteralArgumentBuilder
import com.mojang.brigadier.builder.RequiredArgumentBuilder
import com.mojang.brigadier.context.CommandContext
-import moe.nea.notenoughupdates.util.iterate
-import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
import java.lang.reflect.ParameterizedType
+import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
+import moe.nea.notenoughupdates.util.iterate
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)
+}
+
fun literal(
name: String,
block: LiteralArgumentBuilder<DefaultSource>.() -> Unit
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt b/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt
index 99af49a..a60073a 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/commands/rome.kt
@@ -12,20 +12,20 @@ import moe.nea.notenoughupdates.util.ScreenUtil.setScreenLater
fun neuCommand() = literal("neu") {
- thenLiteral("reload") {
- thenLiteral("fetch") {
+ thenLiteral("repo") {
+ thenLiteral("reload") {
+ thenLiteral("fetch") {
+ thenExecute {
+ source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.network")) // TODO better reporting
+ RepoManager.launchAsyncUpdate()
+ }
+ }
thenExecute {
- source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.network")) // TODO better reporting
- RepoManager.launchAsyncUpdate()
+ source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.disk"))
+ RepoManager.reload()
}
}
thenExecute {
- source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.disk"))
- RepoManager.reload()
- }
- }
- thenLiteral("repo") {
- thenExecute {
setScreenLater(CottonClientScreen(repoGui()))
}
}