Skip to content

Add allow-custom-enchantments config option and null safety for missing enchantments - #60

Open
usernamevalidation wants to merge 2 commits into
cloudnode-pro:mainfrom
usernamevalidation:main
Open

Add allow-custom-enchantments config option and null safety for missing enchantments#60
usernamevalidation wants to merge 2 commits into
cloudnode-pro:mainfrom
usernamevalidation:main

Conversation

@usernamevalidation

Copy link
Copy Markdown

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

  • Logs a warning to console instead of crashing *

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

@usernamevalidation
usernamevalidation requested a review from a team as a code owner August 1, 2026 07:01
@usernamevalidation

Copy link
Copy Markdown
Author

response from bug "#59"

@usernamevalidation

Copy link
Copy Markdown
Author

tested on a 1.21.8 server should be 1.21+ unsure if it may work for older versions

@usernamevalidation

usernamevalidation commented Aug 1, 2026

Copy link
Copy Markdown
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
"

  • name: Submit dependency snapshot
    uses: advanced-security/maven-dependency-submission-action@v5
    to
  • name: Submit dependency snapshot
    if: github.event.pull_request.head.repo.full_name == github.repository
    uses: advanced-security/maven-dependency-submission-action@v5
    "
    these are suggestions
    yes im new to github take it with a grain of salt i could be yapping for no reason

@usernamevalidation

Copy link
Copy Markdown
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.
@usernamevalidation

Copy link
Copy Markdown
Author

should work now hopefully

@zefir-git

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ebp plugin v1.2.1 on purpur 1.21.8 enchantment error "PrepareAnvilEvent enchantment.getmaxlevel()"

2 participants