Skip to content

Add asyncTeleport events#68

Closed
WillQizza wants to merge 1 commit into
PaperMC:masterfrom
WillQizza:async-teleport-events
Closed

Add asyncTeleport events#68
WillQizza wants to merge 1 commit into
PaperMC:masterfrom
WillQizza:async-teleport-events

Conversation

@WillQizza
Copy link
Copy Markdown
Contributor

Figured out what was wrong with my previous pull request #67 due to a misunderstanding of internal paper methods regarding the chunk coordinate calculations. This pull request fixes what it had problems with.

Currently, teleports caused by methods such as ender pearls or the /tp command do not trigger PlayerTeleportEvent or the EntityTeleportEvent.

This pull request implements the events when teleportAsync is called.

@ghost
Copy link
Copy Markdown

ghost commented May 7, 2023

add this please, it currently create a lot of issue and crash

@Spottedleaf
Copy link
Copy Markdown
Member

Clean up the imports, and add comments where diff starts and diff ends.
https://github.com/PaperMC/Paper/blob/master/CONTRIBUTING.md

The comment where I wrote that events may be placed there is actually wrong. It also needs to check the preconditions for teleporting again, as plugins may modify them. Ideally, given that this is "new" API, if any of those checks fail (i.e wrong tick thread, entity removed, or any other check it made before) then the code needs to throw an exception.

You have also incorrectly handled the case where the plugin modifies the target destination world, position, and yaw/pitch.
You have also incorrectly handled the case where the entity being teleported is a vehicle and contains passengers. We could add a new event for this, but really it just needs to be invoked for every entity on the passenger tree.

Copy link
Copy Markdown

@Spincial Spincial left a comment

Choose a reason for hiding this comment

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

yes

@WillQizza WillQizza closed this Jun 20, 2023
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.

3 participants