AdvancedAbilities API

Jun 15, 2017
AdvancedAbilities API
  • With the new version you can add your custom abilities and custom economy into your AdvancedAbilities.

    Tutorial to make an ability:

    1. Add AdvancedAbilities in 'depend' of plugin.yml
      Code (Text):
      main: example.example
      version: 1.0
      name:Example
      depend: [AdvancedAbilities]
    2. Make a class and extends it to RegisterAbility (be.multicodeproxy.advancedabilities.api.ability.RegisterAbility).
      Code (Text):
      import be.multicodeproxy.advancedabilities.api.ability.RegisterAbility;

      public class ability extends RegisterAbility {

      }
    3. Add constructor of RegisterAbility:
      Code (Text):
      import be.multicodeproxy.advancedabilities.api.ability.RegisterAbility;

      public class ability extends RegisterAbility {

            public ability(Plugin plugin, String ability_name){
                  super(plugin, ability_name);
            }

      }
    4. Well, you can set custom name, lore, material:
      Code (Text):
      import be.multicodeproxy.advancedabilities.api.ability.RegisterAbility;

      public class ability extends RegisterAbility {

            public ability(Plugin plugin, String ability_name){
                  super(plugin, ability_name);
                 
              this.getConfigurationFile().setName("Ability test");
              this.getConfigurationFile().setLogoMaterial(145, (byte) 0, 1, false);
              this.getConfigurationFile().setDescription(Arrays.asList("&7&m--------", "&7This is a test", "&7&m--------"));
              this.getConfigurationFile().getLevel(1).setDescription(Arrays.asList("&3This is description of level 1"));

            }

      }
    5. Instantiate a new object on your main class:
      Code (Text):
      public class MainClass extends JavaPlugin {
         
          @Override
          public void onEnable(){
                      // Test is the id and default name
              new ability(this, "Test");
          }

      }
    6. This is the result:
      [​IMG]
    7. You can use "getAbilityManager()" to get player and ability info :)

    Tutorial to make an economy:

    1. Add AdvancedAbilities in 'depend' of plugin.yml
      Code (Text):
      main: example.example
      version: 1.0
      name:Example
      depend: [AdvancedAbilities]
    2. Make a class and extends it to RegisterEconomy (be.multicodeproxy.advancedabilities.api.economy.RegisterEconomy)
      Code (Text):
      import be.multicodeproxy.advancedabilities.api.economy.RegisterEconomy;

      public class economy extends RegisterEconomy {
         

      }
    3. Add contructor of RegisterEconomy:
      Code (Text):
      public class economyextends RegisterEconomy {

          public ability(Plugin plugin, String economy_name) {
              super(plugin, economy_name);
          }
         

      }
    4. Well, add unimplemented method:
      Code (Text):
      public class economy extends RegisterEconomy {

          public ability(Plugin plugin, String economy_name) {
              super(plugin, economy_name);
          }

          @Override
          public int playerMoney(UUID player_uuid) {
              return 0; //Replace 0 to player's money
          }

          @Override
          public void withdrawMoney(UUID player_uuid, int withdraw_money) {
              //Add here your method to withdraw player's money
          }
         

      }
    5. Instantiate a new object on your main class:
      Code (Text):
      public class MainClass extends JavaPlugin {
         
          @Override
          public void onEnable(){
              new economy(this, "Economy_test");
          }
         

      }
       
    6. Finish, when you wanna use your economy, you have to change "currency-type: Vault" (Vault is default) to "Economy_test" (Economy's id), too you can use variables like "{money_Economy_test}"


    Methods:

    • getConfigurationFile() ->
      • setLogoMaterial(Material material) : Void
      • setDescription(List<String> stringList) : Void
      • setName(String s) : Void
      • getLevel(int level) ->
        • setDescription(List<String> stringList) : Void
        • setName(String s) : Void
        • setPrice(int price) : Void
    • getPlugin() : Plugin
    • getUtils() ->
      • playerHasLevel(Player player, int level): Boolean
      • abilityIsDisableByConfig(): Boolean
      • abilityIsDisableByPlayer(Player player) : Boolean
      • sendAbilityMessage(Player player) : Void
    • getName() : String
    • getVersion() : String

    Events:

    • AbilityRpgEvent
      • getPlayer()
      • getAbilityId()
      • getHandlers()
      • getHandlerList()
    • AbilityEvent
      • getPlayer()
      • getAbilityId()
      • getHandlers()
      • getHandlerList()
    How to use these events:
    • Extend your class to "org.bukkit.Listener".
    Code (Text):
    @EventHandler
    public void example(AbilityEvent event) {
          System.out.println(event.getAbilityId() + " was executed");
          //More things...
    }

    Can't you understand it?, Send me a private message.
  • Loading...
  • Loading...