@@ -2,17 +2,16 @@ package com.lambda.command.commands
22
33import com.lambda.brigadier.CommandResult
44import com.lambda.brigadier.argument.boolean
5- import com.lambda.brigadier.argument.identifier
65import com.lambda.brigadier.argument.literal
6+ import com.lambda.brigadier.argument.string
77import com.lambda.brigadier.argument.value
88import com.lambda.brigadier.executeWithResult
99import com.lambda.brigadier.optional
1010import com.lambda.brigadier.required
1111import com.lambda.command.LambdaCommand
12- import com.lambda.interaction.construction.blueprint.DynamicBlueprint.Companion.toBlueprint
13- import com.lambda.interaction.construction.blueprint.StaticBlueprint.Companion.toBlueprint
1412import com.lambda.interaction.construction.StructureRegistry
1513import com.lambda.interaction.construction.blueprint.Blueprint.Companion.toStructure
14+ import com.lambda.interaction.construction.blueprint.StaticBlueprint.Companion.toBlueprint
1615import com.lambda.task.tasks.BuildTask.Companion.build
1716import com.lambda.threading.runSafe
1817import com.lambda.util.Communication.info
@@ -26,10 +25,10 @@ object BuildCommand : LambdaCommand(
2625) {
2726 override fun CommandBuilder.create () {
2827 required(literal(" place" )) {
29- required(identifier (" structure" )) { structure ->
28+ required(string (" structure" )) { structure ->
3029 suggests { _, builder ->
31- StructureRegistry .streamTemplates()
32- .forEach { builder.suggest(it.path ) }
30+ StructureRegistry
31+ .forEach { key, _ -> builder.suggest(key ) }
3332
3433 builder.buildFuture()
3534 }
@@ -38,19 +37,21 @@ object BuildCommand : LambdaCommand(
3837 val id = structure().value()
3938 val path = if (pathing != null ) pathing().value() else false
4039 runSafe<Unit > {
41- StructureRegistry .loadStructure(id)?.let { template ->
42- info(" Building structure ${id.path} with dimensions ${template.size.toShortString()} by ${template.author} " )
43- template.toStructure()
44- .move(player.blockPos)
45- .toBlueprint()
46- .build(pathing = path)
47- .start(null )
40+ StructureRegistry
41+ .loadStructureByName(id)
42+ ?.let { template ->
43+ info(" Building structure $id with dimensions ${template.size.toShortString()} created by ${template.author} " )
44+ template.toStructure()
45+ .move(player.blockPos)
46+ .toBlueprint()
47+ .build(pathing = path)
48+ .start(null )
4849
49- return @executeWithResult CommandResult .success()
50- }
50+ return @executeWithResult CommandResult .success()
51+ }
5152 }
5253
53- CommandResult .failure(" Structure ${id.path} not found" )
54+ CommandResult .failure(" Structure $id not found" )
5455 }
5556 }
5657 }
0 commit comments