Skip to content

Clone exit location passed to teleport event #12354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

emilyy-dev
Copy link
Member

The exit location passed to PlayerTeleportEvent/PlayerTeleportEndGatewayEvent in ServerPlayer#teleport(TeleportTransition) needs to be cloned, as it is later compared in case it was changed. Not cloning it results in the ability for plugins to mutate it but such changes will be ignored, as the instance of the Location being the same results in a successful equality check.

It is not necessary to clone the location in other instantiations of the event (or subclasses) as those are not compared afterwards to change the outcome.

Fixes #12340

@emilyy-dev emilyy-dev requested a review from a team as a code owner March 28, 2025 22:14
@github-project-automation github-project-automation bot moved this to Awaiting review in Paper PR Queue Mar 28, 2025
@emilyy-dev
Copy link
Member Author

lynx can cherry-pick this commit for the 1.21.5 branch

@github-project-automation github-project-automation bot moved this from Awaiting review to Awaiting final testing in Paper PR Queue Mar 29, 2025
@Warriorrrr Warriorrrr added the type: bug Something doesn't work as it was intended to. label Mar 29, 2025
The exit location passed to PlayerTeleportEvent/PlayerTeleportEndGatewayEvent in ServerPlayer#teleport(TeleportTransition) needs to be cloned, as it is later compared in case it was changed. Not cloning it results in the ability for plugins to mutate it but such changes will be ignored, as the instance of the Location being the same results in a successful equality check.

It is not necessary to clone the location in other instantiations of the event (or subclasses) as those are not compared afterwards to change the outcome.

Fixes PaperMC#12340
@emilyy-dev emilyy-dev force-pushed the fix/teleport-event-exit-cloning branch from 5500579 to 963d32b Compare April 12, 2025 18:04
@lynxplay lynxplay merged commit 723b511 into PaperMC:main Apr 14, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting final testing to Merged in Paper PR Queue Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something doesn't work as it was intended to.
Projects
Status: Merged
5 participants