package org.kne.cloud.network.minecraft;

import java.net.UnknownHostException;

import org.kne.cloud.network.MultiProtocolSocketAddress;
import org.kne.cloud.network.scanner.InetAddressRange;
import org.kne.cloud.network.scanner.PortRange;
import org.kne.cloud.network.scanner.ScanRange;

public class MinecraftServerScanRange extends ScanRange {

	public MinecraftServerScanRange(InetAddressRange addressRange, PortRange portRange) {
		super(addressRange, portRange);
	}

	public MinecraftServerScanRange(MultiProtocolSocketAddress begin, MultiProtocolSocketAddress end)
			throws UnknownHostException {
		super(begin, end);
	}

	public MinecraftServerScanRange(String range) throws UnknownHostException {
		super(range);
	}

	@Override
	protected void setMsaString(String range) throws UnknownHostException {
		String[]sp=range.split("~");
		MultiProtocolSocketAddress begin=MinecraftServerAddress.findAddress (sp[0]);
		MultiProtocolSocketAddress end;
		if(sp.length>1) {
		end=MinecraftServerAddress.findAddress (sp[1]);
		}else {
			end=MinecraftServerAddress.findAddress (sp[0]);
		}
		setMsa(begin, end);
	}

}
