Skip to content

Commit

Permalink
small lambda runnable change
Browse files Browse the repository at this point in the history
  • Loading branch information
mind-overflow committed Jun 24, 2020
1 parent b26c11f commit eb7feb4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/java/net/mindoverflow/hubthat/utils/TeleportUtils.java
Expand Up @@ -27,8 +27,11 @@ public static void teleportPlayer(double x, double y, double z, double yaw, doub
if(player == null) return;

fixInvisibilityBefore(player, location);
plugin.getServer().getScheduler().runTaskLater(plugin, () -> player.teleport(location), 1);
fixInvisibilityAfter(player);
plugin.getServer().getScheduler().runTaskLater(plugin, () ->
{
player.teleport(location);
fixInvisibilityAfter(player);
}, 1);
}

// Method to teleport a player, given its username and defined if it's a hub or a spawn.
Expand Down Expand Up @@ -126,8 +129,12 @@ else if(type == FileUtils.FileType.SPAWN_YAML)
// Store the location in a variable and teleport the player to it.
final Location finalLocation = new Location(destinationWorld, x, y, z, (float)yaw, (float)pitch);
fixInvisibilityBefore(player, finalLocation);
plugin.getServer().getScheduler().runTaskLater(plugin, () -> player.teleport(finalLocation), 1);
fixInvisibilityAfter(player);
plugin.getServer().getScheduler().runTaskLater(plugin, () ->
{
player.teleport(finalLocation);
fixInvisibilityAfter(player);

}, 1);

// Check if the player is teleporting to the hub.
if(type == FileUtils.FileType.HUB_YAML)
Expand Down

0 comments on commit eb7feb4

Please sign in to comment.