Archiviert
13
0

Print a warning message instead of crashing.

We shouldn't prevent a plugin from adding packet listeners just because
the plugin verifier failed.
Dieser Commit ist enthalten in:
Kristian S. Stangeland 2013-06-23 21:56:53 +02:00
Ursprung 8d0e8139de
Commit ef4476a72e

Datei anzeigen

@ -85,6 +85,7 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
public static final ReportType REPORT_CANNOT_INJECT_PLAYER = new ReportType("Unable to inject player."); public static final ReportType REPORT_CANNOT_INJECT_PLAYER = new ReportType("Unable to inject player.");
public static final ReportType REPORT_CANNOT_UNREGISTER_PLUGIN = new ReportType("Unable to handle disabled plugin."); public static final ReportType REPORT_CANNOT_UNREGISTER_PLUGIN = new ReportType("Unable to handle disabled plugin.");
public static final ReportType REPORT_PLUGIN_VERIFIER_ERROR = new ReportType("Verifier error: %s");
/** /**
* Sets the inject hook type. Different types allow for maximum compatibility. * Sets the inject hook type. Different types allow for maximum compatibility.
@ -298,6 +299,7 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
* @param plugin - plugin to check. * @param plugin - plugin to check.
*/ */
private void printPluginWarnings(Plugin plugin) { private void printPluginWarnings(Plugin plugin) {
try {
switch (pluginVerifier.verify(plugin)) { switch (pluginVerifier.verify(plugin)) {
case NO_DEPEND: case NO_DEPEND:
reporter.reportWarning(this, Report.newBuilder(REPORT_PLUGIN_DEPEND_MISSING).messageParam(plugin.getName())); reporter.reportWarning(this, Report.newBuilder(REPORT_PLUGIN_DEPEND_MISSING).messageParam(plugin.getName()));
@ -305,6 +307,9 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
// Do nothing // Do nothing
break; break;
} }
} catch (IllegalStateException e) {
reporter.reportWarning(this, Report.newBuilder(REPORT_PLUGIN_VERIFIER_ERROR).messageParam(e.getMessage()));
}
} }
@Override @Override