Skip to content

Commit

Permalink
Fire PlayerSettingsChangedEvent event when PlayerSettings are provide…
Browse files Browse the repository at this point in the history
…d in the Configuration phase (#1118)
  • Loading branch information
4drian3d authored Oct 29, 2023
1 parent f87b05a commit 2e8ef8b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public boolean handle(KeepAlive packet) {

@Override
public boolean handle(ClientSettings packet) {
player.setClientSettingsPacket(packet);
player.setClientSettings(packet);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public boolean handle(KeepAlive packet) {

@Override
public boolean handle(ClientSettings packet) {
player.setPlayerSettings(packet);
player.setClientSettings(packet);
VelocityServerConnection serverConnection = player.getConnectedServer();
if (serverConnection == null) {
// No server connection yet, probably transitioning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,14 @@ public boolean hasSentPlayerSettings() {
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;
}

void setPlayerSettings(ClientSettings settings) {
ClientSettingsWrapper cs = new ClientSettingsWrapper(settings);
final ClientSettingsWrapper cs = new ClientSettingsWrapper(clientSettingsPacket);
this.settings = cs;
server.getEventManager().fireAndForget(new PlayerSettingsChangedEvent(this, cs));
}
Expand Down

0 comments on commit 2e8ef8b

Please sign in to comment.