Skip to content

Add PlayerPreTeleportEvent - #12879

Closed
RandomTomato wants to merge 8 commits into
PaperMC:mainfrom
RandomTomato:PlayerPreTeleportEvent
Closed

RandomTomato wants to merge 8 commits into
PaperMC:mainfrom
RandomTomato:PlayerPreTeleportEvent

Conversation

@RandomTomato

@RandomTomato RandomTomato commented Jul 22, 2025 •

Copy link
Copy Markdown

Adds PlayerPreTeleportEvent to address various issues with teleporting mentioned in #12093, #10168 & #10173.

Currently there is no way to handle teleporting players cross-worlds with vehicles and passengers as the PlayerTeleportEvent fires after the checks for vehicles and passengers.

Implementing this event would allow for intercepting teleports before vehicle/passenger checks occur allowing for the correct handling of the vehicle/passengers when teleporting (specifically cross worlds) as there is currently no way to know if a teleport failed because of this.

Hopefully this event can be added as its been a while since the last discussion about this and it seemed like a lot of people wanted this. 😁 (I can also add EntityPreTeleportEvent if needed!)

@RandomTomato
RandomTomato requested a review from a team as a code owner July 22, 2025 09:12
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Jul 22, 2025
@electronicboy

Copy link
Copy Markdown
Member

The goal really is to align with the vanilla teleport logic rather than the CB logic and having a bunch of hacks

Really iffy on these sorts of events. Adding in early mutation points for stuff they don't really need, like the Location, is kinda bleh. Nor should we really be returning mutable location objects in the API There is zero info on whether a teleport will succeed or not, which feels like it kinda misses the bar in terms of what it's trying to solve

@RandomTomato

RandomTomato commented Jul 22, 2025 •

Copy link
Copy Markdown
Author

The goal really is to align with the vanilla teleport logic rather than the CB logic and having a bunch of hacks

Really iffy on these sorts of events. Adding in early mutation points for stuff they don't really need, like the Location, is kinda bleh. Nor should we really be returning mutable location objects in the API There is zero info on whether a teleport will succeed or not, which feels like it kinda misses the bar in terms of what it's trying to solve

hello 👋🏻 Thank you for your reply! I understand that the goal is to align with the vanilla logic. This was mentioned by Malfrador in #12093 a feature request that I made a while ago and we both spoke in.

I also agree with not having a bunch of hacks/work arounds, but if there is no intention of implementing/aligning with the vanilla teleport logic (as its been nearly two years since the last pull request #10173 with a similar goal was created). Is it possible to be implemented and then deprecated when moved over?

Also if the setTo function is an issue I can make an amendment to this and remove it 😁

@Leguan16

Copy link
Copy Markdown
Contributor

It's also questionable if such an event should be cancellable.

But yeah, when working on #10173 I more and more realised that such an event doesn't really make much sense in a way to justify adding it.

However, as stated and discussed in my PR a TeleportFailEvent might make more sense in this case as you could then prepare the entity for teleportation.

@RandomTomato

RandomTomato commented Jul 22, 2025 •

Copy link
Copy Markdown
Author

It's also questionable if such an event should be cancellable.

But yeah, when working on #10173 I more and more realised that such an event doesn't really make much sense in a way to justify adding it.

However, as stated and discussed in my PR a TeleportFailEvent might make more sense in this case as you could then prepare the entity for teleportation.

I am personally happy with either approach. 🤷🏻‍♂️
Its just kind of a pain that currently there is no way to deal with this and hopefully some sort of a solution can be implemented.

EDIT: If its decided to go down the path of (Player/Entity)TeleportFailEvent I could put together an amendment to this PR and make a name change! Just let me know 😁

@github-project-automation github-project-automation Bot moved this from Awaiting review to Closed in Paper PR Queue Aug 27, 2025
@RandomTomato
RandomTomato deleted the PlayerPreTeleportEvent branch August 27, 2025 11:15
@RandomTomato

Copy link
Copy Markdown
Author

Closed because I messed up rebasing and duplicated my commits 😔😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

3 participants