Skip to content
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

don't consume bookbinder inputs if the output is worse than the input #3925

Merged
merged 3 commits into from
Nov 21, 2023

Conversation

iTwins
Copy link
Contributor

@iTwins iTwins commented Jul 29, 2023

Description

The bookbinder used to accept any book and just reset any level higher that the configured max back to the max.
For example protection 10 + protection 10 = protection 4

Proposed changes

If any of the books contains an enchantment level higher than the configured max: don't consume the items
If the output would be the same any of the inputs: don't consume the items

Related Issues (if applicable)

Resolves #3247

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • I added sufficient Unit Tests to cover my code.

@iTwins iTwins requested a review from a team as a code owner July 29, 2023 14:06
@github-actions
Copy link
Contributor

Your Pull Request was automatically labelled as: "✨ Fix"
Thank you for contributing to this project! ❤️

@github-actions github-actions bot added the ✨ Fix This Pull Request fixes an issue. label Jul 29, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 29, 2023

Slimefun preview build

A Slimefun preview build is available for testing!
Commit: d0dc0e85

https://preview-builds.walshy.dev/download/Slimefun/3925/d0dc0e85

Note: This is not a supported build and is only here for the purposes of testing.
Do not run this on a live server and do not report bugs anywhere but this PR!

@J3fftw1 J3fftw1 added the 🎯 Needs testing This Issue needs to be tested by our team to see if it can be reproduced. label Jul 29, 2023
J3fftw1
J3fftw1 previously approved these changes Jul 29, 2023
Copy link
Contributor

@J3fftw1 J3fftw1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM to just need to be tested then its ready to merge imo

@J3fftw1
Copy link
Contributor

J3fftw1 commented Jul 29, 2023

is this PR not the same as #3299?

@iTwins
Copy link
Contributor Author

iTwins commented Jul 29, 2023

is this PR not the same as #3299?

No it is not. i just tested the changes in that build and it did not work (prot 10 + prot 4 = prot 4). It also has some other problems like returning null when a method is annotated as @Nonnull and not covering other edge cases.

@variananora
Copy link
Member

Tested in 1.20.1 and it works flawlessly.

@variananora variananora added Build tested Used to indicate the PR preview build has been tested by one of the team and removed 🎯 Needs testing This Issue needs to be tested by our team to see if it can be reproduced. labels Jul 31, 2023
@J3fftw1 J3fftw1 mentioned this pull request Aug 5, 2023
6 tasks
@WalshyDev WalshyDev merged commit 52f5a14 into Slimefun:master Nov 21, 2023
13 checks passed
@iTwins iTwins deleted the fix/bookbinder_downgrading_enchants branch November 21, 2023 20:12
StarWishsama pushed a commit to SlimefunGuguProject/Slimefun4 that referenced this pull request Dec 4, 2023
* e2e testing initial

* Setup matrix

* Download tester

* Jeff's changes

* capitalized Chosen

* Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.1

