Skip to content

Add ensureGlobalTickThread method for validation#374

Merged
twisti-dev merged 2 commits into
version/26.1from
feat/more-tick-thread-guards
Jun 14, 2026
Merged

Add ensureGlobalTickThread method for validation#374
twisti-dev merged 2 commits into
version/26.1from
feat/more-tick-thread-guards

Conversation

@twisti-dev

Copy link
Copy Markdown
Contributor

This pull request introduces a new method, ensureGlobalTickThread, to the TickThreadGuard interface and implements it for both the v1_21_11 and v26_1 NMS versions. This addition allows for explicit checks to ensure code is running on the global tick thread, improving thread safety and error reporting. The project version is also updated.

API changes

  • Added the ensureGlobalTickThread(reason: String) method to the TickThreadGuard interface and its companion, updating the API contract and documentation. [1] [2] [3]

Implementation updates

  • Implemented the new ensureGlobalTickThread method in both V1_21_11TickThreadGuard and V26_1TickThreadGuard, throwing an IllegalStateException if not on the global tick thread. [1] [2]
  • Added necessary imports for server extension to support the global tick thread check in both NMS guard classes. [1] [2]

Versioning

  • Bumped project version from 3.22.0 to 3.23.0 in gradle.properties.

@twisti-dev twisti-dev self-assigned this Jun 14, 2026
Copilot AI review requested due to automatic review settings June 14, 2026 10:58
@twisti-dev twisti-dev merged commit 76fd90a into version/26.1 Jun 14, 2026
3 of 6 checks passed
@twisti-dev twisti-dev deleted the feat/more-tick-thread-guards branch June 14, 2026 10:58

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

Adds an explicit “global tick thread” validation hook to the Paper TickThreadGuard API, with NMS-backed implementations for the supported versions, to improve thread-safety checks and diagnostics.

Changes:

  • Extended TickThreadGuard with ensureGlobalTickThread(reason: String) and updated the published API surface.
  • Implemented ensureGlobalTickThread for NMS v1_21_11 and v26_1.
  • Bumped the project version to 3.23.0.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
surf-api-paper/surf-api-paper/src/main/kotlin/dev/slne/surf/api/paper/region/TickThreadGuard.kt Adds the new ensureGlobalTickThread method to the public interface/companion delegation.
surf-api-paper/surf-api-paper/api/surf-api-paper.api Updates the API dump to reflect the new method on the interface and companion.
surf-api-paper/surf-api-paper-nms/surf-api-paper-nms-v26-1/src/main/kotlin/dev/slne/surf/api/paper/server/nms/v26_1/region/V26_1TickThreadGuard.kt Implements ensureGlobalTickThread for v26.1 and updates tick-thread checks.
surf-api-paper/surf-api-paper-nms/surf-api-paper-nms-v1-21-11/src/main/kotlin/dev/slne/surf/api/paper/server/nms/v1_21_11/region/V1_21_11TickThreadGuard.kt Implements ensureGlobalTickThread for v1.21.11.
gradle.properties Version bump to 3.23.0.

Comment on lines 19 to 23
override fun ensureTickThread(world: World, pos: Position, reason: String) {
TickThread.ensureTickThread("")

TickThread.ensureTickThread(world.toNms(), pos.chunkX, pos.chunkZ, reason)
}
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