-
-
Notifications
You must be signed in to change notification settings - Fork 75
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
I would like to add a variable-length parameter that wraps all known parameters (except itself).
It is like GreedyStringArgument, but it is enchanced.
Please supply examples of the desired inputs and outputs
Example:
Input: /test a
Output: a
But if we use /test a b c, it will say "a,b,c"
Or "/test 0 1 2", it will say "0,1,2"
Example for Developers:
new CommandAPICommand("test")
.withArguments(
new VariableLengthParameter("names", Object.class)
// or the class of special arguments, this allows you to check whether the user-supplied parameters are instances of these classes.
// I use Object.class to allow all possible argument.
).executes((sender, args) -> {
Collection<Object> result = (Collection<Object>) args[0]; // or Object[]
String message = String.join(",", Arrays.stream(result).map(IT -> String.valueOf(IT)).collect(Collectors.toList()).toArray());
sender.sendMessage(message);
}).register();
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request