Skip to content

Commit

Permalink
PlayerTeleporter: immediately throw if teleport target world is null,…
Browse files Browse the repository at this point in the history
… rather than confusing downstream mc error
  • Loading branch information
John-Paul-R committed Jun 21, 2024
1 parent a0f8dca commit 98cbdda
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ public static void teleport(PlayerData pData, MinecraftLocation dest, MutableTex
}

private static void execTeleport(ServerPlayerEntity playerEntity, MinecraftLocation dest, MutableText destName) {
var targetWorld = playerEntity.getServer().getWorld(dest.dim());
if (targetWorld == null) {
throw new NullPointerException(String.format("Could not find teleport target world, '%s'", dest.dim()));
}
playerEntity.teleport(
playerEntity.getServer().getWorld(dest.dim()),
targetWorld,
dest.pos().x, dest.pos().y, dest.pos().z,
dest.headYaw(), dest.pitch()
);
Expand Down

0 comments on commit 98cbdda

Please sign in to comment.