Skip to content

Commit 6b00216

Browse files
committed
Updated Beta2Release to 1.0.6-SNAPSHOT
1 parent f45bd9c commit 6b00216

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ repositories {
5454
dependencies {
5555
implementation "net.raphimc:ViaProxy:3.3.5"
5656

57-
include "dev.mzga:Beta2Release:1.0.5-SNAPSHOT"
57+
include "dev.mzga:Beta2Release:1.0.6-SNAPSHOT"
5858
}
5959

6060
processResources {

src/main/java/net/raphimc/b2rplugin/Beta2ReleasePlugin.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package net.raphimc.b2rplugin;
1919

20+
import com.github.dirtpowered.betatorelease.network.session.BetaPlayer;
2021
import io.netty.buffer.ByteBuf;
2122
import io.netty.channel.ChannelHandlerContext;
2223
import io.netty.channel.SimpleChannelInboundHandler;
@@ -32,10 +33,12 @@
3233
import net.raphimc.viaproxy.util.logging.Logger;
3334

3435
import java.io.File;
36+
import java.util.List;
3537

3638
public 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

Comments
 (0)