diff --git a/src/main/java/net/raphimc/viaproxy/plugins/events/FillPlayerDataEvent.java b/src/main/java/net/raphimc/viaproxy/plugins/events/FillPlayerDataEvent.java new file mode 100644 index 0000000..cf11743 --- /dev/null +++ b/src/main/java/net/raphimc/viaproxy/plugins/events/FillPlayerDataEvent.java @@ -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 . + */ +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; + } + +} diff --git a/src/main/java/net/raphimc/viaproxy/proxy/external_interface/ExternalInterface.java b/src/main/java/net/raphimc/viaproxy/proxy/external_interface/ExternalInterface.java index 54ad862..1be9670 100644 --- a/src/main/java/net/raphimc/viaproxy/proxy/external_interface/ExternalInterface.java +++ b/src/main/java/net/raphimc/viaproxy/proxy/external_interface/ExternalInterface.java @@ -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.viaprotocolhack.util.VersionEnum; 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_1; 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(); if (proxyConnection.getLoginHelloPacket() instanceof C2SLoginHelloPacket1_19_3) { ((C2SLoginHelloPacket1_19_3) proxyConnection.getLoginHelloPacket()).uuid = proxyConnection.getGameProfile().getId();