// Path: src/main/java/de/zh32/teleportsigns/server/GameServer.java
// @Data
// @Accessors(chain = true)
// @EqualsAndHashCode
// public class GameServer implements Cloneable {
// 	private String name;
// 	private int playersOnline = 0;
// 	private int maxPlayers = 0;
// 	private String motd;
// 	private boolean online = false;
// 	private InetSocketAddress address;
// 	private String displayname;
// 
// 	@Override
// 	public GameServer clone() {
// 		try {
// 			return (GameServer) super.clone();
// 		} catch (CloneNotSupportedException e) {
// 			throw new InternalError();
// 		}
// 	}
// }
// 
// Path: src/main/java/de/zh32/teleportsigns/server/status/ServerListPing.java
// public class ServerListPing {
// 
// 	private final Logger logger;
// 
// 	public ServerListPing(Logger logger) {
// 		this.logger = logger;
// 	}
// 
// 	public boolean updateStatus(GameServer server) {
// 		GameServer oldState = server.clone();
// 		try {
// 			ServerConnection connection = new ServerConnection(server.getAddress());
// 			connection.connect();
// 			QueryHandler queryHandler = new QueryHandler(connection);
// 			queryHandler.doHandShake();
// 			StatusResponse response = queryHandler.doStatusQuery();
// 			connection.disconnect();
// 			server
// 					.setMotd(response.getDescription())
// 					.setMaxPlayers(response.getMaxPlayers())
// 					.setPlayersOnline(response.getOnlinePlayers())
// 					.setOnline(true);
// 		} catch (InvalidResponseException e) {
// 			logger.warning(String.format(
// 					"The response from server '%s' with host '%s' is invalid.",
// 					server.getName(), server.getAddress().toString()
// 			));
// 			server.setOnline(false);
// 		} catch (IOException e) {
// 			server.setOnline(false);
// 		}
// 		return hasStatusChanged(oldState, server);
// 	}
// 
// 	private static boolean hasStatusChanged(GameServer old, GameServer server) {
// 		return !old.equals(server);
// 	}
// 
// 	@Getter
// 	public static class ServerConnection {
// 
// 		private final InetSocketAddress host;
// 		private Socket socket;
// 		private InputStream inputStream;
// 		private OutputStream outputStream;
// 		private int timeout;
// 		private DataInputStream dataInputStream;
// 		private DataOutputStream dataOutputStream;
// 
// 		public ServerConnection(InetSocketAddress host) {
// 			this.host = host;
// 		}
// 
// 		public void connect() throws IOException {
// 			socket = new Socket();
// 			socket.setSoTimeout(timeout);
// 			socket.connect(host, timeout);
// 			inputStream = socket.getInputStream();
// 			dataInputStream = new DataInputStream(inputStream);
// 			outputStream = socket.getOutputStream();
// 			dataOutputStream = new DataOutputStream(outputStream);
// 		}
// 
// 		private void disconnect() throws IOException {
// 			dataInputStream.close();
// 			dataOutputStream.close();
// 			socket.close();
// 		}
// 
// 
// 	}
// 
// 
// }


import de.zh32.teleportsigns.server.GameServer;
import de.zh32.teleportsigns.server.status.ServerListPing;
import java.util.ArrayList;
import java.util.List;
package de.zh32.teleportsigns.task;



/**
 * @author zh32
 */
public abstract class ServerUpdateTask extends Task<List<GameServer>> {

	private final List<GameServer> servers;
// Path: src/main/java/de/zh32/teleportsigns/server/GameServer.java
// @Data
// @Accessors(chain = true)
// @EqualsAndHashCode
// public class GameServer implements Cloneable {
// 	private String name;
// 	private int playersOnline = 0;
// 	private int maxPlayers = 0;
// 	private String motd;
// 	private boolean online = false;
// 	private InetSocketAddress address;
// 	private String displayname;
// 
// 	@Override
// 	public GameServer clone() {
// 		try {
// 			return (GameServer) super.clone();
// 		} catch (CloneNotSupportedException e) {
// 			throw new InternalError();
// 		}
// 	}
// }
// 
// Path: src/main/java/de/zh32/teleportsigns/server/status/ServerListPing.java
// public class ServerListPing {
// 
// 	private final Logger logger;
// 
// 	public ServerListPing(Logger logger) {
// 		this.logger = logger;
// 	}
// 
// 	public boolean updateStatus(GameServer server) {
// 		GameServer oldState = server.clone();
// 		try {
// 			ServerConnection connection = new ServerConnection(server.getAddress());
// 			connection.connect();
// 			QueryHandler queryHandler = new QueryHandler(connection);
// 			queryHandler.doHandShake();
// 			StatusResponse response = queryHandler.doStatusQuery();
// 			connection.disconnect();
// 			server
// 					.setMotd(response.getDescription())
// 					.setMaxPlayers(response.getMaxPlayers())
// 					.setPlayersOnline(response.getOnlinePlayers())
// 					.setOnline(true);
// 		} catch (InvalidResponseException e) {
// 			logger.warning(String.format(
// 					"The response from server '%s' with host '%s' is invalid.",
// 					server.getName(), server.getAddress().toString()
// 			));
// 			server.setOnline(false);
// 		} catch (IOException e) {
// 			server.setOnline(false);
// 		}
// 		return hasStatusChanged(oldState, server);
// 	}
// 
// 	private static boolean hasStatusChanged(GameServer old, GameServer server) {
// 		return !old.equals(server);
// 	}
// 
// 	@Getter
// 	public static class ServerConnection {
// 
// 		private final InetSocketAddress host;
// 		private Socket socket;
// 		private InputStream inputStream;
// 		private OutputStream outputStream;
// 		private int timeout;
// 		private DataInputStream dataInputStream;
// 		private DataOutputStream dataOutputStream;
// 
// 		public ServerConnection(InetSocketAddress host) {
// 			this.host = host;
// 		}
// 
// 		public void connect() throws IOException {
// 			socket = new Socket();
// 			socket.setSoTimeout(timeout);
// 			socket.connect(host, timeout);
// 			inputStream = socket.getInputStream();
// 			dataInputStream = new DataInputStream(inputStream);
// 			outputStream = socket.getOutputStream();
// 			dataOutputStream = new DataOutputStream(outputStream);
// 		}
// 
// 		private void disconnect() throws IOException {
// 			dataInputStream.close();
// 			dataOutputStream.close();
// 			socket.close();
// 		}
// 
// 
// 	}
// 
// 
// }


// Path: src/main/java/de/zh32/teleportsigns/task/ServerUpdateTask.java
import de.zh32.teleportsigns.server.GameServer;
import de.zh32.teleportsigns.server.status.ServerListPing;
import java.util.ArrayList;
import java.util.List;

package de.zh32.teleportsigns.task;



/**
 * @author zh32
 */
public abstract class ServerUpdateTask extends Task<List<GameServer>> {

	private final List<GameServer> servers;
	private final ServerListPing ping;