mirror of
https://github.com/aikar/commands.git
synced 2026-06-01 23:02:18 +00:00
Fix example plugin
This commit is contained in:
+5
-1
@@ -21,10 +21,11 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package co.aikar.commands.example;
|
||||
package co.aikar.acfexample;
|
||||
|
||||
import co.aikar.commands.ACF;
|
||||
import co.aikar.commands.CommandManager;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class ACFExample extends JavaPlugin {
|
||||
@@ -40,6 +41,9 @@ public final class ACFExample extends JavaPlugin {
|
||||
private void registerCommands() {
|
||||
commandManager = ACF.createManager(this);
|
||||
commandManager.getCommandContexts().registerContext(SomeObject.class, SomeObject.getContextResolver());
|
||||
commandManager.getCommandCompletions().registerCompletion("test", (sender, completionConfig, input) -> (
|
||||
Lists.newArrayList("foo", "bar", "baz")
|
||||
));
|
||||
commandManager.registerCommand(new SomeCommand());
|
||||
}
|
||||
|
||||
+10
-1
@@ -21,14 +21,17 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package co.aikar.commands.example;
|
||||
package co.aikar.acfexample;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import co.aikar.commands.annotation.Optional;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.contexts.OnlinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -63,5 +66,11 @@ public class SomeCommand extends BaseCommand {
|
||||
sender.sendMessage("Hello, " + name);
|
||||
}
|
||||
|
||||
@Subcommand("completions")
|
||||
@CommandAlias("acfcompletions|acfc")
|
||||
@CommandCompletion("@players @worlds @test foo1|foo2|foo3")
|
||||
public void onTestCompletion(CommandSender sender, OnlinePlayer player, World world, String test, String misc) {
|
||||
sender.sendMessage("You got " + player.getPlayer().getName() + " - " + world.getName() + " - " + test + " - " + misc);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package co.aikar.commands.example;
|
||||
package co.aikar.acfexample;
|
||||
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import co.aikar.commands.contexts.ContextResolver;
|
||||
Reference in New Issue
Block a user