Register Custom Enchant

Custom Enchantment Registration Guide

This guide explains how to create and register custom enchantments using the Enchant API. Custom enchantments allow you to extend gameplay with unique effects that trigger based on player actions and configured probabilities.

Core Concepts

APIEnchant Interface

The APIEnchant interface is the foundation of all custom enchantments. It requires implementing the onProc method, which executes when the enchantment activates.

java

public interface APIEnchant {
    void onProc(Player player, EnchantData data);
}

EnchantData System

Enchantment data provides context about the activation trigger:

  • EnchantData - Abstract base class for all enchantment data

  • CustomEnchantData - Contains mob targeting information (mobId)

Step-by-Step Implementation

1. Create Your Enchantment Class

Implement the APIEnchant interface and define your enchantment's behavior:

java

2. Register Your Enchantment

Use the registerEnchant method during plugin initialization:

java

Last updated