diff options
Diffstat (limited to 'src/main/java/com/MylesAndMore/tumble/Game.java')
-rw-r--r-- | src/main/java/com/MylesAndMore/tumble/Game.java | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/src/main/java/com/MylesAndMore/tumble/Game.java b/src/main/java/com/MylesAndMore/tumble/Game.java index 01c3542..10b5c67 100644 --- a/src/main/java/com/MylesAndMore/tumble/Game.java +++ b/src/main/java/com/MylesAndMore/tumble/Game.java @@ -17,6 +17,9 @@ import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; import java.util.*; +/** + * This class holds all methods relating to the tumble Game in any way! + */ public class Game { // Singleton class logic // Define the gameInstance @@ -46,8 +49,6 @@ public class Game { private int gameID = -1; // Define a variable for the autostart PID private int autoStartID = -1; - // Define a variable for music ID - private int musicID = -1; // Define a variable to keep the list of tracks that have already played in the game List<String> sounds = new ArrayList<>(); @@ -56,9 +57,6 @@ public class Game { // Define the game world and its spawnpoint as a new Location for use later private final World gameWorld; private final Location gameSpawn; - -// // Make a list of the lobby's players for later -// private List<Player> lobbyPlayers = TumbleManager.getPlayersInLobby(); // Make a list of the game's players for later private List<Player> gamePlayers; // Make a list of the round's players @@ -130,7 +128,6 @@ public class Game { displayTitles(gamePlayers, ChatColor.GREEN + "Go!", null, 1, 5, 1); setGamemode(gamePlayers, GameMode.SURVIVAL); gameState = "running"; - playMusic(gamePlayers, SoundCategory.NEUTRAL, 1, 1); }, 20); }, 20); }, 20); @@ -443,30 +440,6 @@ public class Game { } } - private void playMusic(@NotNull List<Player> players, @NotNull SoundCategory category, float volume, float pitch) { - if (sounds.size() == 0) { - sounds.addAll(List.of( - "minecraft:tumble.0", - "minecraft:tumble.1", - "minecraft:tumble.2", - "minecraft:tumble.3", - "minecraft:tumble.4", - "minecraft:tumble.5", - "minecraft:tumble.6", - "minecraft:tumble.7", - "minecraft:tumble.8", - "minecraft:tumble.9")); - } - String currentSong = sounds.get(Random.nextInt(sounds.size())); - for (Player aPlayer : players) { - aPlayer.playSound(aPlayer.getLocation(), currentSong, category, volume, pitch); - } - sounds.remove(currentSong); - musicID = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(TumbleManager.getPlugin(), () -> { - playMusic(gamePlayers, SoundCategory.NEUTRAL, 1, 1); - }, 1460); - } - /** * Teleports a list of players to the specified scatter locations in the gameWorld * @param players a List of Players to teleport @@ -603,8 +576,6 @@ public class Game { displayActionbar(gamePlayers, ChatColor.BLUE + "Returning to lobby in ten seconds..."); // Wait 10s (200t), then Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(TumbleManager.getPlugin(), () -> { - // Stop music from replaying - Bukkit.getServer().getScheduler().cancelTask(musicID); // First, check to see if there is a separate location to tp the winner to if ((TumbleManager.getPlugin().getConfig().getDouble("winnerTeleport.x") != 0) && (TumbleManager.getPlugin().getConfig().getDouble("winnerTeleport.y") != 0) && (TumbleManager.getPlugin().getConfig().getDouble("winnerTeleport.z") != 0)) { // Tp the winner to that location |