feat: reexport lore command now no longer requires quotes and supports multiple items
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package moe.nea.firmament.features.debug.itemeditor
|
package moe.nea.firmament.features.debug.itemeditor
|
||||||
|
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.serialization.json.JsonArray
|
import kotlinx.serialization.json.JsonArray
|
||||||
import kotlinx.serialization.json.JsonObject
|
import kotlinx.serialization.json.JsonObject
|
||||||
@@ -19,8 +18,8 @@ import net.minecraft.nbt.NbtString
|
|||||||
import net.minecraft.text.Text
|
import net.minecraft.text.Text
|
||||||
import moe.nea.firmament.Firmament
|
import moe.nea.firmament.Firmament
|
||||||
import moe.nea.firmament.annotations.Subscribe
|
import moe.nea.firmament.annotations.Subscribe
|
||||||
|
import moe.nea.firmament.commands.RestArgumentType
|
||||||
import moe.nea.firmament.commands.get
|
import moe.nea.firmament.commands.get
|
||||||
import moe.nea.firmament.commands.suggestsList
|
|
||||||
import moe.nea.firmament.commands.thenArgument
|
import moe.nea.firmament.commands.thenArgument
|
||||||
import moe.nea.firmament.commands.thenExecute
|
import moe.nea.firmament.commands.thenExecute
|
||||||
import moe.nea.firmament.commands.thenLiteral
|
import moe.nea.firmament.commands.thenLiteral
|
||||||
@@ -116,10 +115,26 @@ object ItemExporter {
|
|||||||
fun onCommand(event: CommandEvent.SubCommand) {
|
fun onCommand(event: CommandEvent.SubCommand) {
|
||||||
event.subcommand(DeveloperFeatures.DEVELOPER_SUBCOMMAND) {
|
event.subcommand(DeveloperFeatures.DEVELOPER_SUBCOMMAND) {
|
||||||
thenLiteral("reexportlore") {
|
thenLiteral("reexportlore") {
|
||||||
thenArgument("itemid", StringArgumentType.string()) { itemid ->
|
thenArgument("itemid", RestArgumentType) { itemid ->
|
||||||
suggestsList { RepoManager.neuRepo.items.items.keys }
|
suggests { ctx, builder ->
|
||||||
|
val spaceIndex = builder.remaining.lastIndexOf(" ")
|
||||||
|
val (before, after) =
|
||||||
|
if (spaceIndex < 0) Pair("", builder.remaining)
|
||||||
|
else Pair(
|
||||||
|
builder.remaining.substring(0, spaceIndex + 1),
|
||||||
|
builder.remaining.substring(spaceIndex + 1)
|
||||||
|
)
|
||||||
|
RepoManager.neuRepo.items.items.keys
|
||||||
|
.asSequence()
|
||||||
|
.filter { it.startsWith(after, ignoreCase = true) }
|
||||||
|
.forEach {
|
||||||
|
builder.suggest(before + it)
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.buildFuture()
|
||||||
|
}
|
||||||
thenExecute {
|
thenExecute {
|
||||||
val itemid = SkyblockId(get(itemid))
|
for (itemid in get(itemid).split(" ").map { SkyblockId(it) }) {
|
||||||
if (pathFor(itemid).notExists()) {
|
if (pathFor(itemid).notExists()) {
|
||||||
MC.sendChat(
|
MC.sendChat(
|
||||||
tr(
|
tr(
|
||||||
@@ -137,6 +152,7 @@ object ItemExporter {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
thenLiteral("all") {
|
thenLiteral("all") {
|
||||||
thenExecute {
|
thenExecute {
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user