Skip to content

LiteCommands v3.5.0

Compare
Choose a tag to compare
@Rollczi Rollczi released this 08 Sep 11:44
· 46 commits to master since this release
202f9ed

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