Fix spam in console when a remote server is down

This commit is contained in:
filoghost 2021-12-13 23:40:53 +01:00
parent c1a223a863
commit 6ac35d3d62

View File

@ -17,6 +17,7 @@ import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.concurrent.ConcurrentHashMap;
@ -107,8 +108,9 @@ public class BungeeServerTracker {
return ServerInfo.online(0, 0, "Invalid ping response (" + e.getMessage() + ")");
} catch (IOException e) {
if (e instanceof SocketTimeoutException) {
// Common error, do not log
if (e instanceof SocketTimeoutException || e instanceof ConnectException) {
// Common error, only log when debugging
DebugLogger.warning("Couldn't fetch data from " + serverAddress + ".", e);
} else if (e instanceof UnknownHostException) {
Log.warning("Couldn't fetch data from " + serverAddress + ": unknown host address.");
} else {