Add allow-custom-enchantments config option and null safety for missing enchantments - #60
Open
usernamevalidation wants to merge 2 commits into
Open
Add allow-custom-enchantments config option and null safety for missing enchantments#60usernamevalidation wants to merge 2 commits into
usernamevalidation wants to merge 2 commits into
Conversation
Author
|
response from bug "#59" |
Author
|
tested on a 1.21.8 server should be 1.21+ unsure if it may work for older versions |
Author
|
The build failure appears to be from the dependency submission action lacking permissions, not from my code changes. The code compiled successfully before. opt 1 change these
|
Author
|
i will also add a fix for this in the pull request or try to |
fixed "Java CI with Maven / build (pull_request)Failing after 28s" Adds if: github.event.pull_request.head.repo.full_name == github.repository to the dependency submission step. This prevents the workflow from attempting to submit dependency snapshots to the parent repository when the PR originates from a fork, which would fail due to insufficient permissions.
Author
|
should work now hopefully |
Member
|
Yeah, I think it fails on forks as it has no permission to submit. Thanks for your work, will review as soon as I can. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR adds a configurable toggle for custom enchantment support and improves null safety when enchantments are not found in the registry.
1 Added allow-custom-enchantments config option
When false (default), the "ALL" rule only applies to vanilla Minecraft enchantments
When true, the "ALL" rule applies to all enchantments including custom ones
Config option is generated automatically on first run
2 Added null safety to getEnchantment() method
Returns null instead of throwing NullPointerException when enchantment not found
3 Added null check to getMaxLevel() method
Returns OptionalInt.empty() when enchantment is null
Prevents crashes when custom enchantments are missing
4 Modified AllConfigEnchantmentEntry.enchant() method
Skips custom enchantments when allow-custom-enchantments is false
Returns null for skipped enchantments
5 Modified getConfigEnchantment() in main class
Filters out null entries from the "ALL" expansion
Uses Optional.ofNullable() to handle skipped enchantments