Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void createLobby() throws Exception {
- players = new ArrayList<>();
- while (true) {
- players.clear();
- System.out.println(Colors.getYellow() + "Creating New Lobby");
- //Getting lobby code from user
- code = Validations.getCode();
- //Checking if code is a quit event
- if (code.equals("q")) {
- break;
- }
- //Getting lobby words language
- language = Validations.getLanguage();
- //Getting lobby size from user
- lobbySize = Validations.getLobbySize();
- System.out.println(Colors.getGreen() + "Lobby for " + lobbySize + " players was successfully created!" + Colors.getWhite());
- String ip = InetAddress.getLocalHost().getHostAddress();
- System.out.println(Colors.getCyan() + "Connect to the lobby using:\n" +
- "\tServer IP: " + Colors.getYellow() + ip + "\n" + Colors.getCyan() +
- "\tLobby code: " + Colors.getYellow() + code +
- Colors.getWhite());
- //Getting players
- for (int i = 0; i < lobbySize; i++) {
- players.add(getPlayer());
- System.out.println(players.get(i).getName() + " Joined");
- }
- //Creating new game with both players
- new Game(players, this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement