This page shows a way you could further build onto the framework and customize abilities.
Ability attributes
What I like to do for customizing abilities is adding an abstract class to handle ability attributes and then extending all my abilities off of my own class. This would be an example of my own AbilityAttributes class:
This gives me the ability to extend my ability classes to this and modify some extra attributes that can be configurable in the config. For example:
publicclassRocketJumpextendsAbilityAtrributes {//we are overriding the interacted method since we will bind our ability to a PlayerInteractEventpublicbooleaninteracted(PlayerInteractEvent event,GenericItem base) {Player player =event.getPlayer();if (use(player)) {//notice how here I utilize our ability attributes range, damage, and knockbackMultiplierplayer.setVelocity(player.getVelocity().add(newVector(0, range,0)));for (Entity e :player.getNearbyEntities(3,3,3)) {e.setVelocity(e.getVelocity().add(Utils.getVectorTowards(player.getLocation(),e.getLocation()).multiply(knockbackMultiplier)));if (e instanceof LivingEntity) ((LivingEntity) e).damage(damage); }returntrue; }returnfalse; }}
Now you can easily fetch and cast your abilities from the AbilityType class to configure your custom attributes like this:
//register our ability somewhere in our plugin firstAbilityType.registerAbility("rocket_jump",RocketJump.class);//you can fetch registered abilities like this and we can cast it to AbilityAttributes without checking because we know it is since we are the ones that registered itAbilityAttributes ability = (AbilityAttributes) AbilityType.getAbilityType("rocket_jump").createNewInstance();//examples for how we can create configurable ability attributes using the configability.setCooldownTicks((int) (plugin.getConfig().getDouble("ability.rocket_jump.cooldown") *20.0));ability.setDamage(plugin.getConfig().getDouble("ability.rocket_jump.damage"));ability.setRange(plugin.getConfig().getDouble("ability.rocket_jump.range"));ability.setKnockbackMultiplier(plugin.getConfig().getDouble("ability.rocket_jump.knockback"));//adding ability and binding it to right-click for our custom item "jetpack" (not created in this guide)ItemType.getItemType("jetpack").addAbility(Ability.Action.RIGHT_CLICK, ability);