mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-26 12:35:11 +01:00
Actually fixed event to skip Mojang auth
This commit is contained in:
parent
2a662bd93b
commit
e2c712239c
@ -20,11 +20,11 @@ package net.raphimc.viaproxy.plugins.events;
|
||||
import net.raphimc.viaproxy.plugins.events.types.EventCancellable;
|
||||
import net.raphimc.viaproxy.proxy.session.ProxyConnection;
|
||||
|
||||
public class PreMojangAuthEvent extends EventCancellable {
|
||||
public class ShouldVerifyOnlineModeEvent extends EventCancellable {
|
||||
|
||||
private final ProxyConnection proxyConnection;
|
||||
|
||||
public PreMojangAuthEvent(final ProxyConnection proxyConnection) {
|
||||
public ShouldVerifyOnlineModeEvent(final ProxyConnection proxyConnection) {
|
||||
this.proxyConnection = proxyConnection;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.viaproxy.ViaProxy;
|
||||
import net.raphimc.viaproxy.cli.options.Options;
|
||||
import net.raphimc.viaproxy.plugins.events.ClientLoggedInEvent;
|
||||
import net.raphimc.viaproxy.plugins.events.PreMojangAuthEvent;
|
||||
import net.raphimc.viaproxy.plugins.events.ShouldVerifyOnlineModeEvent;
|
||||
import net.raphimc.viaproxy.proxy.LoginState;
|
||||
import net.raphimc.viaproxy.proxy.external_interface.AuthLibServices;
|
||||
import net.raphimc.viaproxy.proxy.external_interface.ExternalInterface;
|
||||
@ -92,7 +92,7 @@ public class LoginPacketHandler extends PacketHandler {
|
||||
proxyConnection.setGameProfile(new GameProfile(null, loginHelloPacket.name));
|
||||
}
|
||||
|
||||
if (Options.ONLINE_MODE) {
|
||||
if (Options.ONLINE_MODE && !ViaProxy.EVENT_MANAGER.call(new ShouldVerifyOnlineModeEvent(this.proxyConnection)).isCancelled()) {
|
||||
this.proxyConnection.getC2P().writeAndFlush(new S2CLoginKeyPacket1_8("", KEY_PAIR.getPublic().getEncoded(), this.verifyToken)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||||
} else {
|
||||
ViaProxy.EVENT_MANAGER.call(new ClientLoggedInEvent(proxyConnection));
|
||||
@ -122,7 +122,6 @@ public class LoginPacketHandler extends PacketHandler {
|
||||
final SecretKey secretKey = CryptUtil.decryptSecretKey(KEY_PAIR.getPrivate(), loginKeyPacket.encryptedSecretKey);
|
||||
this.proxyConnection.getC2P().attr(MCPipeline.ENCRYPTION_ATTRIBUTE_KEY).set(new AESEncryption(secretKey));
|
||||
|
||||
if (!ViaProxy.EVENT_MANAGER.call(new PreMojangAuthEvent(this.proxyConnection)).isCancelled()) {
|
||||
final String userName = this.proxyConnection.getGameProfile().getName();
|
||||
try {
|
||||
final String serverHash = new BigInteger(CryptUtil.computeServerIdHash("", KEY_PAIR.getPublic(), secretKey)).toString(16);
|
||||
@ -137,7 +136,6 @@ public class LoginPacketHandler extends PacketHandler {
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException("Failed to make session request for user '" + userName + "'!", e);
|
||||
}
|
||||
}
|
||||
|
||||
ViaProxy.EVENT_MANAGER.call(new ClientLoggedInEvent(proxyConnection));
|
||||
ExternalInterface.fillPlayerData(this.proxyConnection);
|
||||
|
Loading…
Reference in New Issue
Block a user