Matt-MX/KtPaperGui

Declarative command parameter type

Matt-MX opened this issue · 1 comments

The sender type param should be moved into the runs function, allowing for a fresher look of the DSL, as well as different executions for different sender types if wanted.

Currently

("foo" /
    listOf(
        ("fizz" / someArg)<CommandSender> {
            runs { reply(!someArg()) }
        },
        ("bar" / someArg)<CommandSender> {
            runs { reply(!someArg()) }
        }
    )
)<CommandSender> {
    runs { reply(!"Foo") }
}

Proposed Change

("foo" /
    listOf(
        ("fizz" / someArg) {
            runs<Player> { reply(!"&cHi player: &r${someArg()}") }
            runs<CommandSender> { reply(!someArg()) }
        },
        ("bar" / someArg) {
            runs<CommandSender> { reply(!someArg()) }
        }
    )
) {
    runs<CommandSender> { reply(!"Foo") }
}

Implemented in dev branch