Skip to content

Releases: Despical/CommandFramework

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

1.4.2

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

1.4.1

15 Mar 18:23
Compare
Choose a tag to compare

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

1.4.0

01 Mar 10:58
Compare
Choose a tag to compare

1.4.0

  • Fixed #9, tab completer arguments contains sub-command parts.

Full Changelog: 1.3.9...1.4.0

1.3.9

15 Feb 09:08
Compare
Choose a tag to compare

1.3.9

Full Changelog: 1.3.8...1.3.9

1.3.8

08 Feb 14:31
Compare
Choose a tag to compare

1.3.8

Full Changelog: 1.3.7...1.3.8

1.3.7

06 Feb 12:12
Compare
Choose a tag to compare

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

	@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

1.3.6

05 Feb 11:58
Compare
Choose a tag to compare

1.3.6

Full Changelog: 1.3.5...1.3.6