Class AsyncTabCompleteEvent
- All Implemented Interfaces:
Cancellable
If this event provides completions, then the standard synchronous process will not be fired to populate the results. However, the synchronous TabCompleteEvent will fire with the Async results.
Only 1 process will be allowed to provide completions, the Async Event, or the standard process.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA rich tab completion, consisting of a string suggestion, and a nullableComponenttooltip.Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionAsyncTabCompleteEvent(CommandSender sender, String buffer, boolean isCommand, @Nullable Location loc) AsyncTabCompleteEvent(CommandSender sender, List<String> completions, String buffer, boolean isCommand, @Nullable Location loc) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionThe list ofcompletionswhich will be offered to the sender, in order.voidcompletions(List<AsyncTabCompleteEvent.Completion> newCompletions) Set thecompletionsoffered, overriding any already set.Return the entire buffer which formed the basis of this completion.The list of completions which will be offered to the sender, in order.static HandlerListGet the sender completing this command.booleanGets the cancellation state of this event.booleanbooleanIftrue, the standard process of callingCommand.tabComplete(CommandSender, String, String[])or current player names will not be called.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetCompletions(List<String> completions) Set the completions offered, overriding any already set.voidsetHandled(boolean handled) Sets whether to consider the completion request handled.Methods inherited from class org.bukkit.event.Event
callEvent, getEventContext, getEventName, isAsynchronous, isSupportInterrupt
-
Constructor Details
-
AsyncTabCompleteEvent
@Internal public AsyncTabCompleteEvent(CommandSender sender, String buffer, boolean isCommand, @Nullable Location loc) -
AsyncTabCompleteEvent
@Deprecated @Internal public AsyncTabCompleteEvent(CommandSender sender, List<String> completions, String buffer, boolean isCommand, @Nullable Location loc) Deprecated.
-
-
Method Details
-
getSender
Get the sender completing this command.- Returns:
- the
CommandSenderinstance
-
getCompletions
The list of 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.- Returns:
- a list of offered completions
-
setCompletions
Set the completions offered, overriding any already set. If this collection is not empty after the event is fired, then the standard process of callingCommand.tabComplete(CommandSender, String, String[])or current player names will not be called.The passed collection will be cloned to a new
List. You must callgetCompletions()to mutate from here- Parameters:
completions- the new completions
-
completions
The list ofcompletionswhich 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.- Returns:
- a list of offered completions
-
completions
Set thecompletionsoffered, overriding any already set. If this collection is not empty after the event is fired, then the standard process of callingCommand.tabComplete(CommandSender, String, String[])or current player names will not be called.The passed collection will be cloned to a new
List. You must callcompletions()to mutate from here- Parameters:
newCompletions- the new completions
-
getBuffer
Return the entire buffer which formed the basis of this completion.- Returns:
- command buffer, as entered
-
isCommand
public boolean isCommand()- Returns:
trueif it is a command being tab completed,falseif it is a chat message.
-
getLocation
- Returns:
- The position looked at by the sender, or
nullif none
-
isHandled
public boolean isHandled()Iftrue, the standard process of callingCommand.tabComplete(CommandSender, String, String[])or current player names will not be called.- Returns:
- Is completions considered handled. Always
trueif completions is not empty.
-
setHandled
public void setHandled(boolean handled) Sets whether to consider the completion request handled. Iftrue, the standard process of callingCommand.tabComplete(CommandSender, String, String[])or current player names will not be called.- Parameters:
handled- if this completion should be marked as being handled
-
isCancelled
public boolean isCancelled()Description copied from interface:CancellableGets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins- Specified by:
isCancelledin interfaceCancellable- Returns:
trueif this event is cancelled
-
setCancelled
public void setCancelled(boolean cancel) Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
Will provide no completions, and will not fire the synchronous process- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel-trueif you wish to cancel this event
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-