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
  • Loading branch information
4drian3d committed Oct 19, 2023
1 parent f884e04 commit 77b9265
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 @@ -84,7 +84,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 77b9265

Please sign in to comment.