-
-
Notifications
You must be signed in to change notification settings - Fork 147
Migrating from 0.4.0 to 0.5.0
0.5.0 is still WIP and more migration needs are still being added, and things said on this page may change
0.5.0 introduced a module style project, where bukkit specific stuff is now in its own artifact.
You must change acf-core to acf-bukkit OR acf-paper (if you will require paper for your plugin) in your pom.xml or build.gradle file.
Also ensure <scope>compile</scope>
is set
Example POM:
<dependencies>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>co.aikar</groupId>
<artifactId>acf-paper</artifactId>
<version>0.5.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
First change your Manager type to be exactly what it
CommandManager
-> BukkitCommandManager
or PaperCommandManager
Then instead of ACF.createManager(plugin)
do commandManager = new BukkitCommandManager(plugin);
If you have a method like
public ContextResolver<MyType> getResolver() {
return c -> { };
}
Then you need to adjust the return signature to
public ContextResolver<MyType, BukkitCommandExecutionContext> getResolver() {
return c -> { };
}
If you have a method like
public CommandCompletions.CommandCompletionHandler getCompletionHandler() {
return (sender, config, input, c) -> { };
}
Then you need to adjust the return signature to
public CommandCompletions.CommandCompletionHandler<CommandSender, BukkitCommandCompletionContext> getCompletionHandler() {
return (sender, config, input, c) -> { };
}
Drop commandLabel (use .getExecCommandLabel()), add @PreCommand
and remove @Override
like so:
@PreCommand
public boolean anything(CommandSender sender, String[] args) {
}
Same as before, return true to abort.
Same as above, but use @UnknownHandler
@UnknownHandler
public void help(CommandSender sender, String[] args) {
}
If you copied CommandContexts to a local like so:
CommandContexts commandContexts = EmpirePlugin.commandManager.getCommandContexts();
You will need to regenerate the reference or update it like so:
CommandContexts<BukkitCommandExecutionContext> commandContexts = EmpirePlugin.commandManager.getCommandContexts();
If you cupied CommandCompletions to a local like so:
CommandCompletions commandCompletions = EmpirePlugin.commandManager.getCommandCompletions();
You will need to update it like so:
CommandCompletions<CommandSender, BukkitCommandCompletionContext> commandCompletions = EmpirePlugin.commandManager.getCommandCompletions();
Simply change all use of inner classes extends BaseSubcommand
to BaseCommand
(same as parent)