Skip to content

Implement 1.21.11/26.1 mutliversion support with nice generator#311

Draft
Copilot wants to merge 29 commits intoversion/26.1from
copilot/add-multiversion-support-nms
Draft

Implement 1.21.11/26.1 mutliversion support with nice generator#311
Copilot wants to merge 29 commits intoversion/26.1from
copilot/add-multiversion-support-nms

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

  • Diagnose the UninitializedPropertyAccessException on V1_21_11SurfPaperNmsGlowingBridgeImpl.INSTANCE
  • Fix V1_21_11NmsProvider: cache glowing bridge, ensure it's created before glowing API
  • Fix V26_1NmsProvider: same pattern
  • Run validation

Copilot AI and others added 6 commits April 13, 2026 20:09
Implements the NmsProvider interface with version-specific bridge
factories, packet listeners, reflection initialization, and
ServiceLoader discovery via @autoservice.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
Create all 39 V26_1 versioned NMS implementation files adapted from
the paper-server source files:

- Extensions: nms-extensions.kt, AdventureNBT.kt (package change only)
- Bridge implementations: 9 bridge classes with V26_1 prefix
- Packet operations & bridges: PacketOperationImpl, PacketBridgesImpl,
  block/entity/player packet implementations
- Packet listener implementations: NmsPacketImpl, PacketRegistry,
  clientbound/serverbound packet wrappers
- Glowing system: GlowingPacketListener, TeamData, BlockGlowingData
- Packet lore: PacketLoreListener
- Reflection: Reflection object with initialize() method, 5 proxy interfaces
- Region: TickThreadGuard

All files follow the V26_1 naming convention:
- Package: dev.slne.surf.api.paper.server.nms.v26_1.*
- Class names prefixed with V26_1
- @autoservice annotations removed (registered via NmsProvider)
- checkInstantiationByServiceLoader() calls removed
- Internal cross-references updated to V26_1 prefixed names

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
- Create surf-api-paper-nms-common module with NmsVersion, NmsProvider, NmsPacketBridgeHandler
- Create surf-api-paper-nms-v26-1 module with all 26.1 NMS implementations
- Create surf-api-paper-nms-v1-21-11 module with skeleton NmsProvider (TODO implementations)
- Add proxy bridge implementations in surf-api-paper-server delegating to NmsProvider
- Register new modules in settings.gradle.kts

Agent-Logs-Url: https://github.com/SLNE-Development/surf-api/sessions/3048aef9-7f6a-422b-82bf-1b0453b10e0d

Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
- Fix V26_1 files to use own data classes instead of server.impl references
- Create EntityGlowingData, EntityPlayerData, BlockPlayerData in v26_1 glow packages
- Update PlayerChannelInjector to use NmsPacketBridgeHandler
- Update PacketApiLoader to use NmsProvider for packet listeners
- Update PaperInstance to remove direct Reflection init (moved to NmsProvider.initialize())
- Add PacketLoreRegistry and GlowingLifecycleHandler interfaces
- Update SurfPaperPacketApiImpl, PluginDisablePacketLoreListener, GlowingListener to use NmsProvider
- Update V26_1NmsProvider and V1_21_11NmsProvider with new factory methods

Agent-Logs-Url: https://github.com/SLNE-Development/surf-api/sessions/b4c8c86c-2741-4ab8-aae6-f9f6995c0e54

Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
- Remove SurfPaperNmsBridgeProxy (SurfPaperNmsBridgeImpl is version-agnostic, no proxy needed)
- Remove @autoservice from 16 old bridge implementations that now have proxies
- Keep SurfPaperNmsBridgeImpl with @autoservice as it handles listener dispatching
- Old impl classes remain as dead code for now (can be cleaned up later)

Agent-Logs-Url: https://github.com/SLNE-Development/surf-api/sessions/b4c8c86c-2741-4ab8-aae6-f9f6995c0e54

Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
@TheBjoRedCraft TheBjoRedCraft changed the title Implement 1.21.11 NMS module and add NMS template generator Implement 1.21.11/26.1 mutliversion support with nice generator Apr 14, 2026
… registration

The @autoservice KSP processor may not always generate the service file
correctly (e.g. due to paperweight dev bundle resolution issues). Adding
manual service files ensures V1_21_11NmsProvider and V26_1NmsProvider
are always discoverable by ServiceLoader at runtime.

Also makes ServiceLoader iteration robust against class loading failures
and updates the NMS template generator to auto-generate service files.

Agent-Logs-Url: https://github.com/SLNE-Development/surf-api/sessions/1c421ac7-9194-4697-91fd-1373913d3900

Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
… dead glow/packet code

The version-specific INSTANCE companions were casting from the
ServiceLoader-loaded proxy to the concrete impl type, causing
ClassCastException. Changed to lateinit var set by NmsProvider during
bridge/API creation.

Also removed old NMS-dependent dead code from surf-api-paper-server
that cannot work on 1.21.11 (compiled against 26.1 NMS):
- SurfGlowingApiImpl, GlowingPacketListener, TeamData
- BlockGlowingData, BlockPlayerData, EntityGlowingData, EntityPlayerData
- SurfPaperNmsGlowingBridgeImpl, PacketLoreListener

These are fully replaced by version-specific implementations in the
NMS modules (V1_21_11 and V26_1).

Agent-Logs-Url: https://github.com/SLNE-Development/surf-api/sessions/9e5b042e-c45e-4c65-8062-df05e010e09f

Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
… uses it

Cache the bridge instance in NmsProvider and call createGlowingBridge()
at the start of createGlowingApi() to guarantee the bridge INSTANCE is
always set before the API can use it. Applied to both V1_21_11NmsProvider
and V26_1NmsProvider.

Agent-Logs-Url: https://github.com/SLNE-Development/surf-api/sessions/f67fef39-1e25-4d4b-83e2-56ff14f551ac

Co-authored-by: TheBjoRedCraft <143264463+TheBjoRedCraft@users.noreply.github.com>
…dling

- eliminate fileTransformers for clearDialogs in NmsVersionConfigs.kt
- restore clearDialogs implementation in V1_21_11SurfPaperNmsCommonBridgeImpl.kt
- introduce a new Gradle plugin for generating NMS modules
- implement DSL for configuring reference and target versions
- add transformation rules for source code during generation
- create tasks for generating NMS modules with user prompts
- rename V1_21_11BlockGlowingData and V26_1BlockGlowingData to BlockGlowingData
- update references to use the unified BlockGlowingData class
- change BlockPlayerData to use ConcurrentHashMap for blocks
- refactor NmsProvider to support multiple NMS versions
twisti-dev and others added 2 commits April 15, 2026 17:10
…r packet handling

- add InternalNmsBridge interface for improved packet handling
- update NmsProvider to use getPacketBridgeHandler method
- apply NmsUseWithCaution annotation to relevant classes
- suppress ClassName warnings for consistency in naming conventions
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

…acket listener API

- introduce AbstractChannelInjector for handling packet injection across multiple NMS versions
- implement V1_21_11ChannelInjector and V26_1ChannelInjector for specific NMS versions
- create InternalNmsBridge and InternalPacketListenerApiBridge for packet handling
- update NmsProvider to create channel injectors and packet listener APIs
- add LibLoaderBridge interface for handling library loading across NMS versions
- implement V1_21_11LibLoaderBridgeImpl and V26_1LibLoaderBridgeImpl for respective versions
- refactor LibLoader to utilize the new bridge for compatibility management
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

- implement NmsProvider interface for version-specific operations
- add NmsProviderConfig for managing provider metadata
- create NmsProvidersCollector for collecting NMS providers at compile time
- update existing channel injectors to use NmsProvider for plugin registration
- enhance version resolution logic for better fallback handling
- rename SurfPaperNmsBridge to InternalNmsBridge for clarity
- adjust createNmsBridge method to return appropriate bridge implementations
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

- change implementation from NmsBridge to InternalNmsBridge for better multiversion support
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

…ApiBridge

- change createPacketListenerApi return type to InternalPacketListenerApiBridge
- update SurfPaperPacketListenerApiProxy to implement InternalPacketListenerApiBridge
- modify version-specific NmsProvider implementations to return InternalPacketListenerApiBridge
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateKotlinAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

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.

3 participants