🎮Game system

The game system has methods to manage teams, game states, and rounds in the game.

The game class has methods:

Arena getArena(); //Gets arena which is using to play this game
List<UserGame> getPlayingUsers(); //Gets list of game users
GameState getState(); //Gets current game state
void setState(GameState gameState); //Sets new game state
Optional<UserGame> getUserGame(UUID uuid); //Gets UserGame by player's uuid
void sendMessage(String message); //Sends message to everyone who is playing on this game
int getRounds(); //Gets rounds amount
void setRounds(int rounds); //Sets rounds amount
void addRound(); //Adds one round to rounds
List<Team> getTeams(); //Gets list of teams
Optional<Team> getTeamByName(String name); //Gets team by name
Optional<Team> getTeamByPlayer(Player player); //Gets team by player
void addUserGame(UserGame userGame); //Adds a player to playing users
void removeUserGame(UserGame userGame); //Removes a player from playing users
UserGame createUserGame(UUID playerUUID) //Creates new user game
Team createTeam(String name, String displayName, ChatColor color) //Creates new team
runState() //Runes current game state
void addRecoverableUserGame(RecoverableUserGame recoverableUserGame); //Added new recoverableUserGame
void removeRecoverableUserGame(RecoverableUserGame recoverableUserGame); //Removes recoverableUserGame
Optional<RecoverableUserGame> getRecoverableUserGame(UUID playerUuid); //Gets user by uuid
List<RecoverableUserGame> getRecoverableUserGames(); //Gets list of RecoverableUserGames
void hidePlayers(UserGame user) //Hides all online players for user who is playing in the game
void showPlayers(UserGame user) // Show all online players for user who is playing in the game

How to create a new game instance?

Game game = new GameImpl(area); //creates new game instance
//or
Game game = gameManager.createGame(arena);

UserGame userGame = game.createUserGame(player.getUniqueId()); 
 //create the first player who joined this game

game.addUserGame(userGame); //adds this player to list

gameManager.addGame(game); //adds this game to list