Skip to content

LiteCommands v3.6.0

Compare
Choose a tag to compare
@Rollczi Rollczi released this 01 Oct 16:08
· 55 commits to master since this release
bf6dd2f

What's Changed

Thanks @vLuckyyy

🟢 Add an option to disable strict mode.
If you disable strict mode for a command, then users will be able to add unexpected arguments e.g.
/help first asdfioaosdf asodfn asodimf <- this will work!

@Command(name = "help", strict = StrictMode.DISABLED)
class HelpCommand {

    @Execute
    void helpCommand(@Arg String arg) {
        
    }

}

You can also disable strict mode by calling:

.strictMode(StrictMode.DISABLED);

on builder.

⚠️ Experimental @ExecuteDefault

@Command(name = "kick")
public class KickCommand {
    @ExecuteDefault
    void commandHelp(@Context SENDER sender) {
        // /kick incorrect input
    }

    @Execute(name = "-all")
    void kickAll() {
        // /kick -all
    }
}

⚠️ Experimental @Priority

@Command(name = "test")
public class TestCommand {
    @Execute
    @Priority(PriorityValue.HIGH)
    void execute(int number) {
        // ...
    }

    @Execute
    @Priority(PriorityValue.LOW)
    void execute(String text) {
        // ...
    }
}

⚠️ Experimental Event system
Available events:

  • CandidateExecutorFoundEvent
  • CandidateExecutorMatchEvent
  • CommandPreExecutionEvent
  • CommandPostExecutionEvent

Simple example, how to block the execution of a command:

public class TellCommandController<SENDER> implements EventListener {
    
    @Subscriber
    public void onEvent(CommandPreExecutionEvent<SENDER> event) {
        SENDER sender = event.getInvocation().sender();

        if (event.getInvocation().name().equals("tell") && sender.isMuted()) {
            event.stopFlow(FailedReason.of("&cYou are muted!"));
        }
    }
}

Update dependencies

implementation("dev.rollczi:{artifact}:3.6.0")
<dependency>
    <groupId>dev.rollczi</groupId>
    <artifactId>{artifact}</artifactId>
    <version>3.6.0</version>
</dependency>

⚠️ Replace {artifact} with platform artifact

Discord Sponsor

Full Changelog: v3.5.0...v3.6.0