AsyncTabCompleteEvent
Let plugins be able to control tab completion of commands and chat async. This will be useful for frameworks like ACF so we can define async safe completion handlers, and avoid going to main for tab completions. Especially useful if you need to query a database in order to obtain the results for tab completion, such as offline players. Also adds isCommand and getLocation to the sync TabCompleteEvent Co-authored-by: Aikar <aikar@aikar.co>
This commit is contained in:
@@ -2297,7 +2297,7 @@ public final class CraftServer implements Server {
|
||||
offers = this.tabCompleteChat(player, message);
|
||||
}
|
||||
|
||||
TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers);
|
||||
TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? io.papermc.paper.util.MCUtil.toLocation(((CraftWorld) player.getWorld()).getHandle(), BlockPos.containing(pos)) : null); // Paper - AsyncTabCompleteEvent
|
||||
this.getPluginManager().callEvent(tabEvent);
|
||||
|
||||
return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions();
|
||||
|
||||
Reference in New Issue
Block a user