Advanced Abilities API

Oct 4, 2019
Advanced Abilities API


  • How to create an ability(top)


    1. Download the jar and add it in your library.
    2. Create a class and extend it to AbilityCreator, then add the super constructor.
    3. Implement this interface (AbilityCreatorLoader) in your JavaPlugin class and add the interface method, if you want to load more than one ability you have to use the interface named 'AbilityMultiCreatorLoader'.
    4. Instance your ability in getAbility() method of AbilityCreatorLoader interface.
    5. Build the file and add it in your '/plugins/AdvancedAbilities/abilities/api/' folder.
    Code (Text):
    public final class Main extends JavaPlugin implements AbilityCreatorLoader {

        @Override
        public AbilityCreator getAbility() {
            return new YourAbility();
        }

    }
    In your ability class you can use the AbilityCreator methods.
    Code (Text):
    getConfiguration() -> setLogo(ItemStack) | setDescription(List<String>) | setName(String)
    Code (Text):
    getLevelConfiguration(int) -> setDescription(List<String>) | setPrice(double) | setXp(double) : setPriceType(String)
    Code (Text):
    getUtils() -> abilityIsDisabled(UUID) | playerHasLevel(UUID, int) | sendAbilityMessage(UUID)
    Code (Text):
    getId() returns (String) id
    Code (Text):
    getMaxLevel() returns (int) max_level;

    How to hook an economy system(top)


    1. Download the jar and add it in your library.
    2. Create a class and implement this interface (EconomyHook).
    3. Implement the EconomyHook methods (playerMoney & withdrawMoney).
    4. Instance your economy class in your onEnable method (JavaPlugin).
    5. Add the file in your plugins folder.

    How to use mana(top)


    You can use the static methods of Mana (be.anybody.api.advancedabilities.mana.Mana):

    • addMana(Player, double); // Add mana.
    • getMana(Player); // Get player mana.
    • subtractMana(Player, double); // Subtract mana.
    • showMana(Player); // Player will see their mana (you can configure this in mana.yml -> mana_display_type).

    How to use the API events(top)


    Events:
    • AbilityRpgLevelUpEvent
    • AbilityUseEvent:
      • Special events:
      • - ExplosiveArrowHitEvent
      • - MiningLuckEvent
      • - WoodchoppingLuckEvent
    • AbilityEnableEvent
    • AbilityDisableEvent
    • AbilityLevelPurchaseEvent
    • SelectClassEvent
    example:
    Code (Text):
    @EventHandler
    public void event(AbilityUseEvent event) {
        if (event.getAbilityId().equals("explosive_arrow")) {
            if (event.getSpecialAbilityEvent() != null) {
                for (final Block block : ((ExplosiveArrowHitEvent) event.getSpecialAbilityEvent()).getBlocks()) {
                    if (block.getType() == Material.WOOD) {
                         event.setCancelled(true);
                    }
                }
            }
        }
    }

    How to use PlayerStats(top)


    You can use this class (be.anybody.api.advancedabilities.ability.stats) to get and set player level and exp.

    • setLevel(Player, String, int);
    • setExp(Player, String, double)
    • getExp(Player, String)
    • getLevel(Player, String)
  • Loading...
  • Loading...