PaperMC / PaperMC/Paper

API to disable specific enchantments server-side

Open
#13,085 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Is your feature request related to a problem?

Server owners and plugin developers often want to disable specific enchantments (for example Frost Walker, Mending, or custom ones) for gameplay balance or grief-prevention reasons.

Historically, plugins could reflect into Bukkit’s internal enchantment registry to remove entries, but since 1.20 this registry is immutable. This means there is now no safe, supported way to disable enchantments without writing large amounts of boilerplate to intercept every possible source (enchanting tables, anvils, villager trades, loot, commands, and the enchantment’s own effect).

Describe the solution you'd like.

An official API to disable enchantments, without reflection.
For example:

  • A server-managed set of disabled enchantments:
    server.disableEnchantment(Enchantment.FROST_WALKER);
  • Or an isEnabled(Server) method on Enchantment that Paper checks internally before:
    • Offering enchantments in tables
    • Applying them in anvils
    • Generating them in villager trades and loot
    • Executing /enchant
    • Triggering special effects (like Frost Walker ice)
Describe alternatives you've considered.
  • Event interception and stripping: intercepting PrepareItemEnchantEvent, EnchantItemEvent, PrepareAnvilEvent, VillagerAcquireTradeEvent, LootGenerateEvent, and command preprocess events, then removing blocked enchantments. This works, but it is very verbose, fragile, and requires continuous maintenance to cover new pathways.

  • Reflection hacks: editing the internal enchantment registry directly. This worked in older versions but no longer works after the registry was made immutable.

Other

This API would remove the need for brittle reflection hacks, reduce plugin boilerplate. It also keeps the registry immutable (which I understand why probably wont be reverted) while still giving server owners control over which enchantments are available.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by tracing the listed pathways—enchanting tables, anvils, villager trades, loot, /enchant, and enchantment effects—and review the referenced event interception alternatives. Done means a supported server-side mechanism consistently disables selected enchantments across those pathways without reflection.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.