Skip to content

Commit 5fd3c95

Browse files
authored
Add Entity#teleportAsync(Location, TeleportFlag...) (#13208)
1 parent fcb2956 commit 5fd3c95

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

paper-api/src/main/java/org/bukkit/entity/Entity.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,22 @@ final class Holder {
277277
return this.teleportAsync(loc, cause, Holder.EMPTY_FLAGS);
278278
}
279279

280+
/**
281+
* Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready.
282+
* <p>
283+
* Note: This uses default in game behavior for teleportation, especially in regard to handling
284+
* passengers and vehicles across dimensions. It should be noted at this moment, teleporting a {@link Player}
285+
* with passengers across dimensions is not supported and will cause the future to return false. This behavior may
286+
* change in future versions.
287+
*
288+
* @param loc Location to teleport to
289+
* @param teleportFlags Flags to be used in this teleportation
290+
* @return A future that will be completed with the result of the teleport
291+
*/
292+
default java.util.concurrent.@NotNull CompletableFuture<Boolean> teleportAsync(@NotNull Location loc, @NotNull io.papermc.paper.entity.TeleportFlag @NotNull... teleportFlags) {
293+
return this.teleportAsync(loc, TeleportCause.PLUGIN, teleportFlags);
294+
}
295+
280296
/**
281297
* Loads/Generates(in 1.13+) the Chunk asynchronously, and then teleports the entity when the chunk is ready.
282298
* <p>

0 commit comments

Comments
 (0)