fix: don't save if profile deleted

This commit is contained in:
trafficlunar 2025-07-31 19:59:22 +01:00
parent cc1dd4f766
commit 0bc9cd5fa2

View file

@ -107,7 +107,7 @@ public class EditProfileScreen extends Screen {
.withStyle(ChatFormatting.RED), .withStyle(ChatFormatting.RED),
(button) -> { (button) -> {
Profiles.deleteProfile(profileName.getString()); Profiles.deleteProfile(profileName.getString());
this.onClose(); this.onClose(true);
}) })
.width(50) .width(50)
.build(), .build(),
@ -122,8 +122,14 @@ public class EditProfileScreen extends Screen {
this.layout.arrangeElements(); this.layout.arrangeElements();
} }
@Override
public void onClose() { public void onClose() {
this.profileConfiguration.save(); this.onClose(false);
}
public void onClose(boolean deleted) {
if (!deleted)
this.profileConfiguration.save();
this.minecraft.setScreen(this.profilesScreen); this.minecraft.setScreen(this.profilesScreen);
this.profilesScreen.profilesList.refreshEntries(); this.profilesScreen.profilesList.refreshEntries();
} }