CargoCommands
Annotation-based library for registration commands (mindustry)
Install / Use
/learn @Kowkodivka/CargoCommandsREADME
Installation
Gradle
repositories {
maven { url 'https://www.jitpack.io' }
}
dependencies {
implementation 'com.github.Kowkodivka:CargoCommands:1.0.2'
}
Gradle Kotlin DSL
repositories {
maven(url = "https://www.jitpack.io")
}
dependencies {
implementation("com.github.Kowkodivka:CargoCommands:1.0.2")
}
Building
If you'd rather compile on your own, follow these instructions. First, make sure you have JDK 19 installed. Other JDK versions will not work. Open a terminal your working directory and run the following commands:
Windows
Building: gradlew jar
Linux/Mac OS
Building: ./gradlew jar
Troubleshooting
Permission Denied
If the terminal returns Permission denied or Command not found on Mac/Linux, run chmod +x ./gradlew before running ./gradlew. This is a one-time procedure.
Examples:
Plugin main class:
import arc.util.CommandHandler
import io.lucin.core.CargoRegister
import mindustry.mod.Plugin
class ExamplePlugin : Plugin() {
override fun registerServerCommands(handler: CommandHandler) {
CargoRegister().add(ExampleServerCommand()).build(handler)
}
override fun registerClientCommands(handler: CommandHandler) {
CargoRegister().add(ExampleClientCommand()).build(handler)
}
}
Client command:
import arc.util.CommandHandler.CommandRunner
import io.lucin.core.annotations.Command
import mindustry.gen.Player
@Command("echo", "Replies with your message.", "<message...>")
class ExampleClientCommand : CommandRunner<Player> {
override fun accept(args: Array<out String>, player: Player) {
player.sendMessage("[accent]You said: []{args[0]}[]")
}
}
Server command:
import arc.func.Cons
import arc.util.Log.err
import io.lucin.core.annotations.Command
import mindustry.gen.Groups
import mindustry.gen.Player
@Command("send", "Send message to a player.", "<player> <message...>")
class ExampleServerCommand : Cons<Array<String>> {
override fun get(
args: Array<String>
) {
var target: Player? = null
Groups.player.each { player ->
if (player.name == args[0]) target = player else err("Cannot find player '${args[0]}'!")
}
if (target != null) {
target!!.sendMessage(args[1])
}
}
}
Related Skills
node-connect
335.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
335.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.5kCommit, push, and open a PR
