use of com.viaversion.fabric.common.AddressParser in project ViaFabric by ViaVersion.
the class MixinConnectScreenThread method resolveViaFabricAddr.
@Redirect(method = "run()V", at = @At(value = "INVOKE", target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
private InetAddress resolveViaFabricAddr(String address) throws UnknownHostException {
AddressParser viaAddr = new AddressParser().parse(address);
if (viaAddr.viaSuffix == null) {
return InetAddress.getByName(address);
}
InetAddress resolved = InetAddress.getByName(viaAddr.serverAddress);
return InetAddress.getByAddress(resolved.getHostName() + "." + viaAddr.getSuffixWithOptions(), resolved.getAddress());
}
use of com.viaversion.fabric.common.AddressParser in project ViaFabric by ViaVersion.
the class MixinServerPinger method resolveViaFabricAddr.
@Redirect(method = "add", at = @At(value = "INVOKE", target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
private InetAddress resolveViaFabricAddr(String address) throws UnknownHostException {
AddressParser viaAddr = new AddressParser().parse(address);
if (viaAddr.viaSuffix == null) {
return InetAddress.getByName(address);
}
InetAddress resolved = InetAddress.getByName(viaAddr.serverAddress);
return InetAddress.getByAddress(resolved.getHostName() + "." + viaAddr.getSuffixWithOptions(), resolved.getAddress());
}
use of com.viaversion.fabric.common.AddressParser in project ViaFabric by ViaVersion.
the class MixinConnectScreenThread method resolveViaFabricAddr.
@Redirect(method = "run()V", at = @At(value = "INVOKE", target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
private InetAddress resolveViaFabricAddr(String address) throws UnknownHostException {
AddressParser viaAddr = new AddressParser().parse(address);
if (viaAddr.viaSuffix == null) {
return InetAddress.getByName(address);
}
InetAddress resolved = InetAddress.getByName(viaAddr.serverAddress);
return InetAddress.getByAddress(resolved.getHostName() + "." + viaAddr.getSuffixWithOptions(), resolved.getAddress());
}
use of com.viaversion.fabric.common.AddressParser in project ViaFabric by ViaVersion.
the class MixinServerAddress method modifySrvAddr.
@Redirect(method = "parse", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/ServerAddress;resolveSrv(Ljava/lang/String;)[Ljava/lang/String;"))
private static String[] modifySrvAddr(String address) {
AddressParser viaAddr = new AddressParser().parse(address);
if (viaAddr.viaSuffix == null) {
return resolveSrv(address);
}
String[] resolvedSrv = resolveSrv(viaAddr.serverAddress);
resolvedSrv[0] = resolvedSrv[0].replaceAll("\\.$", "") + "." + viaAddr.getSuffixWithOptions();
return resolvedSrv;
}
use of com.viaversion.fabric.common.AddressParser in project ViaFabric by ViaVersion.
the class MixinServerPinger method resolveViaFabricAddr.
@Redirect(method = "add", at = @At(value = "INVOKE", target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;"))
private InetAddress resolveViaFabricAddr(String address) throws UnknownHostException {
AddressParser viaAddr = new AddressParser().parse(address);
if (viaAddr.viaSuffix == null) {
return InetAddress.getByName(address);
}
InetAddress resolved = InetAddress.getByName(viaAddr.serverAddress);
return InetAddress.getByAddress(resolved.getHostName() + "." + viaAddr.getSuffixWithOptions(), resolved.getAddress());
}
Aggregations