@Override
	public void run() {
		try {
			server = new Server() {
                protected Connection newConnection () {
                    return new PlayerConnection();
                }
			};
			Network.register(server);
			GameServerListener gsl = new GameServerListener(playerDB, server);
			gsl.spells = spells;
			server.addListener(gsl);
			server.start();
			server.bind(port, port+1);
			boolean running = true;
			long time = System.currentTimeMillis(),
				 tsl = System.currentTimeMillis();
			int i = 0;
			Map m = gsl.zones.get("WorldHUB"); // TODO Zones....
			while (running) {
				i++;
				if (System.currentTimeMillis() - time > 1000) {
					time = System.currentTimeMillis();
					tps = i;
					i = 0;
				}
				int delta = (int)(System.currentTimeMillis() - tsl);
				tsl = System.currentTimeMillis();
				synchronized (spells) {
					Iterator<Spell> it = spells.keySet().iterator();
					while (it.hasNext()) {
						Spell s = it.next();
						s.update(delta);
						if (m.getCollision(s.collisionBox())) {
							KillSpell ks = new KillSpell();
							ks.id = s.getId();
							server.sendToAllTCP(ks);
							it.remove();
						}
					}
				}	
				for (Player p : playerDB.values()) {
					synchronized (spells) {
						Iterator<Spell> it = spells.keySet().iterator();
						while (it.hasNext()) {
							Spell s = it.next();
							if (spells.get(s).equals(p.getPlayerID()))
								continue;
							if (Physics.getCollision(p.collisionBox(), s.collisionBox())) {
								KillSpell ks = new KillSpell();
								ks.id = s.getId();
								server.sendToAllTCP(ks);
								it.remove();
							}
						}
					}
				}
				
				Thread.sleep(1);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}