Custom Enchantments

Do you want to make custom enchantments? Don't worry, it's so easyy!

Example of custom enchantment:

package your.package;

import com.edwardbelt.edprison.enchantments.manager.obj.Enchantment;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;

public class EnchantExample extends Enchantment {

    public EnchantExample() {
        super(
                "my-enchant", // The enchant ID of enchantments.yml
                "BlockBreakEvent"  // The trigger event of the enchant
        );
    }

    /**
    *    The enchant function. You just need to put what the enchant will do.
    *    EdPrison will do the rest.
    **/
    @Override
    public void execute(Player player, Block block) {
        player.sendMessage("My custom enchant was triggered! " + getId());
    }
}

package your.package;

import location.EnchantExample;
public final class EdPrison extends JavaPlugin {

    @Override
    public void onEnable() {
        // Just create the instance on your onEnable() and it will 
        // automatically register.
        EnchantExample EnchantExample = new EnchantExample();
    }

}

Last updated