Skip to content

Create a PaperMC Custom Enchantment with Reedwork in 5 Minutes

By the end of this tutorial, you will have a custom PaperMC enchantment that is automatically discovered and registered by Reedwork.

First, add Reedwork to your Paper plugin project.


Unlike commands and event listeners, custom enchantments are registered through Paper’s registry system during the bootstrap phase.

Create a PluginBootstrap implementation:

  • Directorysrc/main/java/
    • Directorydev.reedworkmc.examples.fiveminuteenchantment
      • FiveMinuteEnchantment.java
      • FiveMinuteEnchantmentBootstrap.java
FiveMinuteEnchantmentBootstrap.java
package dev.reedworkmc.examples.fiveminuteenchantment;
import dev.reedworkmc.reedwork.Reedwork;
import io.papermc.paper.plugin.bootstrap.BootstrapContext;
import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
class FiveMinuteEnchantmentBootstrap implements PluginBootstrap {
@Override
public void bootstrap(final BootstrapContext context) {
// Plugin bootstrap logic
Reedwork.bootstrap(context).scan("dev.reedworkmc.examples.fiveminuteenchantment");
}
}

The bootstrapper is executed during Paper’s bootstrap phase, before the plugin is fully enabled.

It initializes Reedwork and scans the specified package for Reedwork components:

Reedwork.bootstrap(context)
.scan("dev.reedworkmc.examples.fiveminuteenchantment");

Your paper-plugin.yml must reference the bootstrapper:

paper-plugin.yml
name: FiveMinuteEnchantment
version: '${version}'
main: dev.reedworkmc.examples.fiveminuteenchantment.FiveMinuteEnchantment
bootstrapper: dev.reedworkmc.examples.fiveminuteenchantment.FiveMinuteEnchantmentBootstrap
api-version: '26.2'
load: POSTWORLD

This allows Paper to execute FiveMinuteEnchantmentBootstrap during the bootstrap phase.

Because the enchantment is located below the scanned package, Reedwork automatically discovers it.


Create an enchantments package:

  • Directorysrc/main/java/
    • Directorydev.reedworkmc.examples.fiveminuteenchantment
      • FiveMinuteEnchantment.java
      • FiveMinuteEnchantmentBootstrap.java
      • Directoryenchantments
        • ReedworkEnchantment.java

Create ReedworkEnchantment:

ReedworkEnchantment.java
package dev.reedworkmc.examples.fiveminuteenchantment.enchantments;
import dev.reedworkmc.reedwork.annotation.Enchantment;
import dev.reedworkmc.reedwork.enchantment.CustomEnchantment;
import io.papermc.paper.registry.data.EnchantmentRegistryEntry;
import io.papermc.paper.registry.keys.tags.ItemTypeTagKeys;
import io.papermc.paper.registry.tag.TagKey;
import net.kyori.adventure.text.Component;
import org.bukkit.inventory.EquipmentSlotGroup;
import org.bukkit.inventory.ItemType;
@Enchantment("reedworkinfiveminutes")
public class ReedworkEnchantment implements CustomEnchantment {
@Override
public Component description() {
return Component.text("Reedwork in 5 Minutes");
}
@Override
public TagKey<ItemType> supportedItems() {
return ItemTypeTagKeys.ENCHANTABLE_ARMOR;
}
@Override
public int anvilCost() {
return 1;
}
@Override
public int maxLevel() {
return 1;
}
@Override
public int weight() {
return 1;
}
@Override
public EnchantmentRegistryEntry.EnchantmentCost minimumCost() {
return EnchantmentRegistryEntry.EnchantmentCost.of(1, 5);
}
@Override
public EnchantmentRegistryEntry.EnchantmentCost maximumCost() {
return EnchantmentRegistryEntry.EnchantmentCost.of(1, 7);
}
@Override
public EquipmentSlotGroup activeSlots() {
return EquipmentSlotGroup.ARMOR;
}
}

The class is marked with:

@Enchantment("reedworkinfiveminutes")

This tells Reedwork that the class defines a custom enchantment and uses reedworkinfiveminutes as its registry key.

The class implements CustomEnchantment:

public class ReedworkEnchantment implements CustomEnchantment

CustomEnchantment provides the properties used to define the enchantment.


The description is defined using:

@Override
public Component description() {
return Component.text("Reedwork in 5 Minutes");
}

This is the name displayed for the enchantment.


The enchantment uses:

@Override
public TagKey<ItemType> supportedItems() {
return ItemTypeTagKeys.ENCHANTABLE_ARMOR;
}

This means the enchantment is available for items belonging to Paper’s ENCHANTABLE_ARMOR item tag.


The enchantment has a maximum level of 1:

@Override
public int maxLevel() {
return 1;
}

Therefore, the enchantment only has one level.


The example defines an anvil cost of 1:

@Override
public int anvilCost() {
return 1;
}

Its weight is also 1:

@Override
public int weight() {
return 1;
}

These values are part of the enchantment’s Paper registry configuration.


The minimum and maximum enchantment costs are defined using Paper’s EnchantmentCost:

@Override
public EnchantmentRegistryEntry.EnchantmentCost minimumCost() {
return EnchantmentRegistryEntry.EnchantmentCost.of(1, 5);
}
@Override
public EnchantmentRegistryEntry.EnchantmentCost maximumCost() {
return EnchantmentRegistryEntry.EnchantmentCost.of(1, 7);
}

This defines the cost range used by the enchantment.


Finally, the enchantment is active on armor slots:

@Override
public EquipmentSlotGroup activeSlots() {
return EquipmentSlotGroup.ARMOR;
}

This tells Paper which equipment slots the enchantment applies to.


Build your plugin:

Terminal window
mvn clean package

Copy the resulting JAR from target/ into the plugins/ directory of your Paper server.

Start the server.

During the Paper bootstrap phase, Reedwork scans:

dev.reedworkmc.examples.fiveminuteenchantment

and automatically discovers ReedworkEnchantment.

The enchantment is registered with the key:

minecraft:reedworkinfiveminutes

The enchantment is available as an enchanted book in the Creative Inventory and can be applied to items supported by ENCHANTABLE_ARMOR.

To test the enchantment, hold an applicable item in your main hand and execute:

/enchant @s minecraft:reedworkinfiveminutes

That’s it — you have created a custom PaperMC enchantment with Reedwork without manually registering it with Paper’s registry system.

In just a few minutes, you learned how to:

  • Add Reedwork to a PaperMC plugin
  • Initialize Reedwork during Paper’s bootstrap phase
  • Scan your plugin package
  • Create a custom enchantment with @Enchantment
  • Implement CustomEnchantment
  • Define supported items and active equipment slots
  • Configure the enchantment level, weight, anvil cost, and enchantment costs
  • Let Reedwork automatically discover and register the enchantment

Now that you have created your first custom enchantment, explore what else Reedwork can do.

Check out the enchantment documentation for more advanced features, or continue with: