Restructure commands
This commit is contained in:
@@ -25,8 +25,11 @@ loom {
|
|||||||
}
|
}
|
||||||
runs {
|
runs {
|
||||||
named("client") {
|
named("client") {
|
||||||
|
/*
|
||||||
vmArg("-XX:+AllowEnhancedClassRedefinition")
|
vmArg("-XX:+AllowEnhancedClassRedefinition")
|
||||||
vmArg("-XX:HotswapAgent=fatjar")
|
vmArg("-XX:HotswapAgent=fatjar")
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,19 @@ import com.mojang.brigadier.builder.ArgumentBuilder
|
|||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder
|
||||||
import com.mojang.brigadier.builder.RequiredArgumentBuilder
|
import com.mojang.brigadier.builder.RequiredArgumentBuilder
|
||||||
import com.mojang.brigadier.context.CommandContext
|
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 java.lang.reflect.ParameterizedType
|
||||||
|
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
|
||||||
|
import moe.nea.notenoughupdates.util.iterate
|
||||||
|
|
||||||
|
|
||||||
typealias DefaultSource = FabricClientCommandSource
|
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(
|
fun literal(
|
||||||
name: String,
|
name: String,
|
||||||
block: LiteralArgumentBuilder<DefaultSource>.() -> Unit
|
block: LiteralArgumentBuilder<DefaultSource>.() -> Unit
|
||||||
|
|||||||
@@ -12,19 +12,19 @@ import moe.nea.notenoughupdates.util.ScreenUtil.setScreenLater
|
|||||||
|
|
||||||
|
|
||||||
fun neuCommand() = literal("neu") {
|
fun neuCommand() = literal("neu") {
|
||||||
thenLiteral("reload") {
|
thenLiteral("repo") {
|
||||||
thenLiteral("fetch") {
|
thenLiteral("reload") {
|
||||||
|
thenLiteral("fetch") {
|
||||||
|
thenExecute {
|
||||||
|
source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.network")) // TODO better reporting
|
||||||
|
RepoManager.launchAsyncUpdate()
|
||||||
|
}
|
||||||
|
}
|
||||||
thenExecute {
|
thenExecute {
|
||||||
source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.network")) // TODO better reporting
|
source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.disk"))
|
||||||
RepoManager.launchAsyncUpdate()
|
RepoManager.reload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thenExecute {
|
|
||||||
source.sendFeedback(Text.translatable("notenoughupdates.repo.reload.disk"))
|
|
||||||
RepoManager.reload()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
thenLiteral("repo") {
|
|
||||||
thenExecute {
|
thenExecute {
|
||||||
setScreenLater(CottonClientScreen(repoGui()))
|
setScreenLater(CottonClientScreen(repoGui()))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user