Skip to content

Releases: Rollczi/LiteCommands

LiteCommands v3.9.1

11 Nov 12:56
d94823a
Compare
Choose a tag to compare

What's Changed

Update dependencies

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

⚠️ Replace {artifact} with platform artifact

Discord Sponsor

Full Changelog: v3.9.0...v3.9.1

LiteCommands v3.9.0

02 Nov 23:35
6a0cd90
Compare
Choose a tag to compare

What's Changed

Thanks you @huanmeng-qwq for the tooltips feature. 😻
Also thanks to @Knerio for helping me find the bug on JDA platform. ❤️

Update dependencies

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

⚠️ Replace {artifact} with platform artifact

Discord Sponsor

Full Changelog: v3.8.0...v3.9.0

LiteCommands v3.8.0

23 Oct 18:29
Compare
Choose a tag to compare

What's Changed

Update dependencies

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

⚠️ Replace {artifact} with platform artifact

Discord Sponsor

Full Changelog: v3.7.1...v3.8.0

LiteCommands v3.7.1

18 Oct 18:55
d1a7a4d
Compare
Choose a tag to compare

What's Changed

Thanks @TheDarkW3b ❤️ 📃

Update dependencies

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

⚠️ Replace {artifact} with platform artifact

Discord Sponsor

New Contributors

Full Changelog: v3.7.0...v3.7.1

LiteCommands v3.7.0

13 Oct 12:12
98b803f
Compare
Choose a tag to compare

What's Changed

Thanks @OOP-778 for the important bug fix ❤️

🟢 Add alias for @Context annotation

@Command(name = "hello")
public class HelloCommand {
    @Execute
    void command(@Sender CommandSender sender, @Arg String name) {
        // ...
    }
}

🟢 Add an option to create Annotation aliases like as @Sender

You can implement your annotation:

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
@RequirementDefinition(type = RequirementDefinition.Type.CONTEXT)
public @interface MySender {
}

And use it in your commands:

    @Execute
    void command(@MySender CommandSender sender, @Arg String name) {
        // ...
    }

🟢 Support completableFuture/async parse/context result:

public class UserArgumentResolver extends ArgumentResolver<CommandSender, User> {

    private final Pattern VALID_USER_PATTERN = Pattern.compile("^[a-zA-Z0-9_]{3,16}$");
    private final UserService userService;

    public UserArgumentResolver(UserService userService) {
        this.userService = userService;
    }

    @Override
    protected ParseResult<User> parse(Invocation<CommandSender> invocation, Argument<User> context, String argument) {
        CompletableFuture<ParseResult<User>> userNotFound = userService.getUser(argument)
            .thenApply(user -> user != null ? ParseResult.success(user) : ParseResult.failure("User not found"));

        return ParseResult.completableFuture(userNotFound);
    }

    @Override
    public boolean match(Invocation<CommandSender> invocation, Argument<User> context, String argument) {
        return VALID_USER_PATTERN.matcher(argument).matches();
    }
}

🟢 when you call blocking methods you can use ParseResult.async()

    @Override
    protected ParseResult<User> parse(Invocation<CommandSender> invocation, Argument<User> context, String argument) {
        return ParseResult.async(() -> userDatabase.getUser(argument));
    }

⚠️ When you return async/completableFuture result then you must also implement match method for correct suggestion validation

🟢 See also same API for ContextResult

ContextResult.completableFuture()
ContextResult.async()

🔴 Removed wrapper API

🔴 Breaking changes (Internal API)

See more #435

Update dependencies

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

⚠️ Replace {artifact} with platform artifact

Discord Sponsor

New Contributors

Full Changelog: v3.6.1...v3.7.0

LiteCommands v3.6.1

01 Oct 16:10
792185d
Compare
Choose a tag to compare

What's Changed

Thanks for @BlackBaroness

Update dependencies

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

⚠️ Replace {artifact} with platform artifact

Discord Sponsor

Full Changelog: v3.6.0...v3.6.1

LiteCommands v3.6.0

01 Oct 16:08
bf6dd2f
Compare
Choose a tag to compare

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

LiteCommands v3.5.0

08 Sep 11:44
202f9ed
Compare
Choose a tag to compare

What's Changed

Thanks @rchomczyk ❤️

🟢 Added bypass for @Cooldown

@Command(name = "test")
@Cooldown(key = "key", count = 1, unit = SECONDS, bypass = "your.bypass")
public class TestCommand {
   // ...
}

🟢 Added JakartaSettings#violationMessage for value type

Example usage:

.violationMessage(Max.class, Integer.class, (invocation, violation) -> "Invalid value: " + violation.getInvalidValue() + " for " + violation.getParameterName())

⚠️ Experimental @Varargs annotation

/numbers <numbers...>

@Command(name = "numbers")
public class NumbersCommand {

    @Execute
    void numbers(@Varargs(delimiter = ",") List<Double> numbers) {
        // ...
    }

}

Example input: /numbers 15,40.5,-1

⚠️ Experimental ContextChainedProvider, ArgumentResolverChained, BindChainedProvider

This can be helpful when you want to create a context/argument resolver/bind that is dependent on another.

Example for context:

public class GuildContextProvider<SENDER> implements ContextChainedProvider<SENDER, Guild> {

    @Override
    public ContextResult<LiteTestGuild> provide(Invocation<SENDER> invocation, ContextChainAccessor<SENDER> accessor) {
        return accessor.provideContext(User.class, invocation)
            .flatMap(user -> user.getGuild() == null
                ? ContextResult.error("User is not in a guild")
                : ContextResult.ok(() -> user.getGuild())
            );
    }
}

🔴 Removed JakartaSettings#constraintViolationsMessage

Use JakartaSettings#violationMessage instead.
Now If you want to join all violations into one message, then implement your ResultHandler for JakartaRawResult type.

Update dependencies

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

⚠️ Replace {artifact} with platform artifact

Discord Sponsor

Full Changelog: v3.4.3...v3.5.0

LiteCommands v3.4.3

08 Sep 11:25
dadeb19
Compare
Choose a tag to compare

What's Changed

  • GH-404 Add currency example with multi file command. by @Rollczi in #404
  • GH-407 Add platform receiver. Fix rcon bukkit adventure platform bug. by @Rollczi in #407
  • Add build-in context providers and argument resolvers for the velocity platform. by @Rollczi in #413

Update dependencies

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

⚠️ Replace {artifact} with platform artifact

Discord Sponsor

Full Changelog: v3.4.2...v3.4.3

LiteCommands v3.4.2

07 Jun 21:57
234df7e
Compare
Choose a tag to compare

What's Changed

Thanks @rchomczyk @BlackBaroness @RyanTheTechMan ❤️

Update dependencies

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

⚠️ Replace {artifact} with platform artifact

Discord Sponsor

Full Changelog: v3.4.1...v3.4.2