Skip to content

Commit

Permalink
MSP - try to be smart with the detection of an offline server.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew121410 committed Feb 7, 2025
1 parent 8885c99 commit 1504488
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit 1504488

Please sign in to comment.