Cap enchantment levels
Cap or disable enchantments per world or WorldGuard region in ExyliaSurvivalCore: Sharpness II in the arena, no Knockback at spawn. Blocked items now live in ExyliaWarzone.
You will have rules that limit an enchantment's level everywhere, in chosen worlds or inside WorldGuard
regions, so for example Sharpness behaves as Sharpness II in your PvP world. The enchantments module takes
things away rather than giving them, and it does nothing until you write a rule.
Before you start#
- The module
enchantmentsmust be on inconfig.yml(Switch modules on and off). - To scope a rule to a region you need WorldGuard. Without it, rules that name regions never match and the console warns at startup.
Add a rule#
Open the rules file
Edit modules/enchantments/rules.yml. The generated header lists every enchantment on your server,
split into the two modes below, and carries commented examples. The file ships with no rules.
Write one block per enchantment
Name the enchantment by its key (sharpness, knockback; another plugin's enchantments with their
namespace, someplugin:custom) and give it at least one scope under limits.
Choose where it also applies
Under block, switch on where the enchantment may not be obtained: enchant-table, anvil,
villager, loot. Only effect is on unless you say otherwise.
Reload
Run /survivalcoreadmin reload.
A rule that caps Sharpness at 3 everywhere and removes it in the PvP world and at spawn:
rules:
sharpness:
mode: EFFECT
limits:
global:
max: 3
global: true
arena:
max: 0
worlds: [pvp]
regions: ["world:spawn"]
block:
effect: true
enchant-table: true
anvil: true
villager: true
loot: trueCheck that it works#
Hold a Sharpness V sword inside the capped area and hit a mob: it deals the damage of the capped level. Try
the anvil or an enchanting table there: the result is capped, and the player is told when
notify-blocked is on.
Going further#
Pick EFFECT or STRIP#
EFFECT(the default) leaves the item alone and lowers the level only for the instant the game reads it.STRIPlowers the level on the item while its holder stands inside the scope and puts it back when they leave (also on drop, death, storing it in a container and quitting). It works for every enchantment, at the cost of editing the item.
Sharpness, Smite, Bane of Arthropods, Impaling, Knockback, Fire Aspect, Sweeping Edge, Looting, Power,
Punch, Flame, Fortune, Silk Touch, Thorns, Protection, Fire Protection, Blast Protection, Projectile
Protection, Feather Falling, Unbreaking and Mending. For any other enchantment EFFECT only blocks getting
it, and the console warns when a rule is written that way. Use STRIP to disable the effect.
Let staff ignore the caps#
Give exyliasurvivalcore.enchantments.bypass. It ignores every rule. See
Permissions.
Where blocked items went#
The blocked items module now lives in ExyliaWarzone as banned items. See Banned items for the rules file, the scopes and the bypass node.
Rule keys and settings
| Key | What it does |
|---|---|
mode | EFFECT (default) or STRIP. An unknown value is read as EFFECT with a warning |
limits.<name>.max | The ceiling. 0 removes the enchantment entirely; leaving it out means 0 |
limits.<name>.global | Applies everywhere |
limits.<name>.worlds | Worlds it applies in, by name |
limits.<name>.regions | WorldGuard regions, as world:id. A bare id matches that id in every world |
block.effect | Whether the effect is limited at all. Default true |
block.enchant-table, anvil, villager, loot | Where it may not be obtained. Each defaults to false |
When several scopes match a player, the lowest max wins. For a combat enchantment, the location that
decides is the victim's. Capping a level on an anvil also lowers the price by the levels taken off, as
vanilla would have charged it. An item stripped in STRIP mode cannot be worked at an anvil, grindstone or
enchanting table until its owner leaves the area, so the enchantments cannot be ground back. A legacy
disabled: block is still read as a limit of 0.
modules/enchantments/config.yml, under settings::
| Setting | Default | What it does |
|---|---|---|
strip-scan-ticks | 10 | How often inventories are scanned for STRIP rules |
notify-blocked | true | Tell the player when an enchantment was removed from an enchanting table or anvil result |
Something missing on this page? Tell us on Discord