-
-
Notifications
You must be signed in to change notification settings - Fork 992
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 /unlimited with changing stack sizes #4877
Merged
JRoy
merged 5 commits into
EssentialsX:2.x
from
Deltric:fix-unlimited-stack-multiplication-4819
Jul 5, 2022
Merged
Fix /unlimited with changing stack sizes #4877
JRoy
merged 5 commits into
EssentialsX:2.x
from
Deltric:fix-unlimited-stack-multiplication-4819
Jul 5, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clones the stack with a single amount instead of readding what they have left to their inventory. When the stack size is above 2 it caused a net gain in stack size which could easily fill your inventory.
pop4959
added
type: bugfix
PRs that fix bugs in EssentialsX.
module: main
Issues or PRs for the main Essentials module
labels
May 21, 2022
JRoy
approved these changes
Jul 5, 2022
JRoy
requested changes
Jul 5, 2022
Essentials/src/main/java/com/earth2me/essentials/EssentialsBlockListener.java
Outdated
Show resolved
Hide resolved
JRoy
requested changes
Jul 5, 2022
Essentials/src/main/java/com/earth2me/essentials/EssentialsBlockListener.java
Outdated
Show resolved
Hide resolved
JRoy
previously approved these changes
Jul 5, 2022
JRoy
approved these changes
Jul 5, 2022
JRoy
changed the title
Fixes stack multiplication with unlimited placement
Fix /unlimited with changing stack sizes
Jul 5, 2022
Thanks for the contribution! |
JRoy
added a commit
that referenced
this pull request
Jul 7, 2022
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
module: main
Issues or PRs for the main Essentials module
type: bugfix
PRs that fix bugs in EssentialsX.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Information
This PR fixes #4819 .
Details
Proposed fix:
Clones the ItemStack with a new quantity of 1 to readd to their inventory.
This causes no net gain in items.
Before doing so it checks if the stack is not air which is caused by the player trying to place a block with a stack size of one.
This is done to avoid an exception from setting stack size on empty and might avoid unnecessary updates.
Additionally feature behavior is unaltered as previously you still needed more than 1 block in an unlimited stack.
Environments tested:
OS: Windows 11
Java version: 17.0.1
Demonstration:
Before (Tested with EssentialsX 2.19.4 and 2.20.0-dev+4-4bd1b3c)
https://user-images.githubusercontent.com/25653276/160824043-5b329258-7938-4c22-8fdd-0de0049a1edf.mp4
After (Tested by using the compiled version with this commit)
https://user-images.githubusercontent.com/25653276/160824285-9be61d3e-0238-4647-b8e2-440fc32b569b.mp4