Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Fire PlayerSettingsChangedEvent event when PlayerSettings are provided in the Configuration phase (#1118)
Dieser Commit ist enthalten in:
Ursprung
f87b05a487
Commit
2e8ef8b2ca
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren