@Override
	public void update(Observable o, Object arg) {
		if (arg instanceof GameDescriptorPlayerUpdatePacket) {
			GameDescriptorPlayerUpdatePacket packet = (GameDescriptorPlayerUpdatePacket) arg;
			// If it was this game.
			if (packet.id == gameDescriptorId) {
				// If it was us, go back to the lobby
				if (packet.name.equals(getGameClient().getPlayerName())
						&& !packet.joined) {
					getClientWindow().setPanel(
							new LobbyPanel(getGameClient(), getClientWindow()));
				}
			}
		} else if (arg instanceof ChangeSeedPacket) {
			// Update the seed of the generator if this is our game
			if (((ChangeSeedPacket) arg).id == gameDescriptorId) {
				reefGenerator.regenerateReef(((ChangeSeedPacket) arg).seed);
			}
		} else if (arg instanceof GameStartPacket) {
			// Switch screens
			getClientWindow().setPanel(
					new GamePanel(getGameClient(), getClientWindow()));
			return;
		}

		// Refresh ready action listener's data.
		if (getGameClient().getGameDescriptorManager().getGameDescriptor(
				gameDescriptorId) != null) {
			readyActionListener.updateStatus(getGameClient()
					.getGameDescriptorManager()
					.getGameDescriptor(gameDescriptorId).getReadyPlayers()
					.contains(getGameClient().getPlayerName()));
		}

		// Handle the packet
		if (arg instanceof SetupMessagePacket) {
			publishChatMessage((SetupMessagePacket) arg);
		}
	}