Custom Items: Anonymous Abilities (Premium) - BoBoBalloon/InnovativeItemsDOCS GitHub Wiki

Intro

Please keep in mind this section goes over a feature that is only available for the premium version of the plugin...

Before reading this section it is highly recommended to first read the basic ability section to have a decent grasp of the purpose of this feature.

When writing multiple custom items, there may come a time where you wish to build an ability for that item, and should only be used by that same item. But to make that ability you would have to add it in the abilities directory which could lead to unorganised configuration. Now a simple solution would be to have a seperate YML file for every custom item, but this would lead to the abilities directory to be incredibly large and difficult to traverse. To combat this, you can use anonymous abilities.

What Is It?

An anonymous ability is an ability that is declared directly inside of an item. This means that the ability cannot be referenced anywhere else and that the ability has no name, making it, anonymous. Keep in mind that because it has no name and cannot be referenced, that means that it cannot be used with the ability keyword, the randomability keyword, or the innovative items execute command.

Example

An example of an anonymous ability is provided below:

test-item:
  material: 'IRON_SWORD'
  ability:
    trigger: 'right-click'
    keywords:
      - 'message(?player, ability fired!)'

Remember that this is an item configuration section, meaning you can also use any other item option you would like. This is also true for abilities, meaning that the ability field now acts as a regular ability with the only difference being it has no name, meaning you can also use conditions or any other ability feature.

Final Thoughts

Anonymous abilities give you the power to write clean and organised configuration files without the need of sifting through endless directories. This allows you easily manage and update your custom items.

Keep in mind that anonymous abilities do not add any functionality to regular abilities, the sole purpose is to write clean configuration files.