Skip to content

Replace APIs deprecated for removal in MenuItem - #317

Open
entity wants to merge 1 commit into
HelpChat:mainfrom
entity:cleanup/deprecated-for-removal-apis
Open

entity wants to merge 1 commit into
HelpChat:mainfrom
entity:cleanup/deprecated-for-removal-apis

Conversation

@entity

@entity entity commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

This removes the three [removal] deprecation warnings in the current build. Paper has marked these APIs for removal, so they'll break on a future API version.

Changes (MenuItem)

  • Registry.TRIM_MATERIAL.match(...) / Registry.TRIM_PATTERN.match(...) → RegistryUtils.byNameOrKey(...), the helper added in Migrate from Spigot to Paper! #228. The input goes through the same normalization match() applied (lowercase, whitespace → _), so configured trim_material / trim_pattern values resolve exactly as before.
  • Enchantment#getName() in a debug message → Enchantment#getKey().

Testing

  • ./gradlew build reports no more [removal] warnings.
  • On a Paper 26.2 (build 112) server, a test plugin compared Registry#match(input) with RegistryUtils.byNameOrKey(registry, normalize(input)) for every trim material and trim pattern. Each was tried in several spellings: value, minecraft:value, VALUE, Minecraft:VALUE, value with spaces instead of underscores, a leading space, and invalid inputs. Results: 71 + 113 inputs, 0 mismatches.
  • The plugin still boots, loads its menus and reloads.

- Registry#match (trim material / trim pattern) is deprecated for removal. Resolve
  through RegistryUtils#byNameOrKey instead, applying the same input
  normalization match() used (lower case, whitespace to underscores) so
  configured values keep resolving identically.
- Enchantment#getName is deprecated for removal; log the enchantment's key.
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.

1 participant