mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 06:51:32 +01:00
Better Hypixel/RuHypixel Detection
This commit is contained in:
parent
a527252426
commit
5ba46b437e
@ -1,22 +1,21 @@
|
||||
package net.silentclient.client.mods.util;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class Server {
|
||||
public static boolean isHypixel() {
|
||||
if(Minecraft.getMinecraft().isSingleplayer()) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
String serverIp = Minecraft.getMinecraft().getCurrentServerData().serverIP.toString();
|
||||
if(!serverIp.startsWith("http") && !serverIp.startsWith("https")){
|
||||
serverIp = "http://" + serverIp;
|
||||
}
|
||||
URL serverUrl = new URL(serverIp);
|
||||
String serverIp = Minecraft.getMinecraft().getCurrentServerData().serverIP;
|
||||
final String regex = "^(?:.*\\.)?hypixel\\.(?:net|io)\\.?";
|
||||
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
|
||||
|
||||
return (serverUrl.getHost().toString().toLowerCase().equals("hypixel.net") || serverUrl.getHost().toString().toLowerCase().equals("www.hypixel.net") || serverUrl.getHost().toString().toLowerCase().equals("mc.hypixel.net") || serverUrl.getHost().toString().toLowerCase().equals("play.hypixel.net") || serverUrl.getHost().toString().toLowerCase().equals("stuck.hypixel.net") || serverUrl.getHost().toString().toLowerCase().equals("proxy.hypixel.net") || serverUrl.getHost().toString().toLowerCase().equals("eu.hypixel.net") || serverUrl.getHost().toString().toLowerCase().equals("play.hypixel.net"));
|
||||
return pattern.matcher(serverIp).matches();
|
||||
} catch (Exception err) {
|
||||
return false;
|
||||
}
|
||||
@ -44,13 +43,11 @@ public class Server {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
String serverIp = Minecraft.getMinecraft().getCurrentServerData().serverIP.toString();
|
||||
if(!serverIp.startsWith("http") && !serverIp.startsWith("https")){
|
||||
serverIp = "http://" + serverIp;
|
||||
}
|
||||
URL serverUrl = new URL(serverIp);
|
||||
String serverIp = Minecraft.getMinecraft().getCurrentServerData().serverIP;
|
||||
final String regex = "^(?:.*\\.)?ruhypixel\\.(?:net)\\.?";
|
||||
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
|
||||
|
||||
return (serverUrl.getHost().toString().toLowerCase().equals("ruhypixel.net"));
|
||||
return pattern.matcher(serverIp).matches();
|
||||
} catch (Exception err) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user