Command Framework [1.7 - 1.21.4] icon

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

A lightweight annotation based command system




  • Added a new option to change the fallback prefix of a command (Command#fallbackPrefix). By default, the fallback prefix is the same name as the plugin name.
  • Refactor: renamed me.despical.commandframework.options.Option to FrameworkOption for clarity.
  • Updated license headers.
Full Changelog: 1.5.12...1.5.13
----------, Jan 3, 2025

  • Fixed an exception occurring if a sub-command is registered without a main command and the main command of the sub-command is tried to executed.
  • Now if a sub-command is registered without a main command, the log message will display the full name of the sub-command instead of only displaying the main command's name.
  • Replaced the System#getProperty method with Boolean#getBoolean method.
  • Removed the deprecation from Command#async option unless a new API is introduced.
Full Changelog: 1.5.11...1.5.12
----------, Nov 4, 2024

Discord: mrdespical

1.4.7
  • Now framework won't initialize if the package is not relocated.

How to relocate the default package?
Code (Text):
<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-shade-plugin</artifactId>
   <version>3.4.1</version>
   <executions>
       <execution>
           <phase>package</phase>
           <goals>
               <goal>shade</goal>
           </goals>
           <configuration>
               <relocations>
                   <relocation>
                       <pattern>me.despical.commandframework</pattern>
                       <shadedPattern>your.package.here</shadedPattern>
                   </relocation>
               </relocations>
           </configuration>
       </execution>
   </executions>
</plugin>
Full Changelog: 1.4.6...1.4.7
----------, May 7, 2024

Discord: mrdespical

1.4.6
Full Changelog: 1.4.5...1.4.6
----------, Apr 27, 2024

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

  • Added 2 new BiFunction to have a detailed access on argument length check failed messages.
  • Closed #11 and #12.
Full Changelog: 1.4.3...1.4.4
----------, Mar 27, 2024

Discord: mrdespical
  • Added a warning message if user tries to register a sub-command without a main command, this message can be ignored and main command won't have any output as expected.
  • Removed Command#allowInfiniteArgs, now all the commands are taking infinite amount of arguments unless min and max values are set.
  • Removed any match function. It was a general function that was applying to all unmatched commands so it was limiting the code, now it can be applied for each main command individually.
  • Now using MessageFormat class to format Command Exceptions instead of using String#format method.
Full Changelog: 1.4.2...1.4.3
----------, Mar 21, 2024

Discord: mrdespical

1.4.2

  • Now firstly checking for the arguments length instead of confirmation and cooldowns.
  • Fixed sub-commands and tab completer aliases do not match properly. (Fixes #10)
  • Fixed tab completer aliases do not match if aliases contain both commands and sub-commands. (Fixes #10)
Thanks to @rokrieger for reporting #10.

Full Changelog: 1.4.1...1.4.2
----------, Mar 20, 2024

1.4.1
  • Added color formatter function to colorize some of the messages, for now, only CommandArguments#sendMessage(String).
  • Now using MessageFormat class instead of String#format method to format strings.
  • Now CommandFramework instance can not be initialized twice from the same JAR.
Full Changelog: 1.4.0...1.4.1
----------, Mar 15, 2024

1.4.0
  • Fixed #9, tab completer arguments contains sub-command parts.
Full Changelog: 1.3.9...1.4.0
----------, Mar 1, 2024

1.3.9
Full Changelog: 1.3.8...1.3.9
----------, Feb 15, 2024

1.3.8
Full Changelog: 1.3.7...1.3.8
----------, Feb 8, 2024

1.3.7
  • Added Confirmation annotation.
  • Fixed Command#max not working properly.
  • Fixed Cooldown annotation not working properly if bypass permission is not set.
Example Command with Confirmation Annotation
Code (Java):
   @Command (
       name = "confirmationTest"
    )
   @Confirmation (
       message = "Are you sure, if so, please execute command again to confirm.",
       expireAfter = 10,
       bypassPerm = "confirmation.bypass",
       timeUnit = TimeUnit. SECONDS,
       overrideConsole = true
    )
    public void confirmationCommand (CommandArguments arguments ) {
       arguments. sendMessage ( "Confirmation successful." ) ;
    }
Full Changelog: 1.3.6...1.3.7
----------, Feb 6, 2024

1.3.6
Full Changelog: 1.3.5...1.3.6
----------, Feb 5, 2024

1.3.5
  • Removed NoCommandArgs and CustomParameters annotations. Now framework supports both dynamically.
  • Now tab completer (Completer annotation) supports custom parameters or no parameters.
  • Removed unnecessary utility methods (which you should not use them, they are internal for the framework).
Supported Behaviours
  • CommandArguments parameter is now optional, you may or may not use it depends on your needs.
  • You can use custom parameters or no parameter with Completer annotation.
Full Changelog: 1.3.4...1.3.5
----------, Feb 4, 2024

1.3.4 Release Notes
  • Now aliases supports more or less arguments then actual command length.
  • Fixed methods without annotated Cooldown annotation throws exception.
Newly Supported Behaviours
Code (Java):
    // min - max values are supported for both
    // arguments are now splitting dynamically
   @Command (
       name = "test1",
       aliases = { "testAlias", "alias.1", "alias.1.2", "alias.2.3" }
    )
    public void testCommand_1 (CommandArguments arguments ) {
       arguments. sendMessage ( "Test message." ) ;
    }

   @Command (
       name = "test2",
       aliases = { "randomAlias", "another.alias.arg1.arg2" }
    )
    public void testCommand_2 (CommandArguments arguments ) {
       arguments. sendMessage ( "Test message." ) ;
    }
Full Changelog: 1.3.3...1.3.4
----------, Feb 1, 2024

1.3.3 Release Notes
Example Command with Cooldown Annotation
Code (Java):
   @Command (
       name = "test"
    )
   @Cooldown (
       cooldown = 10,
       timeUnit = TimeUnit. SECONDS, // default is seconds
       bypassPerm = "cooldown.bypass",
       overrideConsole = true
    )
    public void testCommand (CommandArguments arguments ) {
       arguments. sendMessage ( "Test message." ) ;
    }
Full Changelog: 1.3.2...1.3.3
----------, Feb 1, 2024

1.3.2 Release Notes
  • Added support for sub-command aliases.
  • Now framework allows users to create sub-commands without creating main command.
Supported Behaviours
Code (Java):
   @Command (
       name = "test0",
       aliases = { "cmdName", "name0.randomArg0" } // both will be registered
    )
    public void test0 (CommandArguments arguments ) { }

   @Command (
       name = "test1.arg1",
       aliases = { "oneWord", "name.randomArg1" } // only second one will be registered
    )
    public void test1 (CommandArguments arguments ) { }
Full Changelog: 1.3.1...1.3.2
----------, Jan 30, 2024

1.3.1 Release Notes
  • Now CommandFramework#addCustomParameter function will check for types at compile-time.
Full Changelog: 1.3.0...1.3.1
----------, Jan 24, 2024

1.3.0 Release Notes
  • Added support for custom command parameters.
  • Fixed CommandFramework#unregisterCommands method registering all matched name commands without checking if command is registered from Command Framework's instance plugin.
Additional Changes
  • Added JUnit tests for new API feature.
  • Added license header to JUnit tests.
  • Updated license headers.
Checked exceptions are replaced with an unchecked exception ( CommandException from Command Framework).

Full Changelog: 1.2.9...1.3.0
----------, Jan 23, 2024

1.2.9 Release Notes
  • Added @NoCommandArguments annotation to run commands and tab completers without passing CommandArguments parameter.
  • Added JUnit tests for @NoCommandArguments.
  • Updated command examples and wiki page.
Additioal Changes
  • Command#async option is now deprecated (will be removed in future updates). New API will be introduced for asynchronous programming.
  • Skipped 1.2.7 & 1.2.8 updates
Full Changelog: 1.2.6...1.2.9
----------, Jan 20, 2024

1.2.8 Release Notes
  • Added @NoCommandArguments annotation to run commands and tab completers without passing CommandArguments parameter.
  • Added JUnit tests for @NoCommandArguments.
  • Updated command examples and wiki page.
Additioal Changes
  • Command#async option is now deprecated (will be removed in future updates). New API will be introduced for asynchronous programming.
  • Skipped 1.2.7 update
Full Changelog: 1.2.6...1.2.8
----------, Jan 20, 2024

1.2.6 Release Notes:
  • Fixed sub-commands can not be registered.
    • Now if a sub-command is getting tried to register and doesn't have a main command an exception will be thrown after unregistering those commands.
Full Changelog: 1.2.5...1.2.6
----------, Oct 3, 2023

1.2.5 Release Notes:
  • Added Command#async option to execute commands in a separate thread.
    • By default, commands will execute in the main thread.
Developers should be careful while enabling the async option because Bukkit API is not thread safe nor guranteed to be thread safe.

Full Changelog: 1.2.4...1.2.5
----------, Oct 1, 2023

1.2.4 Release Notes:
  • Added CommandFramework#getSubCommands method to get a copy of registered subcommands.
  • Added Command#onlyOp option to allow only op players to execute target command.
  • Fixed (#8) CommandMap#getKnownCommands is not available in legacy versions.
Huge thanks to @gamerover98 for their reports and contributions.

Full Changelog: 1.2.3...1.2.4
----------, Aug 14, 2023

1.2.3 Release Notes:
  • Enabled remaning tests.
  • Skipped tests prevent compiler errors on JitPack.
Special thanks to @gamerover98 for their contributions with tests.

What's Changed
  • Updated paper-api to 1.20.1 and added MockBukkit test suites by @gamerover98 in #6
New Contributors
Full Changelog: 1.2.2...1.2.3
----------, Aug 12, 2023

1.2.2 Release Notes:
  • Replaced CommandFramework#setAnyMatch method which is Java Consumer with CommandFramework#setMatchFunction which is a Java Function from functional interfaces feature, now you can return a boolean value and consider sending command usages to sender. Sender will receive usage message by default.
Code (Java):
    /**
     * Function to apply if there is no matched commands related framework.
     *
     * <pre>
     *     // To disable sending usage to command sender return true
     *     CommandFramework#setMatchFunction(arguments -> true);
     * </pre>
     */

    @Nullable
    private Function <CommandArguments, Boolean > matchFunction = (arguments ) -> false ;
Full Changelog: 1.2.1...1.2.2
----------, Aug 11, 2023

1.2.1 Release Notes:
  • Fixed command aliases do not support case-sensitive. (#3)
  • Added unregistering command methods. (#4)
Full Changelog: 1.2.0...1.2.1
----------, Aug 10, 2023

1.2.0 Release Notes:
  • Removed Commons from libraries and added some parts of the library to Utils class.
    • Possible fix to prevent overlapping classes when users both using Commons and CommandFramework.
----------, Jul 14, 2023

1.1.9 Release notes:
  • Fixed the empty permissions cause some bugs.
  • Fixed the sub-commands are registering as a main command which causes duplication.
----------, Apr 8, 2023

1.1.8 Release notes:
  • Added optional permission to tab completer annotation.
----------, Apr 4, 2023


  • Fixed sub command searching.
  • Added support for sub command tab completer.
----------, Jan 21, 2023

1.1.5 Release notes:
  • Fixed empty command permissions not passing permission check.
  • Updated Commons library.
----------, Jan 12, 2023

1.1.4 Release Notes:
  • Fixed cooldown commands can be executed twice after the first execution.
  • Now CommandFramework.WAIT_BEFORE_USING_AGAIN message shows remaining time to execute command again.
----------, Nov 24, 2022

  • Added CommandArguments#getArgumentAsLong(index).
  • Added CommandArguments#getArgumentAsBoolean(index).
  • Updated contributing guidelines for code inspections.
----------, Aug 12, 2022

  • Removed unnecessary debug lines
Click here to go release notes.
----------, Jul 30, 2022

  • Fixed any match consumer not working if any main command is found with arguments.
Click here to go release notes.
----------, Jul 30, 2022

  • Fixed any match consumer not working properly if it is defined.
Click here to go release notes.
----------, Jul 24, 2022

We have fixed the issue #1 in this update which causes our framework to not detect the sub commands if there are any other main commands with the same name of the sub command's main command's name.
  • Fixed issue #1.
  • Improved the searching algorithm.

Click here to go release notes.
----------, Jul 24, 2022

In this update we have updated our wiki, add more information to sidebar. Created FUNDING.yml. Updated Commons library to support Minecraft 1.18 and 1.19.
  • Updated Commons library for better support.
  • Updated our wiki page.
----------, Jul 13, 2022

Changelogs:

  • Fixed some critical issues related any match consumer.
----------, Jun 24, 2021

Changelogs:
  • Now CommandArguments#getSender now return generic type to match with Player and CommandSender interfaces.
  • Added CommandArgument#getArgument method to get any specific argument without receiving array.
    • Fixed cannot getting first element because of false logic algorithm.
  • Added CommandArguments#isSenderConsole method to check if sender is console.
  • Added CommandArguments#isSenderPlayer method to check if sender is player.
  • Added CommandArguments#sendMessage method to send message to sender without receving command sender object.
  • Added static message fields to CommandFramework class. Now error messages can be handled with using them.
----------, May 18, 2021

Resource Information
Author:
----------
Total Downloads: 5,840
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