refactor!: strip shaded Adventure (Paper required for Adventure APIs)#44
Merged
Conversation
- Remove the three shaded Adventure libraries (adventure-api, adventure-platform-bukkit, adventure-text-minimessage) and the three matching shadowJar relocations - Declare adventure-api, adventure-text-minimessage, and adventure-text-serializer-legacy as compileOnly; Paper provides them at runtime, Spigot does not - Delete BukkitAudiences plumbing from BaseManager and BasePlugin - Add BasePlugin#isPaper() backed by a testable detectPaper(Function<String,Class<?>>) predicate - Isolate Adventure usage in Text behind a private static AdventureBridge nested class with a LinkageError -> UnsupportedOperationException boundary, so loading Text on Spigot does not eagerly trigger NoClassDefFoundError - Replace Text.MINI_MESSAGE field with Text.miniMessage() getter - Use ((Audience) player).sendMessage(component) in tellComponent (Paper's Player implements Audience) - Swap BukkitComponentSerializer.legacy() for LegacyComponentSerializer.legacySection() in legacySerialize - Add testImplementation entries so Adventure happy-path tests can resolve types on the build host
Calls out that Text.parseMini, Text.tellComponent, Text.miniMessage(), Text.legacySerialize, Text.legacyParseMini, and the "mini:" prefix in Text.tell/tellRaw/tellLocalized throw UnsupportedOperationException on vanilla Spigot, since Adventure is no longer shaded. - Text class-level Javadoc enumerates the six Paper-only entry points - legacyParseMini Javadoc inherits the same caveat from its delegates - BasePlugin#isPaper() Javadoc clarifies it is a downstream-facing guard (Text uses a LinkageError boundary internally) and notes the 2024 ServerBuildInfo lower bound - README and docs site call out the Paper requirement; stale upper version pin removed from docs/README.md - Drop redundant non-null assertion from TextAdventureTest (the isSameAs identity check already covers it)
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.
Summary
Modernizes Adventure handling and shrinks the shaded JAR by removing the bundled Adventure libraries. Adventure is now declared
compileOnlyand consumed from the Paper runtime instead.adventure-api,adventure-platform-bukkit, andadventure-text-minimessagefrom the fat JAR; matchingrelocate(...)rules removedBukkitAudiencesplumbing fromBaseManagerandBasePluginBasePlugin#isPaper()backed by a testabledetectPaper(Function<String, Class<?>>)predicate (looks forio.papermc.paper.ServerBuildInfo, shipped in Paper since 2024)Textbehind a nestedAdventureBridgeclass with aLinkageError -> UnsupportedOperationExceptionboundary, so loadingTexton Spigot does not eagerly triggerNoClassDefFoundErrorText.MINI_MESSAGEstatic field with aText.miniMessage()getterBukkitComponentSerializer.legacy()forLegacyComponentSerializer.legacySection()(and castsPlayertoAudiencedirectly, since Paper'sPlayerimplements it)TextAdventureTest) and Paper detection (BasePluginDetectionTest)Previously, the shaded Adventure libraries meant that
Text.parseMini,Text.tellComponent,Text.legacySerialize,Text.miniMessage(), and the"mini:"prefix inText.tell/tellRaw/tellLocalized/tellLocalizedRawworked on vanilla Spigot. After this PR they throwUnsupportedOperationExceptionon Spigot (Adventure is not provided by vanilla Spigot at runtime).Plugins that target both platforms should guard these calls with
BasePlugin#isPaper()or catchUnsupportedOperationException. All non-AdventureTextAPIs (colorize, legacy&codes, HEX, titles, broadcasts, localization, console output) remain Spigot-compatible.Documentation has been updated to call this out in
README.md,docs/README.md, anddocs/core-features/text-and-localization.md. TheTextclass itself now carries a class-level Javadoc note listing every Paper-only method.Bundled dependency bumps
This PR also bumps a number of unrelated dependency versions in
gradle/libs.versions.tomlthat were pending:spotless,errorprone-core,nmcp,spigot-api,lombok,xseries,adventure-api,mongodb-driver,jedis,guava. These are not load-bearing for the refactor itself but are bundled here to keep the version catalog moving.Test plan
./gradlew buildpasses (all modules, including new tests)TextAdventureTestexercises the happy path against Adventure on the build hostBasePluginDetectionTestcovers true/false/unrelated-class branches ofdetectPapermini:prefix andtellComponentsend styled chat as expectedTextAPIs work; Adventure methods throwUnsupportedOperationExceptionwith the documented message