Support TeleportCause for function "teleportAsync"
I have changed the method:
public CompletableFuture<Boolean> teleportAsync(Player player, Location location)
Now, it is:
public CompletableFuture<Boolean> teleportAsync(Entity entity, Location location, PlayerTeleportEvent.TeleportCause cause)
Why?
Because Player.teleport() is actually Entity.teleport()
And There is a argment named PlayerTeleportEvent.TeleportCause
Another Change
This part of code seems meaningless.
this.runAtEntity(player, (task) -> {
if (player.isValid() && player.isOnline()) {
player.teleport(location);
future.complete(true);
} else {
future.complete(false);
}
});
And it can be replaced with:
this.runAtEntity(entity, (task) -> future.complete(entity.teleport(location, cause)));
So I did it.
Hope to adopt, thank you, it's really useful and helpful to me
Thank you for reminding me
I have made some changes and tried to comply with your request, please check.
And if you don't like merging two (clumsiness) commits, you can use the patch, it's no problem.
Support_TeleportCause_for_function__teleportAsync__(Fixed).patch
It seems there is a replacement.