Making only Players show in TabCompletion

Discussion in 'Plugin Development' started by WingedMLGPro, May 22, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    WingedMLGPro

    Hey guys!
    I want to be able to make it so when a Player presses Tab when they are typing something it doesnt come up with commands that are available BUT it does come up with the players.
    So for e.g. if u are typing "/" OR "/<StartOfCommandand>" then press tab it sends you nothing but if you do "/<Command> <StartOfPlayerName>" and then it will tell you the Players names that start with that or if you just leave the <StartOfPlayerName> Blank, it will tell you all of the Online Players.

    I have no idea how to do this so ANY help will be appreciated!

    -WingedMLGPro
     
  2. Offline

    Zombie_Striker

    Look into onTabCompleation() and if the args == 0, then return null
     
  3. Offline

    567legodude

    @WingedMLGPro You set it up similar to the way you do Commands. You need to implement TabCompleter and override the onTabComplete method. Then just do all your checking, and return a List<String> which is the list that the player can choose from when they tab.

    So in your case you need to check what command they are using tab for, then see if they have anything typed for the first argument, if so, return a list of player names that start with that, otherwise return all the player names.
     
Thread Status:
Not open for further replies.

Share This Page