Enchantment Limiter
Need to make enchantments harder to get? Too many people with really high level and/or multiply-enchanted, overpowered items? Enchantment Limiter can do that for you. It does so by limiting the combination of books in anvil, and limits enchantment tables to yield only one power. When enchanting on a table, it returns a proportional number of XP levels when it removes an enchantment. Since 0.8, if it can reduce the enchantment level to one that is allowed, does that rather than removing it completely.
You can also specify enchantment combinations that are not allowed, like preventing any diamond swords from having sharpness. See configs below. Removes disallowed enchantments from spawned/dropped items, including from mobs or fishing. Or configurably disallow pickup of the item, leaving them alone for players with permissions. [New in 1.5.4] You can also restrict usage of illegal items, if player somehow gets them by other means. Set Fix held items to false.
Enforces the different ways to boost enchants with an anvil, including item+item and item with a permitted book. Also added a fail-safe to account for the Bukkit bug that sometimes permits illegal anvil enchants.
While I was at it repairing the anvil on rejected enchants, I added a new feature you can enable so anvils can never run out
Enchantment Limiter was inspired by inspired by Everyonc, and was based on code from my related plugin, Unbreakable Items.
Configuration
Default config is written to plugins/EnchLimiter/config.yml if it doesn't exist.
Message on cancel. Decides whether or not to message a player when he places a second book in an anvil and this plugin returns it to him. Default is true.
Message on limit. Decides whether or not to message a player when a second enchantment is removed from his enchantment table attempt. Informs them of returned amount of XP. Default is true.
Message on disallowed. Decides whether or not to message a player a disallowed enchantment is removed from his enchantment table attempt. Informs them of returned amount of XP. Default is true.
Message on cancel hold. Decides whether or not to message a player when denying his holding an illegally enchanted item. Default is true. [Added in 1.5.4]
Limit Multiples: If set, stops any enchantments at tables or anvils from having more than one enchantment type. Combining books not allowed. Defaults to true. [2.7]
Max Enchants Allowed: If Limit Multiples is true, allows you to change max # enchants on a single item from the default of 1.
Stop pickup: defaults false. If set, rather than removing enchants as items are picked up, players cannot pick them up. If you want to also check either anvil- and table-specific disallowed listings added in 1.4, see Apply_on_global_check below.
Restore levels: that restores XP on cancelled enchant, a feature added in 0.9. The default is different than 0.9 and is true, so the plugin normally behaves "nicely". if you want same behavior as 0.9 (to punish?) set to false. For explanation, see version history
Stop repairs: config item that allows repairing disallowed items in an anvil. Default = true 'Repairs' are defined as same items in each slot, rightmost item has no enchants, or rightmost item is raw material for left item [1.6.1]. Anything else might be an attempt to boost enchants. This does mean that some repairs won't work, such as two identically enchanted items except for wear. It's costly to repair this way; suggest repairing each tool individually.
Stop all repairs: defaults to false and if set does just that: you cannot repair anything in an anvil unless you have the new allrepairs permission.
Downgrade repairs:. Removed in 1.5.4 in favor of item below.
Downgrade in anvil: if true, downgrades result of anvil enchants rather than disallowing the action. Default is false. If attempt is caught when placing an item, chat messages are sent to the player. [new in 1.5.4]
Fix spawned items: if set to true will allow disallowed spawned items from having illegal enchants, fixing them at time of spawn. Fixing of necessity ignores any player permissions or groups. If you want to also check either anvil- and table-specific disallowed listings added in 1.4, see Apply_on_global_check below. Default false. Impacts any item "dropped" like mob drops, player drops, or fishing. This behavior used to be the case when Stop pickup was true; now you have individual control.
Infinite anvils: config item that, if true, repairs anvil whenever it is used, such that it never wears out. Default: false [In 1.3.2]
Fix held items: config item that, if true, "fixes" (removes disallowed enchants) from items placed in player's hand or [since 1.5.4] into armor slots. Default: changed to true in 1.5.4 in order to avoid Bukkit bug that sometimes misses "hold" event especially if player spams the button. This is a way of catching items that are not picked up (ex. taken from a loot chest), while still respecting player-specific permissions. It is a bit more server load since it is done every time a player changes held item. [New in 1.5.4] If false, player cannot put the illegal item in their hand (but see concern here on the default value). Also checks when equipping armor.If you want to also check either anvil- and table-specific disallowed listings added in 1.4, see Apply_on_global_check below.
Apply_on_global_check: new config node [added in 1.5.4] that allows referring to Disallowed anvil and/or table lists during item spawn, player pickup, or player hold events, respectively controlled by Fix spawned items, Stop pickup, Fix held items
- Apply_on_global_check.anvil: if true, then Disallowed anvil enchants will also be checked during those events. Default is false
- Apply_on_global_check.table: if true, then Disallowed table enchants will also be checked during those events. Default is false
- both of above can be true, if desired.
- Apply_on_global_check.restrictive: if true, the highest possible level will be used in case of conflict between Disalllowed enhants and the others. If false, the lowest enchant level will be used. Default is true.
Lore immutable string: configurable string that, if found in the lore of an item, ,causes the item to become immutable, as far as enchantments go. No more can be added [In 3.1]
Disallowed enchantments
Supports an optional configuration action to list disallowed enchantment combinations. They are of the form:
Disallowed enchants: <Item_Name>: <Enchantment_Name>: <Level> ....
Item names and enchantment names must be in ALL CAPS. Both support special "ALL" that matches every type. Item names support special "ALL_" subtypes as listed here plus standard Bukkit names. Enchantments must correspond to the standard Bukkit/Spigot names listed HERE. Note that the Bukkit enchantment names are different than the in-game names. Support a special enchantment name for new enchantments from other plugins, as long as you know the ID number, "UNKNOWN_ENCHANT_#", where the last is replaced by your ID number. I tested it against my Unbreakable Items plugin, so I know it works, but there are some caveats: [Added in 1.7]
- The plugin must add enchantments by extending org.bukkit.enchantments.Enchantment by calling registerEnchantment.
- The plugin must load before this one, so that retrieving the new enchant by ID works. You will see a warning on startup or on el reload if can't find the enchantment.
Levels are 1 or more. Blocking level n blocks n and higher, so specifying level 1 blocks all such enchants. DO NOT list all levels for the same enchant; the last one wins, so if you put level 4 last, you are only disallowing 4, not 1-3. [In 1.3.2] BOOK or ENCHANTED_BOOK are equivalent and apply to one another.
[New in 1.4] Support parallel configuration items specific to anvil or enchantment table usage, Disallowed anvil enchants and Disallowed table enchants, respectively. If an item/enchantment combination is found both in one of these and the global Disallowed enchants, the anvil/table specific settings overrides the global; this is easy to do if you use the "ALL" special names.
[New in 1.4] Furthermore support branches underneath any of the above, starting with keyword "Group_", which collect a set of disallowed enchants using that group name. Syntax under the Group_ branch is exactly as above.
- each group has an associated dynamic permission enchlimiter.Group_<name> which, if player has it, the group limits do not apply. Otherwise, the limits override the global settings (ex. so you restrict level 3 in global, but restrict to level 1 in group).
- can use same group name within each of Disallowed enchants, Disallowed anvil enchants, Disallowed table enchants
- this allows you to create special groups/classes of players that are the only ones who can perform their restricted enchants
Here is an example:
Disallowed enchants: DIAMOND_SWORD: SILK_TOUCH: 1 DAMAGE_ALL: 3 WOOD_AXE: FIRE_ASPECT: 1 ALL: DURABILITY: 2 BOW: ALL: 2 ALL_SWORDS: DAMAGE_ALL:2 UNKNOWN_ENCHANT_256: 1 ALL_ARMOR: THORNS:2 Disallowed anvil enchants: Group_smithy: ALL: ALL: 2 Disallowed table enchants: ALL_SWORDS: ALL: 3 ALL_AXES: ALL: 3 Group_weaponsmith: ALL_SWORDS: ALL: 2 ALL_AXES: ALL: 2
Permissions
Has a corresponding permission for each limitation. Use is optional: all defaults are OPerators only.
- enchlimiter.books: gives power to combine books
- enchlimiter.multiple: gives power to get multiple enchantments from one enchant in an enchantment table.
- enchlimiter.disallowed: gives power to override Disallowed enchants config.
- enchlimiter.repairs, allows repairs even if Stop repairs is true.
- enchlimiter.allrepairs, allows repairs even if Stop all repairs is true.
- enchlimiter.useillegal permits equipping/holding illegal items when Fix held items is false. [1.5.4]
- enchlimiter.el permits use of admin command. Default is Op.
- enchlimiter.elfix permits use of elfix command. Default is true. [New in 1.4]
Commands
See Command page for details.
Multiple Language Support
Supports multiple languages. See Languages and Translation page for details.
Future Ideas
- commands to modify settings [in progress],
save, and reload. - New permissions for each item/enchant combination.
- Add new Disallowed trading enchants to permit trading-specific blocking.
- World-specific configs.
Configurable # of max enchants (ex. 2 but not 3) [2.7]
Allow renaming of disallowed items. [2.7]
armor shortcuts like ALL_ARMOR_DIAMOND or ALL_ARMOR_CHAINMAIL [2.5]
ALL_BARDING doesn't work. Instead, list each of DIAMOND_BARDING, GOLD_BARDING, IRON_BARDING
New configuration that can block all repairs.
Block equipage of restricted items (ex. if config.yml recently changed and owned item now is restricted), or fix if Fix held items turned on.Turns out this is difficult because of so many ways to equip armor.[1.5.4]
Permit but downgrade/remove illegal enchants in an anvil.[1.5.4]
Allow Fix held items, Fix spawned items, Stop pickup to check more than only global Disallowed enchants listing.[1.5.4]
allow for different groups of disallowed and permitted enchants[v.1.4]
@filbert66 http://pastebin.com/ZFMBtJHs
@AyresyZ
Content of your config looks right, but are you sure it is formatted properly? YML is picky about spacing; there must be two spaces for each indent. Please send me the file itself.
Config : Message on cancel: false Message on limit: false Message on disallowed: true Message on cancel hold: false Limit Multiples: true Stop pickup: false Restore levels: true Stop repairs: true Fix spawned items: false Infinite anvils: false Fix held items: true Downgrade in anvil: false
Apply_on_global_check: anvil: false table: false restrictive: true Disallowed enchants: ALL_SWORDS: DAMAGE_ALL: 2 ALL_ARMOR: ENVIRONMENTAL_PROTECTION: 1
it won't disable me creating prot 3 or higher
@chikken001
Fixed in 1.6.1.
@HalestormXV
See version 1.7, just uploaded. But note caveats. I'm not sure how you ensure the plugin loading order outside of modifying the plugin.yml file inside each JAR. Let me know if you need some help, as I can prepare a custom JAR for you that adds a loadbefore for plugins you name.
Thank for your work.
I use Spigot 1.8.3 on my server.
I try to use "Stop all repairs", this stop repairs by combining two similar items, but not work with repairs by use materials (iron ingots for iron items).
Moreover, "stop repairs" work when a player want repair an enchanted item by use materials but the player lose his materials (required for repair) if he place a stack higher than required.
example : I place 50 iron ingots for a repair that costs 2, i lose 2 iron ingots when Enchantment Limiter stop repair. But if I place 2 iron ingots for this repair, i lose nothing.
@filbert66
Can this plugin be used to disable Mod enchantments so long as you know the ID of the mod enchantment? I ask this because some mods have broken enchants and nothing that I am aware of exists to disable enchants by ID if they are outside of the standard vanilla minecraft enchants.
@chikken001
Just uploaded 1.6 that includes new Stop all repairs feature like you asked for.
I may choose to upgrade to Spigot 1.8 before implementing your other more complicated request. What version of server do you use?
@chikken001
Hmm.. Was just looking for new feature ideas. Thanks. Specific permissions for each entering or enchant/item combination sounds complicated, but I think can be done.
As you've gathered, Stop repairs doesn't stop all repairs, only repairs of disallowed enchants. Wouldn't be hard to make a new config that stops all repairs, regardless.
Hello,
i would like to know if in a future version there will be more permisions ? Like :
For example, for give power to override just certain restrictions for an enchant or an item. I would also like to disallow anvil repair for all items. All for more opportunities for interactions with jobs plugins.
Thank you for your reply.
@PedoPedo
Please use standard Bukkit names for enchantments: PROTECTION -> PROTECTION_ENVIRONMENTAL SHARPNESS -> DAMAGE_ALL
Had to fix URLs to dead bukkit.org to spigotmc.
Hi, can you tell me how to configure this? Because I can't seem to disallow the enchantment.
This is my config right now
http://pastebin.com/7cCGqp1v
@ircopdd
OK, confirmed fixed in 1.5. Released today as 1.5.4.
Now approved (9 days later)!
https://www.youtube.com/watch?v=LaQjYXvZcQA
this bug only work for other languages
and push any num 1 or 2 or 3
can work
my config
http://dev.bukkit.org/paste/10509/
i enchant ARROW_INFINITE
but push num 1 can be dupe item
@ircopdd
Please provide more details. Submit a ticket w your comfig.yml, and what inventory window is open when you are pressing 1,
Enchantment Limiter 1.4
can be dupe item....
Hold down the num 1
bukkit 1.7.2 r0.3
Submitted version 1.4, which includes many new features, such as requested/inspired by @pepper82 @PatchyKnowly
Significant new features & configuration items, which I explain above.
Already at work onSubmitted version 1.3.2 with testing help from PatchyKnowly. Some bugs and exploits fixed, plus new config Infinite anvils!Once available, recommend everybody upgrade to this. There is an illegal item duplication bug that was fixed.
@filbert66
No, all woks. But in other plugins languages implemented easier. And without use additional plugins.
@Meowt
Sorry, for which lines/keywords did translations did not work? Maybe you can place your response on theTranslations page and I can fix the issue.