package org.kne.cloud.network.minecraft;

import java.net.UnknownHostException;

import org.kne.cloud.network.MultipurposeSocketAddress;
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(MultipurposeSocketAddress begin, MultipurposeSocketAddress 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("~");
		MultipurposeSocketAddress begin=MinecraftServerAddress.findAddress (sp[0]);
		MultipurposeSocketAddress  end;
		if(sp.length>1) {
		end=MinecraftServerAddress.findAddress (sp[1]);
		}else {
			end=MinecraftServerAddress.findAddress (sp[0]);
		}
		setMsa(begin, end);
	}

}
