diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/CommandProtocol.java b/ProtocolLib/src/main/java/com/comphenix/protocol/CommandProtocol.java index 33328aeb..ef0a3f82 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/CommandProtocol.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/CommandProtocol.java @@ -19,6 +19,7 @@ package com.comphenix.protocol; import java.io.File; import java.io.IOException; +import java.net.UnknownHostException; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -45,7 +46,7 @@ class CommandProtocol extends CommandBase { */ public static final String NAME = "protocol"; - public static final ReportType REPORT_HTTP_ERROR = new ReportType("Http error: %s"); + public static final ReportType REPORT_NETWORK_ERROR = new ReportType("Network error: %s"); public static final ReportType REPORT_CANNOT_CHECK_FOR_UPDATES = new ReportType("Cannot check updates for ProtocolLib."); public static final ReportType REPORT_CANNOT_UPDATE_PLUGIN = new ReportType("Cannot update ProtocolLib."); @@ -87,9 +88,9 @@ class CommandProtocol extends CommandBase { UpdateResult result = updater.update(UpdateType.NO_DOWNLOAD, true); sender.sendMessage(ChatColor.BLUE + "[ProtocolLib] " + result.toString()); } catch (Exception e) { - if (isHttpError(e)) { + if (isNetworkError(e)) { getReporter().reportWarning(CommandProtocol.this, - Report.newBuilder(REPORT_HTTP_ERROR).messageParam(e.getCause().getMessage()) + Report.newBuilder(REPORT_NETWORK_ERROR).messageParam(e.getCause().getMessage()) ); } else { getReporter().reportDetailed(CommandProtocol.this, Report.newBuilder(REPORT_CANNOT_CHECK_FOR_UPDATES).error(e).callerParam(sender)); @@ -110,9 +111,9 @@ class CommandProtocol extends CommandBase { UpdateResult result = updater.update(UpdateType.DEFAULT, true); sender.sendMessage(ChatColor.BLUE + "[ProtocolLib] " + result.toString()); } catch (Exception e) { - if (isHttpError(e)) { + if (isNetworkError(e)) { getReporter().reportWarning(CommandProtocol.this, - Report.newBuilder(REPORT_HTTP_ERROR).messageParam(e.getCause().getMessage()) + Report.newBuilder(REPORT_NETWORK_ERROR).messageParam(e.getCause().getMessage()) ); } else { getReporter().reportDetailed(CommandProtocol.this, Report.newBuilder(REPORT_CANNOT_UPDATE_PLUGIN).error(e).callerParam(sender)); @@ -173,10 +174,13 @@ class CommandProtocol extends CommandBase { } } - private boolean isHttpError(Exception e) { + private boolean isNetworkError(Exception e) { Throwable cause = e.getCause(); - if (cause instanceof IOException) { + if (cause instanceof UnknownHostException) { + // These are always network problems + return true; + } if (cause instanceof IOException) { // Thanks for making the message a part of the API ... return cause.getMessage().contains("HTTP response"); } else {