GC-spigot / AdvancedEnchantments

Superior Custom Enchantments Creator for Minecraft And Spigot platform
139 stars 61 forks source link

Anvils do not respect AnvilInventory#setMaximumRepairCost #4274

Closed Leomelonseeds closed 1 month ago

Leomelonseeds commented 1 month ago

Describe the bug

Certain plugins such as AuraSkills (formerly known as Aurelium Skills) use the AnvilInventory#setMaximumRepairCost to bypass the vanilla limit of 40 levels for anvil repairs. AdvancedEnchantments seems to not respect this, and disallows enchanting anyways. The relevant method in AuraSkills is here: https://github.com/Archy-X/AuraSkills/blob/c14e55960a7c22efe0cc047e4594d7a4f7809b9e/bukkit/src/main/java/dev/aurelium/auraskills/bukkit/skills/enchanting/EnchantingAbilities.java#L167

How to reproduce

Either code a custom plugin that sets the maximum repair cost to >40 levels, or:

  1. Install the AuraSkills plugin from https://www.spigotmc.org/resources/auraskills-formerly-aurelium-skills.81069/
  2. Run /skills skill setlevel [player] enchanting 100. This allows you to use a passive ability called Anvil Master, supposedly increasing the maximum repair cost to 100 levels.
  3. Attempt to enchant a sword too many times in survival mode. A good way to do this is take an enchant such as Sharpness, and apply books with levels 1, 1, 2, 3, 4, 5 in that order, and repeat with other enchants.
  4. The anvil will show "Too Expensive!" at 40 levels and have no result item. Normally, the "Too Expensive" text would still be displayed, but there will still be a resulting item you can take, and the corresponding levels will still be subtracted.

Screenshots / Videos

On a server with AuraSkills and no AdvancedEnchantments: image This enchant costs 50 levels when displayed in creative mode. In survival, the item can still be taken, and I am left with 50 levels of experience, from 100.

On a server with AuraSkills and AdvancedEnchantments: image This was done using the exact same enchants and enchanting order. It should still cost 50 levels, but it won't display a resulting item anymore.

"/ae plinfo" link

https://paste.md-5.net/apagacukil

Server Log

No response

ThomasWega commented 1 month ago

This is most likely true. I'll still test it just to make sure, but yeah, I can see that happening. If so, we'll fix that

ThomasWega commented 1 month ago

Should be fixed in the next update! I am not sure about the Too Expensive text, that might be client side, but it should now use the maxRepairCost set on the event