mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-12-21 16:28:10 +01:00
Improved wildcard domain syntax kick message
This commit is contained in:
parent
0353a9323b
commit
50f49709b0
@ -134,19 +134,21 @@ public class Client2ProxyHandler extends SimpleChannelInboundHandler<IPacket> {
|
||||
if (handshakeParts[0].toLowerCase().contains(".viaproxy.")) {
|
||||
handshakeParts[0] = handshakeParts[0].substring(0, handshakeParts[0].toLowerCase().lastIndexOf(".viaproxy."));
|
||||
} else {
|
||||
throw CloseAndReturn.INSTANCE;
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final ArrayHelper arrayHelper = ArrayHelper.instanceOf(handshakeParts[0].split(Pattern.quote("_")));
|
||||
if (arrayHelper.getLength() < 3) {
|
||||
throw CloseAndReturn.INSTANCE;
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final String versionString = arrayHelper.get(arrayHelper.getLength() - 1);
|
||||
serverVersion = ProtocolVersionUtil.fromNameLenient(versionString);
|
||||
if (serverVersion == null) throw CloseAndReturn.INSTANCE;
|
||||
if (serverVersion == null) {
|
||||
this.proxyConnection.kickClient("§cWrong domain syntax!\n§cUnknown server version.");
|
||||
}
|
||||
final String connectIP = arrayHelper.getAsString(0, arrayHelper.getLength() - 3, "_");
|
||||
final int connectPort = arrayHelper.getInteger(arrayHelper.getLength() - 2);
|
||||
serverAddress = AddressUtil.parse(connectIP + ":" + connectPort, serverVersion);
|
||||
} catch (CloseAndReturn e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
this.proxyConnection.kickClient("§cWrong domain syntax! §6Please use:\n§7address_port_version.viaproxy.hostname");
|
||||
}
|
||||
} else if (ViaProxy.getConfig().getWildcardDomainHandling() == ViaProxyConfig.WildcardDomainHandling.INTERNAL) {
|
||||
|
Loading…
Reference in New Issue
Block a user