Commands Framework icon

Commands Framework -----

The simplest commands registration! /hello <name:Text> <age:number>



Annotations update
In this update I included commands registration with annotation.
This is the most simple way of creating new commands

Code (Java):
public class ExampleCommand {

    @FCommand (pattern = "/hello <name:Text> <points:Number> <job:Text[Miner,Warrior,Fisherman]>",
            onBuilder = "onBuild",
            onValidation = "onValidation",
            onError = "onError" )
    public void helloCommand (Player player, String name, double points, String job ) {
        player. sendMessage (ChatColor. DARK_GREEN + "Name: " + name + " points: " + points + " job" + job ) ;
        int i = 0 ;
        i = i / 0 ; //Forcing exception
    }

    public void onBuild (CommandBuilder builder ) {
        //Modifying commands properties before it is registered
        builder. argument ( "name" ). withDefaultValue ( "john" ) ;
    }

    public boolean onValidation (CommandValidationEvent event ) {
        event. sender ( ). sendMessage (ChatColor. YELLOW + "Validating command: " + event. args ( ). length ) ;
        return true ;
    }

    public void onError (CommandErrorEvent event ) {
        event. sender ( ). sendMessage (ChatColor. RED + "Handled exception: " + event. exception ( ). getCause ( ). getMessage ( ) ) ;
    }
}

public final class ExamplePlugin extends JavaPlugin {

    @Override
    public void onEnable ( ) {
        ExampleCommand exampleCommand = new ExampleCommand ( ) ;

        Commands commands = CommandsFramework. enable ( this ) ;
        commands. create (exampleCommand ). register ( ) ;
    }
}
----------, Aug 25, 2024
Resource Information
Author:
----------
Total Downloads: 106
First Release: Aug 19, 2024
Last Update: Aug 29, 2024
Category: ---------------
All-Time Rating:
1 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings