Skip to content

Releases: Despical/CommandFramework

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

1.4.4

27 Mar 07:55
Compare
Choose a tag to compare
  • 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

1.4.3

21 Mar 10:11
Compare
Choose a tag to compare
  • 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