Create Custom Effects
Using AE's API for Effect Registration
To integrate custom effects into the AdvancedEnchantments system, developers must utilize the AEAPI
class from the net.advancedplugins.ae.api
package. The crucial method in this process is registerEffect
, defined in the AEAPI
class.
registerEffect
Method
registerEffect
Method/**
* Register a new effect.
*
* @param plugin Plugin that is registering the effect.
* @param effect Effect to register.
* @return true if the effect was registered, false if not.
*/
public static boolean registerEffect(JavaPlugin plugin, AdvancedEffect effect) { }
This method is pivotal for registering new effects. It requires the plugin instance and the custom effect as arguments. The method returns a boolean indicating the success or failure of the registration process.
The AdvancedEffect
Class
AdvancedEffect
ClassTo create a custom effect, developers must extend the AdvancedEffect
class. This class serves as the base for all custom effects and provides several constructors and methods to define the effect's behavior.
Constructors
The AdvancedEffect
class offers multiple constructors, allowing developers to define various aspects of their custom effect:
Basic Constructor:
public AdvancedEffect(JavaPlugin plugin, String effectName)
This constructor initializes the effect with a name.
Extended Constructor:
public AdvancedEffect(JavaPlugin plugin, String effectName, String description, String usage)
This variant allows adding a description and usage information.
Weighted Constructor:
public AdvancedEffect(JavaPlugin plugin, String effectName, String description, String usage, int weight)
Adds an additional parameter for weight, which can influence how the effect is handled or prioritized.
Methods
The AdvancedEffect
class contains methods to execute the effect:
executeEffect (LivingEntity target):
public boolean executeEffect(ExecutionTask task, LivingEntity target, String[] args) { return false; }
Triggers the effect for a living entity target.
executeEffect (Location target):
public boolean executeEffect(ExecutionTask task, Location target, String[] args) { return false; }
Activates the effect at a specific location.
Last updated
Was this helpful?