Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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