private void download(String name, String directory) {
		URLConnection connection;
		InputStream input = null;
		try {
			connection = downloadLocation.openConnection();
			connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");
			//connection.setReadTimeout(2000);
			input = connection.getInputStream();
			long size = connection.getContentLength();
			ServerWindow.getSingleton().printCommandText("Downloading file w/ size "+formatSize(size));
			byte[] buf = new byte[512];
			ByteBuffer buffer = ByteBuffer.allocate(connection.getContentLength());
			int done = 0;
			int percent = 0;
			while (true) {
                int len = input.read(buf);
                if (len == -1) {
                    break;
                }
                done += len;
                buffer.put(buf, 0, len);
                if((int)(((double)done / (double)size) * 100D) != percent) {
					percent = (int)(((double)done / (double)size) * 100D);
					ServerWindow.getSingleton().printCommandText("Downloaded..."+percent+"%");
				}
			}
			new FileOutputStream(new File(directory + name)).write(buffer.array());
			ServerWindow.getSingleton().printCommandText("Done!");
		} catch(Exception e) {
			ServerWindow.getSingleton().textField.setEditable(true);
			ServerWindow.getSingleton().textField.setEnabled(true);
			ServerWindow.getSingleton().printCommandText("Download failed!");
			System.out.println("Download failed :(");
			e.printStackTrace();
		}
	}