Skip to content

TheFrontier/SKPC

Repository files navigation

Sponge Kotlin Parser tree Commands

Yet Another Command API (tm)

Features:

  • Fully type-safe.
  • Easily intermingle subcommands and arguments.
  • Write arguments and subcommands that are dependent on previous arguments.
  • Compact Kotlin-based DSL makes writing commands simple.

SKPC in Action

A Simple Example

import frontier.skpc.CommandTree
import frontier.skpc.util.*
import frontier.skpc.value.standard.ValueParameters.int
import org.spongepowered.api.Sponge
import org.spongepowered.api.command.CommandResult
import org.spongepowered.api.text.Text

val command = CommandTree.Root("sum").apply {
    int("value1") / int("value2") execute { (value1, value2, src) ->
        src.sendMessage(Text.of("$value1 + $value2 = ${value1 + value2}"))
        CommandResult.success()
    }
}

Sponge.getCommandManager().register(plugin, command.toCallable(), command.aliases)

Get It

Arven Core (Recommended)

arven-core shades SKPC so you don't have to! Simply put arven-core as a dependency in your @Plugin annotation, and have users download it when downloading your plugin.

repositories {
    maven {
        setUrl("https://jitpack.io")
    }
}

dependencies {
    implementation("com.github.Arvenwood:arven-core:<current version>")
}

Gradle (Kotlin DSL)

repositories {
    maven {
        setUrl("https://jitpack.io")
    }
}

dependencies {
    implementation("com.github.TheFrontier:SKPC:<current version>")
}

About

Sponge+Kotlin Parser tree Commands

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages