Skip to content

Implement default available slots provider for surf servers#9

Merged
twisti-dev merged 2 commits into
version/26.1from
feat/available-slots-provider
Jun 8, 2026
Merged

Implement default available slots provider for surf servers#9
twisti-dev merged 2 commits into
version/26.1from
feat/available-slots-provider

Conversation

@twisti-dev

Copy link
Copy Markdown
Contributor

This pull request introduces a new abstraction for determining available slots on a server and integrates it into the Paper implementation. The main goal is to decouple slot calculation logic from direct Bukkit API usage, making the codebase more modular and extensible.

New abstraction for available slots:

  • Added the SurfQueueAvailableSlotsProvider interface to the API, providing a global mechanism to determine available slots for a given SurfServer.
  • Implemented the DefaultSurfQueueAvailableSlotsProvider object for the Paper platform, using Bukkit APIs for the current server and fallback logic for others.

Integration and refactoring:

  • Registered DefaultSurfQueueAvailableSlotsProvider as the global provider during Paper plugin loading in PaperSurfQueueInstance.
  • Refactored PaperQueueTransfer to use the new provider for slot calculation instead of directly accessing Bukkit APIs, improving modularity and testability.

Project versioning:

  • Bumped the project version from 1.1.3 to 1.2.0 in gradle.properties.

…rvers

- add DefaultSurfQueueAvailableSlotsProvider to calculate available slots
- integrate provider into PaperQueueTransfer and PaperSurfQueueInstance
- create SurfQueueAvailableSlotsProvider interface for global access
@twisti-dev twisti-dev self-assigned this Jun 8, 2026
Copilot AI review requested due to automatic review settings June 8, 2026 10:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new API abstraction (SurfQueueAvailableSlotsProvider) to compute available player slots for a SurfServer, and wires a Paper default implementation into the Paper plugin so transfer logic no longer directly depends on Bukkit for slot calculation.

Changes:

  • Added SurfQueueAvailableSlotsProvider to surf-queue-api as a global, platform-configurable slot resolution mechanism.
  • Implemented and registered DefaultSurfQueueAvailableSlotsProvider in the Paper module.
  • Refactored PaperQueueTransfer to use the provider instead of directly querying Bukkit.
  • Bumped project version to 1.2.0.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
surf-queue-paper/src/main/kotlin/dev/slne/surf/queue/paper/queue/transfer/PaperQueueTransfer.kt Uses the new global slots provider for transfer sizing (but currently leaves an unused Bukkit import).
surf-queue-paper/src/main/kotlin/dev/slne/surf/queue/paper/queue/DefaultSurfQueueAvailableSlotsProvider.kt Adds the Paper default provider for available slots (currently uses Bukkit from a worker thread and can return negative slots).
surf-queue-paper/src/main/kotlin/dev/slne/surf/queue/paper/PaperSurfQueueInstance.kt Registers the Paper default provider during plugin load.
surf-queue-api/src/main/kotlin/dev/slne/surf/queue/api/SurfQueueAvailableSlotsProvider.kt Introduces the new provider interface and global accessor.
gradle.properties Version bump 1.1.31.2.0.
Comments suppressed due to low confidence (1)

surf-queue-paper/src/main/kotlin/dev/slne/surf/queue/paper/queue/transfer/PaperQueueTransfer.kt:14

  • org.bukkit.Bukkit is imported but no longer used in this file after switching slot calculation to SurfQueueAvailableSlotsProvider. Kotlin treats unused imports as compilation errors, so this will fail the build.
import dev.slne.surf.queue.api.SurfQueueAvailableSlotsProvider
import kotlinx.coroutines.TimeoutCancellationException
import kotlinx.coroutines.withTimeout
import net.kyori.adventure.text.Component
import org.bukkit.Bukkit

@twisti-dev twisti-dev merged commit 2ee5305 into version/26.1 Jun 8, 2026
1 check passed
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.

2 participants