@Override
	public void run() {
		try {
			serverObject = new ServerClass(console);
			console.setCommandManager(config.commandManager);
			config.commandManager.setConsole(console);
			config.commandManager.setServerClass(serverObject);
			console.setServerClass(serverObject);
			Thread t = new Thread(serverObject);
			t.start();
			console.displayMessage("Initializing on port " + config.port);
			ServerSocket serverSocket = new ServerSocket(config.port);
			serverSocket.setSoTimeout(TIMEOUT);
			console.displayMessage("Ready for clients");
			while (clients.size() < config.maxClients && !console.isStarted()) {
				Socket tmp = serverSocket.accept();
				console.displayMessage("Client with ip " + tmp.getInetAddress() + " connected (ID: " + idCounter + ")");
				Connection connection = new Connection(tmp, prepareInitialMessages(idCounter));
				ClientInfo tmp2 = new ClientInfo(idCounter, connection);
				clients.add(tmp2);
				serverObject.addClient(tmp2);
				idCounter++;
			}
			console.displayMessage("Server is now full.");
			t.join();
			serverSocket.close();
		} catch (IOException ex) {
		} catch (NetworkMessageException ex) {
		} catch (InterruptedException ex) {
		}
	}