fix injection exception when plugin is disabled (#1798)
This commit is contained in:
parent
7ddfd4f347
commit
a75d383001
|
@ -31,14 +31,19 @@ final class InjectionChannelInboundHandler extends ChannelInboundHandlerAdapter
|
||||||
ctx.fireChannelActive();
|
ctx.fireChannelActive();
|
||||||
|
|
||||||
// the channel is now active, at this point minecraft has eventually prepared everything in the connection
|
// the channel is now active, at this point minecraft has eventually prepared everything in the connection
|
||||||
// of the player so that we can come in and hook as we are after the minecraft handler
|
// of the player so that we can come in and hook as we are after the minecraft handler.
|
||||||
try {
|
// We're first checking if the factory is still open, just might be a delay between accepting the connection
|
||||||
this.factory.fromChannel(ctx.channel(), this.listener, this.playerFactory).inject();
|
// (which adds this handler to the pipeline) and the actual channelActive call. If the injector is closed at
|
||||||
} catch (Exception exception) {
|
// that point we might accidentally trigger class loads which result in exceptions.
|
||||||
this.listener.getReporter().reportDetailed(this.listener, Report.newBuilder(CANNOT_INJECT_CHANNEL)
|
if (!this.factory.isClosed()) {
|
||||||
.messageParam(ctx.channel())
|
try {
|
||||||
.error(exception)
|
this.factory.fromChannel(ctx.channel(), this.listener, this.playerFactory).inject();
|
||||||
.build());
|
} catch (Exception exception) {
|
||||||
|
this.listener.getReporter().reportDetailed(this, Report.newBuilder(CANNOT_INJECT_CHANNEL)
|
||||||
|
.messageParam(ctx.channel())
|
||||||
|
.error(exception)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove this handler from the pipeline now to prevent multiple injections
|
// remove this handler from the pipeline now to prevent multiple injections
|
||||||
|
|
Loading…
Reference in New Issue