Skip to content

Fix reward kit redemption for items with multiple enchants#2

Merged
iphonetips1 merged 1 commit into
masterfrom
codex/linear-mention-3pdev-212-axrewards-reward-kits-break-with-3fefce
Mar 29, 2026
Merged

Fix reward kit redemption for items with multiple enchants#2
iphonetips1 merged 1 commit into
masterfrom
codex/linear-mention-3pdev-212-axrewards-reward-kits-break-with-3fefce

Conversation

@iphonetips1
Copy link
Copy Markdown

Motivation

  • Reward kits failed to redeem when an item contained multiple enchants due to the AxAPI enchant conversion path throwing Cannot convert direct holder to bukkit representation on newer Paper/Purpur (1.21) builds.
  • The change aims to avoid the broken conversion path by normalizing and extracting enchant data before item construction and applying Bukkit enchantments directly.

Description

  • Extract enchant entries from the normalized claim-items map for both enchants and enchantments keys and remove them from the map prior to calling ItemBuilder.create(...).
  • Add robust parsing that accepts map, list, and key:level string forms and resolves both namespaced IDs and legacy enchant names via NamespacedKey and Enchantment.getByName(...).
  • Apply parsed Enchantment -> level pairs directly to the resulting ItemStack using addUnsafeEnchantment(...) to avoid the AxAPI conversion path that crashes on 1.21.
  • Implement helper methods extractEnchantments, addEnchantmentsFromValue, addParsedEnchantment, resolveEnchantment, and applyEnchantments in RewardGui to encapsulate the logic.

Testing

  • Ran mvn -q -DskipTests compile, which failed in this environment due to Maven Central returning HTTP 403 so full compile validation could not complete.
  • Ran git status --short which succeeded and committed the change with git commit.
  • No automated runtime tests were available in this environment to reproduce the original crash, but the change targets the known conversion path causing the IllegalArgumentException.

Codex Task

@iphonetips1 iphonetips1 merged commit 26e9ff9 into master Mar 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant