🎮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

How to create a new game instance?

Game game = new GameImpl(area); //creates new game instance

UserGame userGame = new UserGameImpl(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

Last updated