SPIGOT-215: Implement infrastructure for Location tab completes

By: DemonWav <demonwav@gmail.com>
This commit is contained in:
Bukkit/Spigot
2016-08-25 09:48:22 +10:00
parent 02b060f77a
commit 359e6edb63
3 changed files with 41 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import java.util.Set;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.entity.minecart.CommandMinecart;
@ -83,6 +84,22 @@ public abstract class Command {
* @throws IllegalArgumentException if sender, alias, or args is null
*/
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
return tabComplete(sender, alias, args, null);
}
/**
* Executed on tab completion for this command, returning a list of
* options the player can tab through.
*
* @param sender Source object which is executing this command
* @param alias the alias being used
* @param args All arguments passed to the command, split via ' '
* @param location The position looked at by the sender, or null if none
* @return a list of tab-completions for the specified arguments. This
* will never be null. List may be immutable.
* @throws IllegalArgumentException if sender, alias, or args is null
*/
public List<String> tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException {
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(args, "Arguments cannot be null");
Validate.notNull(alias, "Alias cannot be null");