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.
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.
// /example - Output will be "Value: default value of the argument" // /example test - Output will be "Value: test" @Command
(name
="example") publicvoid 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") publicvoid exampleCommand
(CommandArguments arguments, @
Default("100") @Param
("secondAsInt")int secondArg
){ arguments.
sendMessage("Second argument as int is "+ secondArg
); } }
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.
CommandArguments#isFloatingDecimal(int) - Checks if the value obtained from the argument at the specified index can be successfully parsed into a floating-point decimal
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"} ) publicvoid testCommand_1
(CommandArguments arguments
){ arguments.
sendMessage("Test message."); }
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 ) publicvoid test0
(CommandArguments arguments
){}
@Command
( name
="test1.arg1",
aliases
={"oneWord",
"name.randomArg1"}// only second one will be registered ) publicvoid test1
(CommandArguments arguments
){}
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).
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;
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.
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.