Skip to content

Commit 9620e55

Browse files
committed
Transitive task type passing
1 parent 30ed752 commit 9620e55

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

common/src/main/kotlin/com/lambda/command/commands/BuildCommand.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ object BuildCommand : LambdaCommand(
6262
.loadStructureByRelativePath(Path.of(pathString))
6363
?.let { template ->
6464
info("Building structure $pathString with dimensions ${template.size.toShortString()} created by ${template.author}")
65-
template.toStructure()
65+
lastBuildTask = template.toStructure()
6666
.move(player.blockPos)
6767
.toBlueprint()
6868
.build()
6969
.run()
7070

71-
return@executeWithResult CommandResult.success()
71+
return@executeWithResult success()
7272
}
7373
} catch (e: InvalidPathException) {
7474
return@executeWithResult failure("Invalid path $pathString")

common/src/main/kotlin/com/lambda/task/TaskFlow.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ object TaskFlow : Task<Unit>() {
2323
override val name get() = "TaskFlow"
2424

2525
@Ta5kBuilder
26-
fun Task<*>.run() = this.execute(this@TaskFlow)
26+
inline fun <reified T : Task<*>> T.run(): T {
27+
execute(this@TaskFlow)
28+
return this
29+
}
2730

2831
@Ta5kBuilder
2932
fun Task<*>.run(task: TaskGenerator<Unit>) {

0 commit comments

Comments
 (0)