3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

Blame a class when the childHandler doesn't inject

Dieser Commit ist enthalten in:
Myles 2016-03-06 16:16:26 +00:00
Ursprung ea4650000e
Commit c404f2206c

Datei anzeigen

@ -87,9 +87,15 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
ChannelFuture future = (ChannelFuture) o; ChannelFuture future = (ChannelFuture) o;
ChannelPipeline pipeline = future.channel().pipeline(); ChannelPipeline pipeline = future.channel().pipeline();
ChannelHandler bootstrapAcceptor = pipeline.first(); ChannelHandler bootstrapAcceptor = pipeline.first();
ChannelInitializer<SocketChannel> oldInit = ReflectionUtil.get(bootstrapAcceptor, "childHandler", ChannelInitializer.class); try {
ChannelInitializer newInit = new ViaVersionInitializer(oldInit); ChannelInitializer<SocketChannel> oldInit = ReflectionUtil.get(bootstrapAcceptor, "childHandler", ChannelInitializer.class);
ReflectionUtil.set(bootstrapAcceptor, "childHandler", newInit); ChannelInitializer newInit = new ViaVersionInitializer(oldInit);
ReflectionUtil.set(bootstrapAcceptor, "childHandler", newInit);
} catch (NoSuchFieldException e) {
// field not found
throw new Exception("Unable to find childHandler, blame " + bootstrapAcceptor.getClass().getName());
}
injected = true; injected = true;
} else { } else {
break; // not the right list. break; // not the right list.
@ -167,7 +173,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
return true; return true;
} }
}); });
if(wait){ if (wait) {
f.get(10, TimeUnit.SECONDS); f.get(10, TimeUnit.SECONDS);
} }
} catch (Exception e) { } catch (Exception e) {