Skip to content

Instantly share code, notes, and snippets.

@ItsDoot
Last active May 5, 2019 23:45
Show Gist options
  • Select an option

  • Save ItsDoot/61360849d8f6c27f108b35b2746fb12b to your computer and use it in GitHub Desktop.

Select an option

Save ItsDoot/61360849d8f6c27f108b35b2746fb12b to your computer and use it in GitHub Desktop.
Sponge fully type-safe command api
object APCommand {
fun register(plugin: Any) {
val command = CommandRoot("ap", "aperms") {
"collection" then {
"list" execute ::collectionList
subjectCollection("collection") then {
"delete" execute executor(::collectionDelete)
"info" execute executor(::collectionInfo)
"subjects" execute executor(::collectionSubjects)
}
string("name") / "create" execute executor(::collectionCreate)
}
}
commandManager.register(plugin, command, command.aliases.aliases)
}
private fun collectionList(src: CommandSource) {
}
private fun collectionDelete(collection: SubjectCollection, src: CommandSource) {
}
private fun collectionInfo(collection: SubjectCollection, src: CommandSource) {
}
private fun collectionSubjects(collection: SubjectCollection, src: CommandSource) {
}
private fun collectionCreate(name: String, src: CommandSource) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment