Skip to content

Releases: Despical/CommandFramework

v1.5.13

03 Jan 10:54
Compare
Choose a tag to compare
  • 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

04 Nov 10:39
Compare
Choose a tag to compare
  • 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

v1.5.11

27 Sep 09:59
Compare
Choose a tag to compare
  • Removed the @Api.Internal annotation from the OptionManager class.

Full Changelog: 1.5.1...1.5.11

v1.5.1

21 Sep 11:56
Compare
Choose a tag to compare
  • 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 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.
  • 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

19 Aug 09:44
Compare
Choose a tag to compare
  • 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

28 Jul 09:59
Compare
Choose a tag to compare

Full Changelog: 1.4.8...1.4.9

1.4.8

19 Jul 12:53
Compare
Choose a tag to compare
  • Added new method CommandArguments#getCommand which returns me.despical.commandframework.annotations.Command.
    • This method will return null, if used in a tab completer.
  • Added CommandArguments#checkCooldown method to check cooldown in the command method.
    • This method can stop the execution of command when called.
  • Added CommandFramework#setLogger and CommandFramework#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 from Message enum.
  • Moved CommandFramework#setColorFormatter method to Message enum.
  • Renamed CommandArguments#getCommand method to CommandArguments#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

07 May 08:21
Compare
Choose a tag to compare
  • 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

27 Apr 16:56
Compare
Choose a tag to compare

Full Changelog: 1.4.5...1.4.6

1.4.5

30 Mar 12:30
Compare
Choose a tag to compare

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