Matt-MX/KtPaperGui

String command dsl

Matt-MX opened this issue · 1 comments

Implementing a new DSL for command building could be useful.

"/test <player:player> <msg:string...>" {
	val player by argument<Player>()
	val msg by argument<Array<String>>()
	
	player.sendMessage(!"&7[${source.name} -> Me]" + Component.text(msg))
	source.sendMessage(!"&7[Me -> ${player.name}]" + Component.text(msg))
}

"/foo" {
	"bar" {
		source.sendMessage("Bar")
	}
	"fizz <msg:string...>" {
		val msg by argument<Array<String>>()
		source.sendMessage("Fizz ($msg)")
	} missing {
		source.sendMessage("Argument $argName is required")
	}
}

impl in #21