Skip to content

CMDPass

Marcin Grzywacz edited this page Nov 5, 2022 · 3 revisions

This annotation passes execution to another class that handles things it's way @CMDPass("path.to.command.class")
Path to command class is relative to plugin main class package

WARNING You can create infinite loops that will surely crash the server during initialization

Given the following project structure

image

Usage:

package com.lupus.tester.commands

class TestCMD {
    @CMDPass("AnotherTestingCMD")
    fun run(ex: CommandSender, value: Int) {
    }
}
package com.lupus.tester.commands

class AnotherTestingCMD(val previousValue: Int) {

    fun run(player: Player, a: Int): String {
        return "Your numbers were $a and $previousValue"
    }
}

Gives following output

2022-09-04 19-40-50

You could also add @Continuous annotation in AnotherTestingCMD class for the simpler every subcommand will apply /test run 10 run 100

Clone this wiki locally