I'm trying to add tab completion. I have a class cmd implements CommandExecutor,TabCompleter with onCommand() and onTabComplete() methods. I've registered my command using getCommand().setExecutor(); Can I also use getCommand().setTabExecutor(), or do I have to remove setExecutor then?
Heres an example for you. My /home command that lets you tab complete your home name (1st arg) and optionally a player's name (2nd arg) https://bitbucket.org/BillyGalbreat...e.java?at=master&fileviewer=file-view-default
So I can have a class which implements TabExecutor only ( not CommandExecutor ) and use .setExecutor()? If so, why not .setTabExecutor?
TabExecutor extends CommandExecutor. It simply adds the onTabComplete method that you need to override.
What? No... A TabExecutor is a CommandExecutor... I just explained that.. Register it like a normal CommandExecutor, like in my example link.
@BillyGalbreath correction: There's 2 interfaces, CommandExecutor and TabCompleter To make another class handle a command, use .setExecutor To make another class handle tab completion, use .setTabExecutor There's an interface, called TabExecutor, which simply extends CommandExecutor and TabCompleter. I believe if .setExecutor is called with a class that implements TabCompleter it also adds tab completion automatically, to make another class handle it for some unknown reason you then call .setTabCompleter
I think I get it. I can make a class Mycommand implements CommandExecutor and register it with .setExecutor(), and I can make a second class MycommandTab implements TabCompleter and register it with .setTabCompleter(); Is that correct?