Skip to content

Bring Entity#teleportAsync up to parity with Entity#teleport #12019

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions paper-api/src/main/java/org/bukkit/entity/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,25 @@ final class Holder {
return this.teleportAsync(loc, cause, Holder.EMPTY_FLAGS);
}

/**
* Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready.
* @param destination Entity to teleport to
* @return A future that will be completed with the result of the teleport
*/
default java.util.concurrent.@NotNull CompletableFuture<Boolean> teleportAsync(final @NotNull Entity destination) {
return this.teleportAsync(destination.getLocation(), TeleportCause.PLUGIN);
}

/**
* Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready.
* @param destination Entity to teleport to
* @param cause Reason for teleport
* @return A future that will be completed with the result of the teleport
*/
default java.util.concurrent.@NotNull CompletableFuture<Boolean> teleportAsync(final @NotNull Entity destination, final @NotNull TeleportCause cause) {
return this.teleportAsync(destination.getLocation(), cause);
}

/**
* Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready.
* @param loc Location to teleport to
Expand Down
Loading