Added new events

This commit is contained in:
RaphiMC 2023-02-01 22:23:21 +01:00
parent 49cbab9685
commit 111d47cb42
2 changed files with 38 additions and 0 deletions

View File

@ -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.ProxyConnection;
public class FillPlayerDataEvent {
private final ProxyConnection proxyConnection;
public FillPlayerDataEvent(final ProxyConnection proxyConnection) {
this.proxyConnection = proxyConnection;
}
public ProxyConnection getProxyConnection() {
return this.proxyConnection;
}
}

View File

@ -36,6 +36,8 @@ import net.raphimc.netminecraft.packet.impl.login.C2SLoginHelloPacket1_7;
import net.raphimc.netminecraft.packet.impl.login.C2SLoginKeyPacket1_19; import net.raphimc.netminecraft.packet.impl.login.C2SLoginKeyPacket1_19;
import net.raphimc.viaprotocolhack.util.VersionEnum; import net.raphimc.viaprotocolhack.util.VersionEnum;
import net.raphimc.viaproxy.cli.options.Options; import net.raphimc.viaproxy.cli.options.Options;
import net.raphimc.viaproxy.plugins.PluginManager;
import net.raphimc.viaproxy.plugins.events.FillPlayerDataEvent;
import net.raphimc.viaproxy.protocolhack.viaproxy.signature.storage.ChatSession1_19_0; import net.raphimc.viaproxy.protocolhack.viaproxy.signature.storage.ChatSession1_19_0;
import net.raphimc.viaproxy.protocolhack.viaproxy.signature.storage.ChatSession1_19_1; import net.raphimc.viaproxy.protocolhack.viaproxy.signature.storage.ChatSession1_19_1;
import net.raphimc.viaproxy.protocolhack.viaproxy.signature.storage.ChatSession1_19_3; import net.raphimc.viaproxy.protocolhack.viaproxy.signature.storage.ChatSession1_19_3;
@ -112,6 +114,8 @@ public class ExternalInterface {
} }
} }
PluginManager.EVENT_MANAGER.call(new FillPlayerDataEvent(proxyConnection));
proxyConnection.getLoginHelloPacket().name = proxyConnection.getGameProfile().getName(); proxyConnection.getLoginHelloPacket().name = proxyConnection.getGameProfile().getName();
if (proxyConnection.getLoginHelloPacket() instanceof C2SLoginHelloPacket1_19_3) { if (proxyConnection.getLoginHelloPacket() instanceof C2SLoginHelloPacket1_19_3) {
((C2SLoginHelloPacket1_19_3) proxyConnection.getLoginHelloPacket()).uuid = proxyConnection.getGameProfile().getId(); ((C2SLoginHelloPacket1_19_3) proxyConnection.getLoginHelloPacket()).uuid = proxyConnection.getGameProfile().getId();