@Override
	public void update(GameContainer container, int delta)
			throws SlickException {
		if (ls != null) {
			ls.update(container, delta);
			if (ls.gsi != null) {
				playerID = ls.un;
				gsi = ls.gsi;
				ls = null;
				apc.setDisplayMode(GameInfo.Width, GameInfo.Height, false);
				container.reinit();
			}
			return;
		}
		InputState.Update(container);
		
		spellbtn.update(container);
		s.update(delta);

		synchronized (players) {
			for (Character c : players.values()) {
				c.update(delta);
			}
		}
		synchronized (spells) {
			Iterator<Spell> it = spells.iterator();
			while (it.hasNext()) {
				Spell s = it.next();
				s.update(delta);
				if (s.isDead())
					it.remove();
			}
		}
		
		player.update(delta);
		if (System.currentTimeMillis() - time > __updateTimeDelayMillis) {
			time = System.currentTimeMillis();
			if (player.hasChanged()) {
				ensureStop = true;
				UpdatePlayer up = new UpdatePlayer();
				up.playerInfo = player.getPlayerInfo();
				if (__updateWithUDP) {
					client.sendUDP(up);
				} else {
					client.sendTCP(up);
				}
			} else if (ensureStop) {
				ensureStop = false;
				UpdatePlayer up = new UpdatePlayer();
				up.playerInfo = player.getPlayerInfo();
				client.sendTCP(up);
			} 
		}
	}