-
Notifications
You must be signed in to change notification settings - Fork 2
Developers
To build the plugin, you need to have Java 8 or higher and Maven installed on your computer. Run the following command in the root directory of the project:
mvn clean package
The .jar file will be in the \target folder.
AdvancedAbilities has an API that allows you to interact with the plugin. The jar of the API is downloadable through GitHub Releases.
Make sure to add the plugin as a dependency in your project.
The API consists in 6 main objects:
-
Ability, rapresents a simple ability without any function. -
ClickableAbilityinheritor of Ability, rapresents an ability executed on when interacted(PlayerInteractEvent). -
TargetAbilityinheritor of Ability, rapresents an ability executed when used to damage a player. -
ThrowableAbilityinheritor of Ability, rapresents an ability executed when its item is thrown. -
AbilityManagerto register and manage the abilities. -
ItemGeneratorused by the Ability class to create the item of a specific ability.
Note: You can override the method ThrowableAbility#onHit and use it to listen when your ability projectile hits someone.
AdvancedAPI api = AdvancedProvider.getApi();Work in progress...
Before creating a custom ability, I suggest to check out all the classes mentioned above to understand which one suits better for your ability.
Remember to define AdvancedAbilities as dependecy or soft-dependency of your plugin.
Creating your own ability is similar to register an EventHandler or a command with Bukkit and BungeeCord.
First, you need to create a class which extends Ability of one or its inheritors. You can implements a Bukkit Listener to add more features to your ability.
package me.coolperson.mycoolplugin.abilities;
import me.delected.advancedabilities.api.objects.ability.ClickableAbility;
import org.bukkit.entity.Player;
public class CoolAbility extends ClickableAbility {
//ID to identify the ability
@Override
public String getId() {
return "CoolAbility";
}
// Should the item be removed when the ability is executed?
@Override
public boolean removeItem() {
return true;
}
// Code executed on interact
@Override
public void run(Player player) {
// Stuff
}
}Now it's time to register your ability. Calling this method will also register the ability's Bukkit Listeners.
AdvancedProvider.getAPI().getAbilityManager().registerAbility(new CoolAbility());