Command Framework [1.7 - 1.21.4] icon

Command Framework [1.7 - 1.21.4] -----

A lightweight annotation based command system



Added 2 new annotations to create custom parameters
Detailed informations about how to create custom parameters.

Example usage of @Param and @Default
Code (Java):
public class ExampleClass extends JavaPlugin {

    @Override
    public void onEnable ( ) {
        CommandFramework commandFramework = new CommandFramework ( this ) ;
        commandFramework. registerCommands ( this ) ;
        commandFramework. addCustomParameter ( "arg", arguments -> arguments. getArgument ( 0 ) ) ;
        commandFramework. addCustomParameter ( "secondAsInt", arguments -> arguments. getLength ( ) > 1 ? arguments. getArgumentAsInt ( 1 ) : null ) ;
    }

        // /example - Output will be "Value: default value of the argument"
        // /example test - Output will be "Value: test"
        @Command (name = "example" )
    public void exampleCommand (CommandArguments arguments, @ Default ( "default value of the argument" ) @Param ( "arg" ) String value ) {
        arguments. sendMessage ( "Value: " + value ) ;
    }

        // /example firstArg 123 - Output will be "Second argument as int is 123"
        // /example firstArg - Output will be "Second argument as int is 100" (100 is the value from default annotation)
        @Command (name = "intExample" )
    public void exampleCommand (CommandArguments arguments, @ Default ( "100" ) @Param ( "secondAsInt" ) int secondArg ) {
        arguments. sendMessage ( "Second argument as int is " + secondArg ) ;
    }
}
Full Changelog: 1.4.4...1.4.5
----------, Mar 30, 2024
Resource Information
Author:
----------
Total Downloads: 5,843
First Release: Mar 10, 2021
Last Update: Jan 3, 2025
Category: ---------------
All-Time Rating:
2 ratings
Find more info at github.com...
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings