Skip to content
Daniel Ennis edited this page Jul 19, 2017 · 18 revisions

Using ACF - Annotation Command Framework

Build Tool Setup

See Maven, Gradle, or you can find artifacts here:

Or manual: https://repo.aikar.co/nexus/content/groups/aikar/co/aikar/

Getting a Command Manager

This part is platform specific. Use the command manager that represents your platform.

Bukkit:

BukkitCommandManager manager = new BukkitCommandManager(yourBukkitPlugin);

Bungee:

BungeeCommandManager manager = new BungeeCommandManager(yourBungeePlugin);

Sponge:

SpongeCommandManager manager = new SpongeCommandManager(yourSpongePlugin);

Registering a command

First you need to create a class that extends BaseCommand, then register that command with the manager

manager.registerCommand(new MyCommand());

If you need your plugin instance, pass it to your commands constructor like so (this is called dependency injection if you are not aware)

manager.registerCommand(new MyCommand(myPlugin));

See Wiki Home for links to the other guides, but here is some important ones:

Clone this wiki locally