The game system has methods to manage teams, game states, and rounds in the game.
The game class has methods:
ArenagetArena(); //Gets arena which is using to play this gameList<UserGame>getPlayingUsers(); //Gets list of game usersGameStategetState(); //Gets current game statevoidsetState(GameState gameState); //Sets new game stateOptional<UserGame>getUserGame(UUID uuid); //Gets UserGame by player's uuidvoidsendMessage(String message); //Sends message to everyone who is playing on this gameintgetRounds(); //Gets rounds amountvoidsetRounds(int rounds); //Sets rounds amountvoidaddRound(); //Adds one round to roundsList<Team>getTeams(); //Gets list of teamsOptional<Team>getTeamByName(String name); //Gets team by nameOptional<Team>getTeamByPlayer(Player player); //Gets team by playervoidaddUserGame(UserGame userGame); //Adds a player to playing usersvoidremoveUserGame(UserGame userGame); //Removes a player from playing users
How to create a new game instance?
Game game =newGameImpl(area); //creates new game instanceUserGame userGame =newUserGameImpl(player.getUniqueId()); //create the first player who joined this gamegame.addUserGame(userGame); //adds this player to listgameManager.addGame(game); //adds this game to list