1717 */
1818package net .raphimc .b2rplugin ;
1919
20+ import com .github .dirtpowered .betatorelease .network .session .BetaPlayer ;
2021import io .netty .buffer .ByteBuf ;
2122import io .netty .channel .ChannelHandlerContext ;
2223import io .netty .channel .SimpleChannelInboundHandler ;
3233import net .raphimc .viaproxy .util .logging .Logger ;
3334
3435import java .io .File ;
36+ import java .util .List ;
3537
3638public class Beta2ReleasePlugin extends ViaProxyPlugin {
3739
3840 public static final File ROOT_FOLDER = new File (PluginManager .PLUGINS_DIR , "Beta2Release" );
41+ private List <BetaPlayer > b2rPlayers ;
3942
4043 @ Override
4144 public void onEnable () {
@@ -50,7 +53,9 @@ public void onEnable() {
5053 injectionClassLoader .getTransformerManager ().addTransformer ("net.raphimc.b2rplugin.mixins.MixinServer" );
5154
5255 try {
53- RStream .of (injectionClassLoader .loadClass ("com.github.dirtpowered.betatorelease.Main" )).methods ().by ("main" ).invoke ();
56+ final Class <?> mainClass = injectionClassLoader .loadClass ("com.github.dirtpowered.betatorelease.Main" );
57+ RStream .of (mainClass ).methods ().by ("main" ).invoke ();
58+ this .b2rPlayers = RStream .of (mainClass ).fields ().by ("server" ).stream ().fields ().by ("onlinePlayers" ).get ();
5459 } catch (Throwable e ) {
5560 throw new RuntimeException ("Failed to start Beta2Release" , e );
5661 }
@@ -82,4 +87,13 @@ protected void channelRead0(final ChannelHandlerContext ctx, final ByteBuf msg)
8287 });
8388 }
8489
90+ /*@EventHandler
91+ private void onShouldVerifyOnlineModeEvent(final ShouldVerifyOnlineModeEvent event) {
92+ final String username = event.getProxyConnection().getGameProfile().getName();
93+ if (username == null) return;
94+
95+ final var connection = this.b2rPlayers.stream().filter(p -> p.getSession().getPlayerName().equals(username)).findAny().orElse(null);
96+ if (connection == null) return;
97+ }*/
98+
8599}
0 commit comments