Save room settings with password-locked rooms

This commit is contained in:
Alejandro 2019-05-27 22:32:47 +03:00
parent 860e20ce12
commit 3ec3a6aca6

View File

@ -38,7 +38,7 @@ public class RoomSettingsSaveEvent extends MessageHandler {
RoomState state = RoomState.values()[this.packet.readInt() % RoomState.values().length];
String password = this.packet.readString();
if (state == RoomState.PASSWORD && password.isEmpty()) {
if (state == RoomState.PASSWORD && password.isEmpty() && (room.getPassword() == null || room.getPassword().isEmpty())) {
this.client.sendResponse(new RoomEditSettingsErrorComposer(room.getId(), RoomEditSettingsErrorComposer.PASSWORD_REQUIRED, ""));
return;
}
@ -75,7 +75,7 @@ public class RoomSettingsSaveEvent extends MessageHandler {
room.setName(name);
room.setDescription(description);
room.setState(state);
room.setPassword(password);
if (!password.isEmpty()) room.setPassword(password);
room.setUsersMax(usersMax);