Skip to content

Commit

Permalink
Teleport player to spawn when he's under -30 Y
Browse files Browse the repository at this point in the history
  • Loading branch information
DocSystem committed Oct 17, 2022
1 parent dc7f8bd commit b8f19d1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/fr/efreicraft/eclobby/listeners/Login.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public void onPlayerJoin(PlayerJoinEvent event) {
}, 1L);
Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.INSTANCE, () -> {
fr.efreicraft.eclobby.utils.HUDManager.setScoreboard(player);
Location loc = player.getLocation();
if (loc.getY() < -30) {
player.teleport(new Location(player.getWorld(), 0.5, 1, 0.5, 90, 0));
}
}, 0L, 20L);
}
}

0 comments on commit b8f19d1

Please sign in to comment.