From 1504488989ba43b09a9b4cd83a5d80a918270713 Mon Sep 17 00:00:00 2001 From: Andrew121410 Date: Fri, 7 Feb 2025 00:11:21 -0500 Subject: [PATCH] MSP - try to be smart with the detection of an offline server. --- .../andrew121410/ccbot/msp/MCServerPingerManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ccbot-core/src/main/java/com/andrew121410/ccbot/msp/MCServerPingerManager.java b/ccbot-core/src/main/java/com/andrew121410/ccbot/msp/MCServerPingerManager.java index 37991de..b88af43 100644 --- a/ccbot-core/src/main/java/com/andrew121410/ccbot/msp/MCServerPingerManager.java +++ b/ccbot-core/src/main/java/com/andrew121410/ccbot/msp/MCServerPingerManager.java @@ -183,6 +183,16 @@ private MinecraftServerStatus getServerStatus(AMinecraftServer aMinecraftServer) try { MCPingResponse response = MCPing.getPing(options); + // Try to be smart sometimes the proxy might be online but the server is offline. + // Test to see if the description has the word "offline" or "maintenance" in it. + if (response.getDescription() != null) { + String description = response.getDescription().getStrippedText(); + if (description.contains("offline") || description.contains("maintenance")) { + System.out.println("MSP - Smart detection: " + aMinecraftServer.getIp() + ":" + aMinecraftServer.getPort() + " is offline."); + return new MinecraftServerStatus(false, null); + } + } + // Save the icon saveIcon(aMinecraftServer, response.getFavicon());