if (!msg.getGameId().equals(game.getGameId())) throw new IllegalArgumentException("Invalid game id.");
if (gameStarted) throw new IllegalArgumentException("Game is already started.");
String clientId = getClientId(ws);
int number = msg.getNumber();
if (number < 0 || number >= slots.length || slots[number] == null) {
send(ws, new ErrorMessage("TAKE_SLOT", "Invalid slot number"));
return;
}
ServerPlayerSlot slot = slots[number];
if (!slot.isOccupied()) {
slot.setSerial(++slotSerial);