This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Autocompletion
Alan Gomes edited this page May 29, 2019
·
5 revisions
The Spigot Spring Boot Starter comes with a out of the box autocompletion system, which provides a powerful and extensible support for the Minecraft command autocompletion feature. By default, all subcommands are suggested, as well as Player
, World
and enum parameters.
To create custom completions, you can use the completionCandidates
option of @Parameters
, defining a Iterable<String>
class which will provide all the completions. Example:
@Component
public class FriendSuggestionProvider implements Iterable<String> {
@Autowired
private FriendService friendService;
@Autowired
private Context context;
@Override
public Iterator<String> iterator() {
return friendService.findFriends(context.getSender()).stream()
.map(Friend::getName)
.collect(Collectors.toList())
.iterator();
}
}
@Component
@CommandLine.Command(name = "addfriend")
public class AddFriendCommand {
@CommandLine.Parameters(index = "0", completionCandidates = FriendSuggestionProvider.class)
private String friend;
}
- Getting started
- Commands
- Utilities
- Context
- RxJava support
- Known issues
- Testing