Skip to content

Fix /unlimited with changing stack sizes - #4877

Merged
JRoy merged 5 commits into
EssentialsX:2.xfrom
Deltric:fix-unlimited-stack-multiplication-4819
Jul 5, 2022
Merged

Fix /unlimited with changing stack sizes#4877
JRoy merged 5 commits into
EssentialsX:2.xfrom
Deltric:fix-unlimited-stack-multiplication-4819

Conversation

@Deltric

Copy link
Copy Markdown
Contributor

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

  • Most recent Paper version (1.XX.Y, git-Paper-BUILD)
  • CraftBukkit/Spigot/Paper 1.12.2
  • CraftBukkit 1.8.8

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

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.
@pop4959pop4959 added type: bugfix PRs that fix bugs in EssentialsX. module: main Issues or PRs for the main Essentials module labels May 21, 2022
JRoy
JRoy approved these changes Jul 5, 2022
@JRoy
JRoy self-requested a review July 5, 2022 16:49
@JRoy
JRoy self-requested a review July 5, 2022 16:54
JRoy
JRoy previously approved these changes Jul 5, 2022
JRoy
JRoy approved these changes Jul 5, 2022
@JRoyJRoy changed the title Fixes stack multiplication with unlimited placementFix /unlimited with changing stack sizesJul 5, 2022
@JRoy
JRoy enabled auto-merge (squash) July 5, 2022 16:59
@JRoy
JRoy merged commit 2bba577 into EssentialsX:2.xJul 5, 2022
@JRoy

JRoy commented Jul 5, 2022

Copy link
Copy Markdown
Member

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>
@mdcfemdcfe added this to the 2.19.5 milestone Aug 11, 2022
ressidell pushed a commit to ressidell/Essentials that referenced this pull request Apr 27, 2025
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
rewsdjad1 pushed a commit to rewsdjad1/EssentialsXPlus that referenced this pull request Aug 13, 2026
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: mainIssues or PRs for the main Essentials moduletype: bugfixPRs that fix bugs in EssentialsX.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/unlimited broken

4 participants

@Deltric@JRoy@mdcfe@pop4959