3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00

Fire PlayerSettingsChangedEvent event when PlayerSettings are provided in the Configuration phase (#1118)

Dieser Commit ist enthalten in:
Adrian 2023-10-29 13:44:04 -05:00 committet von GitHub
Ursprung f87b05a487
Commit 2e8ef8b2ca
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 9 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -87,7 +87,7 @@ public class ClientConfigSessionHandler implements MinecraftSessionHandler {
@Override @Override
public boolean handle(ClientSettings packet) { public boolean handle(ClientSettings packet) {
player.setClientSettingsPacket(packet); player.setClientSettings(packet);
return true; return true;
} }

Datei anzeigen

@ -186,7 +186,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
@Override @Override
public boolean handle(ClientSettings packet) { public boolean handle(ClientSettings packet) {
player.setPlayerSettings(packet); player.setClientSettings(packet);
VelocityServerConnection serverConnection = player.getConnectedServer(); VelocityServerConnection serverConnection = player.getConnectedServer();
if (serverConnection == null) { if (serverConnection == null) {
// No server connection yet, probably transitioning. // No server connection yet, probably transitioning.

Datei anzeigen

@ -282,12 +282,14 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
return settings != null; return settings != null;
} }
public void setClientSettingsPacket(ClientSettings clientSettingsPacket) { /**
* Sets player settings.
*
* @param clientSettingsPacket the player settings packet
*/
public void setClientSettings(final ClientSettings clientSettingsPacket) {
this.clientSettingsPacket = clientSettingsPacket; this.clientSettingsPacket = clientSettingsPacket;
} final ClientSettingsWrapper cs = new ClientSettingsWrapper(clientSettingsPacket);
void setPlayerSettings(ClientSettings settings) {
ClientSettingsWrapper cs = new ClientSettingsWrapper(settings);
this.settings = cs; this.settings = cs;
server.getEventManager().fireAndForget(new PlayerSettingsChangedEvent(this, cs)); server.getEventManager().fireAndForget(new PlayerSettingsChangedEvent(this, cs));
} }