1717
1818package com.lambda.command.commands
1919
20- import com.lambda.brigadier.CommandResult.Companion.success
20+ import com.lambda.brigadier.argument.literal
2121import com.lambda.brigadier.argument.string
2222import com.lambda.brigadier.argument.value
23- import com.lambda.brigadier.executeWithResult
23+ import com.lambda.brigadier.execute
2424import com.lambda.brigadier.required
2525import com.lambda.command.LambdaCommand
2626import com.lambda.network.CapeManager.updateCape
2727import com.lambda.network.NetworkManager
2828import com.lambda.threading.runSafe
29- import com.lambda.util.Communication.info
3029import com.lambda.util.extension.CommandBuilder
3130
3231object CapeCommand : LambdaCommand(
@@ -35,27 +34,21 @@ object CapeCommand : LambdaCommand(
3534 description = " Sets your cape" ,
3635) {
3736 override fun CommandBuilder.create () {
38- required(string(" id" )) { id ->
39- suggests { _, builder ->
40- NetworkManager .capes
41- .forEach { builder.suggest(it) }
37+ required(literal(" set" )) {
38+ required(string(" id" )) { id ->
39+ suggests { _, builder ->
40+ NetworkManager .capes
41+ .forEach { builder.suggest(it) }
4242
43- builder.buildFuture()
44- }
45-
46- executeWithResult {
47- runSafe {
48- val cape = id().value()
49-
50- // FixMe:
51- // try-catch is stupid -
52- // cannot propagate errors correctly -
53- // spam the user and fuck off
54- updateCape(cape)
55- this @CapeCommand.info(" Successfully updated the cape" )
43+ builder.buildFuture()
44+ }
5645
57- success()
58- }!!
46+ execute {
47+ runSafe {
48+ val cape = id().value()
49+ updateCape(cape)
50+ }
51+ }
5952 }
6053 }
6154 }
0 commit comments