-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix possible custom enchantment duplication #3864
Conversation
...usybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java
Outdated
Show resolved
Hide resolved
Co-authored-by: svr333 <[email protected]>
...usybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java
Outdated
Show resolved
Hide resolved
...usybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java
Outdated
Show resolved
Hide resolved
Co-authored-by: JustAHuman-xD <[email protected]>
...usybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Phoenix-Starlight <[email protected]>
...usybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java
Outdated
Show resolved
Hide resolved
...usybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java
Outdated
Show resolved
Hide resolved
meta.addStoredEnchant(entry.getKey(), entry.getValue(), true); | ||
} else { | ||
// Get Enchantment Name | ||
Slimefun.logger().log(Level.SEVERE, "AutoDisenchanter has failed to remove enchantment \"{0}\"", entry.getKey().getKey().getKey()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we log the location as well for if its gonna spam this in console the admins can look into it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's needed as if it happens it's most likely going to happen for everyone.
Also not sure how I would get the location from inside the method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think we should log the location.
Because something is likely to happen doesnt mean it will always happen.
not sure exactly how we can get the location tho.
so maybe scrap that idea or if others know please comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with Jeff's comments, other than that everything looks fine.
I am not marking this as approved yet as once you push your changes we will get a new temporary build automatically and can test in 1.20 too, since you mentioned you only tested in 1.19.2
...usybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java
Outdated
Show resolved
Hide resolved
Slimefun preview buildA Slimefun preview build is available for testing! https://preview-builds.walshy.dev/download/Slimefun/3864/5401793866
|
Using the preview build I have tested with both Spigot and Paper 1.20.1 and can confirm works normally. |
Description
This PR fixes a possible duplication of custom enchantments due to inconsistencies in the
removeEnchantment
method of classItemStack
between Spigot and Paper due to Paper Server Patch 0069.Has been tested on Spigot and Paper 1.19.2 only.
Proposed changes
Changed to method
removeEnchant
of classItemMeta
from the methodremoveEnchantment
of classItemStack
, by also moving theitem.setItemMeta(itemMeta)
after the for loop.Added a check and logger in hopes to prevent future enchantment duplication.
Related Issues (if applicable)
Resolves #3837
Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values