Releases: Despical/CommandFramework
Releases · Despical/CommandFramework
v1.5.13
- 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
v1.5.12
- 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 withBoolean#getBoolean
method. - Removed the deprecation from
Command#async
option unless a new API is introduced.
Full Changelog: 1.5.11...1.5.12
v1.5.11
- Removed the
@Api.Internal
annotation from the OptionManager class.
Full Changelog: 1.5.1...1.5.11
v1.5.1
- Added
@Option
and@Flag
to parse arguments as an option or flag. - Added 3 new methods to
CommandArguments
class.CommandArguments#getOption(String)
- Gets the option parsed as an argument, can be null.CommandArguments#findOption(String)
- Returns an optional that holds a list of parsed option.CommandArguments#isFlagPresent(String)
- Returns true if the specified flag is present in the arguments.- Both option and flag annotations can be used multiple times in a single method.
- Added debug mode.
- Added
@Debug
annotation. If a command method is annotated with this annotation, it will only be registered if the debug mode is enabled.
- Added
- Added
Option#DEBUG
enum.- Use
CommandFramework#options().enableOption(Option.DEBUG);
method to enable debug mode. - Now the default logger will be
DebugLogger
if the debug mode is enabled.
- Use
- Fixed server-side command permissions.
- Use
CommandFramework#options
method to toggle options, other option methods are removed from the main class. - Updated tests for the new option and flag annotations.
Other Changes
- Updated badges in the README.md
- Updated content in the README.md
- Updated some wiki pages, documentation for the new annotations will be added later.
- Fixed GitHub actions instantly failing due to old version.
Full Changelog: 1.5.0...1.5.1
v1.5.0
- Added CommandFramework#getAllCommands method to get all registered commands and sub-commands.
- Fixed CommandFramework#getCommands method duplicates the commands and not contains the sub-commands.
- Now this method only returns the commands.
Full Changelog: 1.4.9...1.5.0
v1.4.9
- Fixed error messages (other than SHORT_ARG_SIZE and LONG_ARG_SIZE) not working in the expected behaviour.
Full Changelog: 1.4.8...1.4.9
1.4.8
- Added new method
CommandArguments#getCommand
which returnsme.despical.commandframework.annotations.Command
.- This method will return
null
, if used in a tab completer.
- This method will return
- Added
CommandArguments#checkCooldown
method to check cooldown in the command method.- This method can stop the execution of command when called.
- Added
CommandFramework#setLogger
andCommandFramework#getLogger
methods to set a different logger. (By default, the logger is instance plugin's logger). - Added
Message
enum to make error message handling in a better way. - Added
CommandArguments#sendMessage(Message)
method to directly send messages fromMessage
enum. - Moved
CommandFramework#setColorFormatter
method toMessage
enum. - Renamed
CommandArguments#getCommand
method toCommandArguments#getBukkitCommand
. - Fixed broken unit tests.
- Updated 90% of the Javadocs.
- Seperated some of the classes into different packages so this update may break your imports.
Full Changelog: 1.4.7...1.4.8
1.4.7
- Now framework won't initialize if the package is not relocated.
How to relocate the default package?
<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
1.4.6
- Added CommandArguments#getArgument(String, String) method to get argument with a fallback value.
- Updated javadocs of CommandArguments class.
- Updated pom file.
Full Changelog: 1.4.5...1.4.6
1.4.5
- Added CommandArguments#sendMessage(String, Object[]) method to send message as formatted.
- Added
@Param
and@Default
annotations to create custom parameters with the same type. - Removed
CommandFramework#getColorFormatter
method.
Detailed informations about how to create custom parameters.
Example usage of @Param
and @Default
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