diff options
author | Score_Under <seejay.11@gmail.com> | 2012-10-09 14:54:12 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2012-10-16 00:05:40 -0500 |
commit | 9fd9767a4a55c90bf488e2077123be8a55aaa982 (patch) | |
tree | 5002df639c3787bcef34253fcdac9ec08a858952 /src/test/java/org | |
parent | 3dc80e1563eab780198b2696e26362bbf057d56b (diff) | |
download | bukkit-9fd9767a4a55c90bf488e2077123be8a55aaa982.tar bukkit-9fd9767a4a55c90bf488e2077123be8a55aaa982.tar.gz bukkit-9fd9767a4a55c90bf488e2077123be8a55aaa982.tar.lz bukkit-9fd9767a4a55c90bf488e2077123be8a55aaa982.tar.xz bukkit-9fd9767a4a55c90bf488e2077123be8a55aaa982.zip |
Add tab-completion API. Fixes BUKKIT-2181. Adds BUKKIT-2602
CommandMap contains a method that will auto-complete commands
appropriately. Before the first space, it searches for commands of which
the sender has permission. After the first space, it delegates to the
individual command.
Vanilla commands contain implementations to mimic vanilla
implementation. Exception would be give, that allows for name matching;
a feature we already allowed as part of the command is now supported for
auto-complete as well.
Plugin commands can get a tab completer set to delegate the completion
for. If no tab completer is set, it can check the executor to see if it
implements the tab completion interface. It will also attempt to chain
calls if null gets returned from these interfaces. Plugins also
implement the new TabCompleter interface, to add ease-of-use for plugin
developers, similar to the onCommand() method.
The default command implementation simply searches for player names.
To help facilitate command completion, a utility class was added with
two functions. One checks two strings, to see if the specified string
starts with (ignoring case) the second. The other method uses the first
to selectively copy elements from one collection to another.
Diffstat (limited to 'src/test/java/org')
-rw-r--r-- | src/test/java/org/bukkit/plugin/TestPlugin.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/java/org/bukkit/plugin/TestPlugin.java b/src/test/java/org/bukkit/plugin/TestPlugin.java index a435771a..7e098925 100644 --- a/src/test/java/org/bukkit/plugin/TestPlugin.java +++ b/src/test/java/org/bukkit/plugin/TestPlugin.java @@ -2,6 +2,7 @@ package org.bukkit.plugin; import java.io.File; import java.io.InputStream; +import java.util.List; import org.bukkit.Server; import org.bukkit.command.Command; @@ -103,4 +104,8 @@ public class TestPlugin extends PluginBase { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { throw new UnsupportedOperationException("Not supported."); } + + public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { + throw new UnsupportedOperationException("Not supported."); + } } |