AdvancedEnchantments
Get AdvancedEnchantmentsJoin DiscordUnlimited Minecraft Hosting
  • AdvancedEnchantments
  • ➡️AdvancedEnchantments UI
  • 🪄Enchantments
    • 📑List of Enchantments
      • Default Enchants (250+)
      • Cosmic Enchants (200+)
      • Vanilla+ Custom Enchants (60+)
    • Creating Enchantments
      • Triggers
      • Effects
      • Area of Effect
      • Settings
      • Effect Info
      • Complex Enchantments
    • Enchantment Conditions
    • ⏱️Repeating Enchantments
  • ℹ️General Information
    • Commands & Permissions
      • AEGive
    • Languages and Localization
    • 🔩Plugin Items
      • All plugin items
      • Item Configuration
      • Slot Increasers
    • Toggling Features
  • ⚙️Configuration
    • Random Loot, Villager Trades and Mob Drops
    • Default Files
    • Enchanter
    • Souls
    • Unsuccessful enchants
    • Per-Level Descriptions
    • Per-Level Books
    • Enchantments In Essentials Kits
    • GKits
      • GKit Permissions
      • Colored Leather Armor
    • Armor Sets
    • Drag&Drop books onto Player Heads
    • Groups
  • 💻For developers
    • Plugin API
    • Create Custom Effects
    • Plugin Compatiblity issues
  • Plugin Information
    • PlaceholderAPI placeholders
    • FAQ & Other Plugin Support
Powered by GitBook
On this page
  • Using AE's API for Effect Registration
  • The AdvancedEffect Class

Was this helpful?

  1. For developers

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

/**
 * 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

To 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:

  1. Basic Constructor:

    public AdvancedEffect(JavaPlugin plugin, String effectName) 

    This constructor initializes the effect with a name.

  2. Extended Constructor:

    public AdvancedEffect(JavaPlugin plugin, String effectName, String description, String usage)

    This variant allows adding a description and usage information.

  3. 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:

  1. executeEffect (LivingEntity target):

    public boolean executeEffect(ExecutionTask task, LivingEntity target, String[] args) {
        return false;
    }

    Triggers the effect for a living entity target.

  2. executeEffect (Location target):

    public boolean executeEffect(ExecutionTask task, Location target, String[] args) {
        return false;
    }

    Activates the effect at a specific location.

PreviousPlugin APINextPlugin Compatiblity issues

Last updated 1 year ago

Was this helpful?

💻