Skip to content

Commit

Permalink
Fix "kicked for flying" bug (for real this time)
Browse files Browse the repository at this point in the history
  • Loading branch information
MylesAndMore authored Feb 3, 2023
1 parent 3d504f6 commit 68de039
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/MylesAndMore/tumble/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ else if (Objects.equals(gameState, "running")) {
// Generate the correct layers for a Shovels game
// The else statement is just in case the generator fails; this command will fail
if (generateLayers(type)) {
// Put all players in spectator to prevent them from getting kicked for flying
setGamemode(TumbleManager.getPlayersInLobby(), GameMode.SPECTATOR);
// Send all players from lobby to the game
scatterPlayers(TumbleManager.getPlayersInLobby());
} else {
Expand All @@ -114,6 +112,10 @@ else if (Objects.equals(gameState, "running")) {
// Create a list that will later keep track of each player's wins
gameWins = new ArrayList<>();
gameWins.addAll(List.of(0,0,0,0,0,0,0,0));
// Put all players in spectator to prevent them from getting kicked for flying (this needs a delay bc servers are SLOOOWWW)
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(TumbleManager.getPlugin(), () -> {
setGamemode(gamePlayers, GameMode.SPECTATOR);
}, 25);
// Wait 5s (100t) for the clients to load in
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(TumbleManager.getPlugin(), () -> {
// Begin the countdown sequence
Expand Down

0 comments on commit 68de039

Please sign in to comment.