Skip to content

Commit

Permalink
Force teleportAsync in EntityScheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
Euphillya committed Oct 23, 2024
1 parent 6e1d448 commit eb3bb04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public Location getLocation() {
public boolean setLocation(Location location) {
org.bukkit.entity.Entity entity = entityRef.get();
if (entity != null) {
entity.teleportAsync(BukkitAdapter.adapt(location));
entity.getScheduler().run(WorldEditPlugin.getInstance(), scheduledTask -> entity.teleportAsync(BukkitAdapter.adapt(location)), null);
return true;
} else {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ public void print(Component component) {

@Override
public boolean trySetPosition(Vector3 pos, float pitch, float yaw) {
player.teleportAsync(new Location(player.getWorld(), pos.x(), pos.y(),
pos.z(), yaw, pitch));
player.getScheduler().run(WorldEditPlugin.getInstance(), scheduledTask -> player.teleportAsync(new Location(player.getWorld(), pos.x(), pos.y(),
pos.z(), yaw, pitch)), null);
return true;
}

Expand Down Expand Up @@ -225,7 +225,7 @@ public com.sk89q.worldedit.util.Location getLocation() {

@Override
public boolean setLocation(com.sk89q.worldedit.util.Location location) {
player.teleportAsync(BukkitAdapter.adapt(location));
player.getScheduler().run(WorldEditPlugin.getInstance(), scheduledTask -> player.teleportAsync(BukkitAdapter.adapt(location)), null);
return true;
}

Expand Down

0 comments on commit eb3bb04

Please sign in to comment.