1.16.5 Is there a way to force update tab completion list?

Discussion in 'Spigot Plugin Development' started by Snicko, Nov 11, 2020.

  1. Hey there, I've got auto tab completion so that if a player types '/travel <player>' it will list all the online players in the auto tab so they can replace the <player> argument with a players name (like below).
    [​IMG] (typing /travel <player> without without auto completing)

    But because I have the auto completion for the /travel command to have <player>, if a player uses TAB to auto complete to <player>, it will not update to show the player names until you type something else.

    [​IMG] (typing /travel, and then using the auto complete for <player>, doesn't update the list)

    Is there a way to force update the list so when a player auto completes <player> it will show the list of online players?

  2. I assume you're using the onTabComplete method from TabCompleter in which case have you tried checking if args[0] (in this case being <player>) and if it's true then sending the list of players you want to show up (example being Bukkit.getOnlinePlayers())? If you have already tried this then not sure if it's possibly to force update tab completions.
  3. Yep so I use the TabCompleter although it seems like it only 'updates' the list when you type (add/remove characters in the chat). So if I click TAB to auto complete <player>, it doesn't trigger the event and the same TAB list is displayed. But then say if click backspace and > again, it will update the list. But what I want is so it updates when you click TAB and complete <player>.

    I'm not greatly familiar with packets, but would it be possible to force update the list when it's auto completed?
  4. I assume there is a packet for it but not that I am familiar with.
  5. Anyone know how to do this with packets?