fix webhook validation and change readme

This commit is contained in:
mangorifo
2023-03-29 16:36:55 +08:00
parent 4a5fb14339
commit ef7609dccf
5 changed files with 31 additions and 8 deletions
+5 -3
View File
@@ -11,7 +11,7 @@ public class ServerUtils {
public static String address_fallback = Utils.getServerHostPublicIP();
public static String webhook_notify = Main.getNotifyWebhook();
public static String webhook_messages = Main.getPublicMessageWebhook();
public static String address = "http://mc-srv2-singapore.rrryfoo.cf";
public static String address = "mc-srv2-singapore.rrryfoo.cf";
public static boolean serverIsUp(String serverAddress, Integer serverPort) {
/*Socket socket;
@@ -33,9 +33,9 @@ public class ServerUtils {
try {
Server server = Bukkit.getServer();
Socket s = new Socket();
s.connect(new InetSocketAddress(serverAddress.toString(), Integer.parseInt(serverPort.toString())), 15);
s.connect(new InetSocketAddress(serverAddress, Integer.parseInt(serverPort.toString())), 15);
s.close();
System.out.println("Server is online. Sending message to webhook_notify... (Pinged " + Utils.getServerHostPublicIP() + ":" + server.getPort() + ")");
System.out.println("Server is online. Sending message to webhook_notify... (Pinged " + serverAddress + ":" + server.getPort() + ")");
return true;
} catch (Exception e) {
System.out.println("Server is inactive. Pinging fallback address...");
@@ -44,6 +44,8 @@ public class ServerUtils {
Socket s = new Socket();
s.connect(new InetSocketAddress(address_fallback, Integer.parseInt(serverPort.toString())), 15);
s.close();
System.out.println("Server is online. Sending message to webhook_notify... (Pinged " + Utils.getServerHostPublicIP() + ":" + server.getPort() + ")");
return true;
} catch (Exception err) {
System.out.println("Fallback address is inactive. No longer pinging...");
}