Skip to content

Commit fa23a27

Browse files
committed
Pass UUID to ViaProxy
1 parent 78332a6 commit fa23a27

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package net.raphimc.b2rplugin;
1919

2020
import com.github.dirtpowered.betatorelease.network.session.BetaPlayer;
21+
import com.mojang.authlib.GameProfile;
22+
import com.mojang.util.UUIDTypeAdapter;
2123
import io.netty.buffer.ByteBuf;
2224
import io.netty.channel.ChannelHandlerContext;
2325
import io.netty.channel.SimpleChannelInboundHandler;
@@ -97,7 +99,9 @@ private void onShouldVerifyOnlineModeEvent(final ShouldVerifyOnlineModeEvent eve
9799
final String username = event.getProxyConnection().getGameProfile().getName();
98100
if (username == null) return;
99101

100-
if (this.b2rPlayers.stream().anyMatch(p -> p.getSession().getPlayerName().equals(username))) {
102+
final BetaPlayer player = this.b2rPlayers.stream().filter(p -> p.getSession().getPlayerName().equals(username)).findFirst().orElse(null);
103+
if (player != null && player.getUuid() != null) {
104+
event.getProxyConnection().setGameProfile(new GameProfile(UUIDTypeAdapter.fromString(player.getUuid()), username));
101105
event.setCancelled(true);
102106
}
103107
}

0 commit comments

Comments
 (0)