public class AsyncTabCompleteEvent extends Event implements Cancellable
Modifier and Type | Class and Description |
---|---|
static interface |
AsyncTabCompleteEvent.Completion
A rich tab completion, consisting of a string suggestion, and a nullable
Component tooltip. |
Event.Result
Constructor and Description |
---|
AsyncTabCompleteEvent(@NotNull CommandSender sender,
@NotNull List<String> completions,
@NotNull String buffer,
boolean isCommand,
@Nullable Location loc)
Deprecated.
|
AsyncTabCompleteEvent(@NotNull CommandSender sender,
@NotNull String buffer,
boolean isCommand,
@Nullable Location loc) |
Modifier and Type | Method and Description |
---|---|
@NotNull List<AsyncTabCompleteEvent.Completion> |
completions()
The list of
completions which will be offered to the sender, in order. |
void |
completions(@NotNull List<AsyncTabCompleteEvent.Completion> newCompletions)
Set the
completions offered, overriding any already set. |
@NotNull String |
getBuffer()
Return the entire buffer which formed the basis of this completion.
|
@NotNull List<String> |
getCompletions()
The list of completions which will be offered to the sender, in order.
|
static @NotNull HandlerList |
getHandlerList() |
@NotNull HandlerList |
getHandlers() |
@Nullable Location |
getLocation() |
@NotNull CommandSender |
getSender()
Get the sender completing this command.
|
boolean |
isCancelled()
Gets the cancellation state of this event.
|
boolean |
isCommand() |
boolean |
isHandled()
If true, the standard process of calling
Command.tabComplete(CommandSender, String, String[])
or current player names will not be called. |
void |
setCancelled(boolean cancelled)
Will provide no completions, and will not fire the synchronous process
|
void |
setCompletions(@NotNull List<String> completions)
Set the completions offered, overriding any already set.
|
void |
setHandled(boolean handled)
Sets whether or not to consider the completion request handled.
|
callEvent, getEventName, isAsynchronous
public AsyncTabCompleteEvent(@NotNull @NotNull CommandSender sender, @NotNull @NotNull String buffer, boolean isCommand, @Nullable @Nullable Location loc)
@NotNull public @NotNull CommandSender getSender()
CommandSender
instance@NotNull public @NotNull List<String> getCompletions()
Command.tabComplete(CommandSender, String, String[])
or current player names will not be called.public void setCompletions(@NotNull @NotNull List<String> completions)
Command.tabComplete(CommandSender, String, String[])
or current player names will not be called.
The passed collection will be cloned to a new List. You must call {getCompletions()
} to mutate from herecompletions
- the new completions@NotNull public @NotNull List<AsyncTabCompleteEvent.Completion> completions()
completions
which will be offered to the sender, in order.
This list is mutable and reflects what will be offered.
If this collection is not empty after the event is fired, then
the standard process of calling Command.tabComplete(CommandSender, String, String[])
or current player names will not be called.
public void completions(@NotNull @NotNull List<AsyncTabCompleteEvent.Completion> newCompletions)
completions
offered, overriding any already set.
If this collection is not empty after the event is fired, then
the standard process of calling Command.tabComplete(CommandSender, String, String[])
or current player names will not be called.
The passed collection will be cloned to a new List. You must call {completions()
} to mutate from here
newCompletions
- the new completions@NotNull public @NotNull String getBuffer()
public boolean isCommand()
@Nullable public @Nullable Location getLocation()
public boolean isHandled()
Command.tabComplete(CommandSender, String, String[])
or current player names will not be called.public void setHandled(boolean handled)
Command.tabComplete(CommandSender, String, String[])
or current player names will not be called.handled
- if this completion should be marked as being handledpublic boolean isCancelled()
Cancellable
isCancelled
in interface Cancellable
public void setCancelled(boolean cancelled)
setCancelled
in interface Cancellable
cancelled
- true if you wish to cancel this event@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2021. All rights reserved.