We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05be7d7 commit 89e1e19Copy full SHA for 89e1e19
1 file changed
src/client/java/com/lnlfly/util/ServerUtil.java
@@ -0,0 +1,24 @@
1
+package com.lnlfly.util;
2
+
3
+import com.lnlfly.config.ModConfig;
4
5
+public class ServerUtil {
6
+ public static String normalizeHost(String address) {
7
+ if (address == null) return "";
8
+ String value = address.trim();
9
+ int colon = value.indexOf(':');
10
+ if (colon > 0 && value.indexOf(']') < 0) {
11
+ return value.substring(0, colon);
12
+ }
13
+ return value;
14
15
16
+ public static boolean isTargetServer(String address) {
17
+ String target = ModConfig.get().targetServerAddress;
18
+ if (target == null) return false;
19
20
+ String targetHost = normalizeHost(target);
21
+ String host = normalizeHost(address);
22
+ return !targetHost.isEmpty() && targetHost.equalsIgnoreCase(host);
23
24
+}
0 commit comments