forked from Eniripsa96/EnchantmentAPI
-
Notifications
You must be signed in to change notification settings - Fork 1
plugin integration
goflishMC edited this page Jul 1, 2025
·
1 revision
This page explains how to create a plugin addon that registers custom enchantments using the FabledEnchants API.
Your plugin must:
- Declare a dependency on
FabledEnchantsinplugin.yml - Include
FabledEnchantsin the classpath (provided scope)
depend: [FabledEnchants]Create your own enchant class:
public class Shadowstep extends CustomEnchantment {
public Shadowstep() {
super("Shadowstep", "Dash behind your target");
setMaxLevel(1);
setTableEnabled(true);
addNaturalItems(Material.DIAMOND_SWORD);
}
@Override
public void applyOnHit(LivingEntity user, LivingEntity target, int level, EntityDamageByEntityEvent event) {
user.teleport(target.getLocation().add(0, 0, -1));
}
}@Override
public void onEnable() {
EnchantmentAPI.registerCustomEnchantment(new Shadowstep());
}You can register multiple enchantments this way.
Once compiled and placed in the /plugins folder alongside FabledEnchants:
- Start your server.
- Use
/enchants add <enchant> <level>to test. - Observe expected behavior in-game.
Java/API-based enchantments are loaded on server startup. You must restart the server to add or remove them.