Skip to content

GH-1480 Add pre-teleport events for spawn and accepted teleport requests - #1481

Merged
P1otrulla merged 4 commits into
EternalCodeTeam:masterfrom
BlackBaroness:codex/pre-teleport-api-events
Nov 24, 2026
Merged

P1otrulla merged 4 commits into
EternalCodeTeam:masterfrom
BlackBaroness:codex/pre-teleport-api-events

Conversation

@BlackBaroness

@BlackBaroness BlackBaroness commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #1480.

AI assistance disclosure: This PR was implemented with OpenAI Codex based on my requirements and API design decisions.

Teleport interceptors can now replace spawn and accepted TPA/TPAHere teleports before the native delay starts:

  • Add synchronous, cancellable PreSpawnTeleportEvent for spawn commands (including delay bypass and teleporting another player) and SpawnService.teleportToSpawn, with an immutable player and mutable destination.
  • Add synchronous, cancellable TeleportRequestAcceptEvent for individual and bulk TPA acceptance and TPAHere acceptance, with immutable requester, recipient and request type, the actual teleporting player, and a mutable destination.
  • Cancellation preserves the pending request. Handlers replacing the teleport can explicitly call event.removeRequest() to remove the corresponding request, including when cancelling the event. This keeps internal request services out of the public API.

Existing permission/height checks, delays and normal request processing are retained. Bulk acceptance continues processing other requests when one event is cancelled, and does not send a success summary if every acceptance was cancelled.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Using Temurin JDK 21:

  • ./gradlew :eternalcore-core:test :eternalcore-api:build :eternalcore-api-example:compileJava
  • ./gradlew :eternalcore-core:test :eternalcore-plugin:shadowJar

All 52 core tests pass, including 20 new scenarios covering cancellation, destination changes, explicit request removal, bulk acceptance, TPAHere direction, the minimum acceptance height and all supported spawn entry points. The plugin JAR, API sources/Javadoc and API examples build successfully.

Checklist

  • Followed the existing event and dependency injection conventions.
  • Performed a self-review.
  • Documented the new event contracts in Javadoc.
  • Added regression tests.

@BlackBaroness
BlackBaroness requested a review from a team as a code owner November 23, 2026 17:41
@Pawelusze Pawelusze added 💾 code-only This is just a code problem, it doesn't affect the plugin functionality itself 🔓 API labels Nov 23, 2026
@CitralFlo CitralFlo changed the title Add pre-teleport events for spawn and accepted teleport requests GH-1480 Add pre-teleport events for spawn and accepted teleport requests Nov 24, 2026

@P1otrulla P1otrulla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you very much for the PR. I’ve added a few tweaks, as I’m currently in the process of reworking teleports and the events associated with them. We’ll aim to include this in the 2.2 release; if we don’t manage that, the breaking changes will be pushed to 2.3 - though, of course, only within the API module.

@P1otrulla
P1otrulla merged commit 2d5cbf0 into EternalCodeTeam:master Nov 24, 2026
2 checks passed
@BlackBaroness
BlackBaroness deleted the codex/pre-teleport-api-events branch November 24, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔓 API 💾 code-only This is just a code problem, it doesn't affect the plugin functionality itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add more teleport events

4 participants