* fix breaking sf block with not unlocked item duping contents (Slimefun#3976)

* [CI skip] Update actions/setup-java action to v3.13.0

* [CI skip] Update dependency me.clip:placeholderapi to v2.11.4

* [CI skip] Update actions/checkout action to v4

* [CI skip] Update dependency com.github.LoneDev6:itemsadder-api to v3.5.0c-r5

* [CI skip] Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.6.0

* [CI skip] Update dependency org.sonarsource.scanner.maven:sonar-maven-plugin to v3.10.0.2594

* [CI skip] Update dependency com.sk89q.worldedit:worldedit-core to v7.2.16

* [CI skip] Update dependency com.sk89q.worldedit:worldedit-bukkit to v7.2.16

* [CI skip] Update dependency com.gmail.nossr50.mcMMO:mcMMO to v2.1.224

* [CI skip] Update dependency org.mockito:mockito-core to v5.6.0

* updated dough version (Slimefun#3991)

* [CI skip] Update dependency com.github.LoneDev6:itemsadder-api to v3.6.1

* [CI skip] Update dependency com.sk89q.worldedit:worldedit-core to v7.2.17

* [CI skip] Update dependency com.sk89q.worldedit:worldedit-bukkit to v7.2.17

* [CI skip] Update dependency com.gmail.nossr50.mcMMO:mcMMO to v2.1.225

* [CI skip] Update dependency org.jacoco:jacoco-maven-plugin to v0.8.11

* [CI skip] Update actions/checkout action to v4.1.1

* [CI skip] Update thollander/actions-comment-pull-request action to v2.4.3

* [CI skip] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.2.1

* [CI skip] Update dependency me.clip:placeholderapi to v2.11.5

* Update .github/workflows/e2e-testing.yml

* Update .github/workflows/e2e-testing.yml

* Update .github/workflows/e2e-testing.yml

* Update .github/workflows/e2e-testing.yml

* Add MultiBlockCraftEvent (Updated version of Slimefun#3439) (Slimefun#3928)

* fix taking damage on head collision while wearing elytra cap (Slimefun#3760)

* Remove Lore Check from Slimefun Guide (Slimefun#3969)

* don't consume bookbinder inputs if the output is worse than the input (Slimefun#3925)

Co-authored-by: Jeroen <[email protected]>

* Update .github/workflows/e2e-testing.yml

* Update .github/workflows/e2e-testing.yml

* fix heads showing as steve (Slimefun#4027)

* fix: clean up issues after merging

* chore(style): apply code style

---------

Co-authored-by: Jeffrey <[email protected]>
Co-authored-by: Daniel Walsh <[email protected]>
Co-authored-by: iTwins <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jeroen <[email protected]>
Co-authored-by: TheBusyBiscuit <[email protected]>
Co-authored-by: J3fftw <[email protected]>
Co-authored-by: JustAHuman-xD <[email protected]>
Co-authored-by: Jeroen <[email protected]>
Co-authored-by: Alessio Colombo <[email protected]>
StarWishsama pushed a commit to SlimefunGuguProject/Slimefun4 that referenced this pull request Jan 1, 2024
* e2e testing initial

* Setup matrix

* Download tester

* Jeff's changes

* capitalized Chosen

* Update dependency org.apache.maven.plugins:maven-shade-plugin to v3.5.1

* fix breaking sf block with not unlocked item duping contents (Slimefun#3976)

* [CI skip] Update actions/setup-java action to v3.13.0

* [CI skip] Update dependency me.clip:placeholderapi to v2.11.4

* [CI skip] Update actions/checkout action to v4

* [CI skip] Update dependency com.github.LoneDev6:itemsadder-api to v3.5.0c-r5

* [CI skip] Update dependency org.apache.maven.plugins:maven-javadoc-plugin to v3.6.0

* [CI skip] Update dependency org.sonarsource.scanner.maven:sonar-maven-plugin to v3.10.0.2594

* [CI skip] Update dependency com.sk89q.worldedit:worldedit-core to v7.2.16

* [CI skip] Update dependency com.sk89q.worldedit:worldedit-bukkit to v7.2.16

* [CI skip] Update dependency com.gmail.nossr50.mcMMO:mcMMO to v2.1.224

* [CI skip] Update dependency org.mockito:mockito-core to v5.6.0

* updated dough version (Slimefun#3991)

* [CI skip] Update dependency com.github.LoneDev6:itemsadder-api to v3.6.1

* [CI skip] Update dependency com.sk89q.worldedit:worldedit-core to v7.2.17

* [CI skip] Update dependency com.sk89q.worldedit:worldedit-bukkit to v7.2.17

* [CI skip] Update dependency com.gmail.nossr50.mcMMO:mcMMO to v2.1.225

* [CI skip] Update dependency org.jacoco:jacoco-maven-plugin to v0.8.11

* [CI skip] Update actions/checkout action to v4.1.1

* [CI skip] Update thollander/actions-comment-pull-request action to v2.4.3

* [CI skip] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.2.1

* [CI skip] Update dependency me.clip:placeholderapi to v2.11.5

* Update .github/workflows/e2e-testing.yml

* Update .github/workflows/e2e-testing.yml

* Update .github/workflows/e2e-testing.yml

* Update .github/workflows/e2e-testing.yml

* Add MultiBlockCraftEvent (Updated version of Slimefun#3439) (Slimefun#3928)

* fix taking damage on head collision while wearing elytra cap (Slimefun#3760)

* Remove Lore Check from Slimefun Guide (Slimefun#3969)

* don't consume bookbinder inputs if the output is worse than the input (Slimefun#3925)

Co-authored-by: Jeroen <[email protected]>

* Update .github/workflows/e2e-testing.yml

* Update .github/workflows/e2e-testing.yml

* fix heads showing as steve (Slimefun#4027)

* fix: clean up issues after merging

* chore(style): apply code style

---------

Co-authored-by: Jeffrey <[email protected]>
Co-authored-by: Daniel Walsh <[email protected]>
Co-authored-by: iTwins <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jeroen <[email protected]>
Co-authored-by: TheBusyBiscuit <[email protected]>
Co-authored-by: J3fftw <[email protected]>
Co-authored-by: JustAHuman-xD <[email protected]>
Co-authored-by: Jeroen <[email protected]>
Co-authored-by: Alessio Colombo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build tested Used to indicate the PR preview build has been tested by one of the team ✨ Fix This Pull Request fixes an issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Book Binder reverts the enchantment level to maximal on the config
6 participants