LiteCommands v3.5.0
What's Changed
- GH-415 Add chained contexts by @Rollczi in #415
- GH-386 Add Varargs annotation and processor. by @Rollczi in #386
- GH-418 Add BukkitCommand#getCommandRoute by @Rollczi in #418
- GH-419 Fix Suggestion#of and number formatting. by @Rollczi in #419
- GH-420 Add an option to define permission, which allows bypassing cooldown by @rchomczyk in #420
- GH-421 Add missing api. Remove useless method. by @Rollczi in #421
- GH-423 Lazy load jakarta validator by @Rollczi in #423
- GH-424 Update example. Fix also legacy simple schematic generator. by @Rollczi in #424
- GH-425 Fix @OptionalArg annotation for the jda platform. by @Rollczi in #425
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>
{artifact}
with platform artifact
Full Changelog: v3.4.3...v3.5.0