Skip to content

Commit

Permalink
Fix world change logic
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerS1066 committed Aug 25, 2024
1 parent 161ad50 commit 952435a
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,18 @@ public void doUpdate() {
Location location = entity.getLocation().add(x, y, z);
location.setYaw(location.getYaw() + yaw);
location.setPitch(location.getPitch() + pitch);
location.setWorld(world);
if (sound != null) {
((Player) entity).playSound(location, sound, volume, 1.0f);
}

// Use bukkit teleporting API for changing worlds because it won't be smooth anyway
if (!(entity instanceof Player) || !entity.getLocation().getWorld().equals(world)) {
entity.teleport(new Location(world, x, y, z, yaw, pitch));
entity.teleport(location);
return;
}

Movecraft.getInstance().getSmoothTeleport().teleport((Player) entity, location);
if (sound != null) {
((Player) entity).playSound(location, sound, volume, 1.0f);
}
}

@Override
Expand Down

0 comments on commit 952435a

Please sign in to comment.