Big Break: Change the Command Completion Handler signature to match Context

For consistency, make Completion Handlers be implemented the same way Context Handlers are.

Previously when we added the Context parameter, we left the original signature in place and simply tacked , c on the end.

This made migration easier than changing all completion handlers bodies.

But since 0.5.0 is a big migration already, let's just get it over with.

See changes to Bukkit default completions and the example plugin for migration example.
This commit is contained in:
Aikar
2017-06-14 22:17:33 -04:00
parent 14a1c33926
commit 15b149d55c
10 changed files with 27 additions and 26 deletions
@@ -42,7 +42,7 @@ public final class ACFExample extends JavaPlugin {
commandManager.getCommandReplacements().addReplacements("test", "foobar", "%foo", "barbaz");
commandManager.getCommandReplacements().addReplacement("testcmd", "test4|foobar|barbaz");
commandManager.getCommandContexts().registerContext(SomeObject.class, SomeObject.getContextResolver());
commandManager.getCommandCompletions().registerCompletion("test", (sender, config, input, c) -> (
commandManager.getCommandCompletions().registerCompletion("test", c -> (
Lists.newArrayList("foo", "bar", "baz")
));
commandManager.registerCommand(new SomeCommand());