mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-22 11:55:24 +01:00
Added ClientLoggedInEvent
This commit is contained in:
parent
75c0434ceb
commit
52792c6964
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
|
||||
* Copyright (C) 2023 RK_01/RaphiMC and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.raphimc.viaproxy.plugins.events;
|
||||
|
||||
import net.raphimc.viaproxy.proxy.session.ProxyConnection;
|
||||
|
||||
public class ClientLoggedInEvent {
|
||||
|
||||
private final ProxyConnection proxyConnection;
|
||||
|
||||
public ClientLoggedInEvent(final ProxyConnection proxyConnection) {
|
||||
this.proxyConnection = proxyConnection;
|
||||
}
|
||||
|
||||
public ProxyConnection getProxyConnection() {
|
||||
return this.proxyConnection;
|
||||
}
|
||||
|
||||
}
|
@ -30,6 +30,8 @@ import net.raphimc.netminecraft.packet.impl.login.*;
|
||||
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.ProtocolMetadataStorage;
|
||||
import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.viaproxy.cli.options.Options;
|
||||
import net.raphimc.viaproxy.plugins.PluginManager;
|
||||
import net.raphimc.viaproxy.plugins.events.ClientLoggedInEvent;
|
||||
import net.raphimc.viaproxy.proxy.LoginState;
|
||||
import net.raphimc.viaproxy.proxy.external_interface.AuthLibServices;
|
||||
import net.raphimc.viaproxy.proxy.external_interface.ExternalInterface;
|
||||
@ -91,6 +93,7 @@ public class LoginPacketHandler extends PacketHandler {
|
||||
if (Options.ONLINE_MODE) {
|
||||
this.proxyConnection.getC2P().writeAndFlush(new S2CLoginKeyPacket1_8("", KEY_PAIR.getPublic().getEncoded(), this.verifyToken)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||||
} else {
|
||||
PluginManager.EVENT_MANAGER.call(new ClientLoggedInEvent(proxyConnection));
|
||||
ExternalInterface.fillPlayerData(this.proxyConnection);
|
||||
this.proxyConnection.getChannel().writeAndFlush(this.proxyConnection.getLoginHelloPacket()).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||||
}
|
||||
@ -133,6 +136,7 @@ public class LoginPacketHandler extends PacketHandler {
|
||||
throw new RuntimeException("Failed to make session request for user '" + userName + "'!", e);
|
||||
}
|
||||
|
||||
PluginManager.EVENT_MANAGER.call(new ClientLoggedInEvent(proxyConnection));
|
||||
ExternalInterface.fillPlayerData(this.proxyConnection);
|
||||
this.proxyConnection.getChannel().writeAndFlush(this.proxyConnection.getLoginHelloPacket()).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user