From 33a06e6501fc7adfdc6c6653743f370bf92c9499 Mon Sep 17 00:00:00 2001 From: ix0rai Date: Sat, 25 May 2024 17:01:11 -0500 Subject: [PATCH] new save button behaviour @orifu --- .../io/ix0rai/rainglow/config/CustomModeScreen.java | 2 +- .../ix0rai/rainglow/config/RainglowConfigScreen.java | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java b/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java index aa74a05..95a7a25 100644 --- a/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java +++ b/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java @@ -40,7 +40,6 @@ public CustomModeScreen(Screen parent) { sendNoColoursToast(); } else { this.save(); - this.closeScreen(); } }).build(); this.saveButton.active = false; @@ -72,6 +71,7 @@ private void save() { } Rainglow.CONFIG.save(); + this.saveButton.active = false; } @Override diff --git a/src/main/java/io/ix0rai/rainglow/config/RainglowConfigScreen.java b/src/main/java/io/ix0rai/rainglow/config/RainglowConfigScreen.java index 6293435..902da74 100644 --- a/src/main/java/io/ix0rai/rainglow/config/RainglowConfigScreen.java +++ b/src/main/java/io/ix0rai/rainglow/config/RainglowConfigScreen.java @@ -45,10 +45,7 @@ public RainglowConfigScreen(@Nullable Screen parent) { super(TITLE); this.parent = parent; this.mode = RainglowMode.get(Rainglow.CONFIG.mode.getRealValue()); - this.saveButton = ButtonWidget.builder(Rainglow.translatableText("config.save"), button -> { - this.save(); - this.closeScreen(true); - }).build(); + this.saveButton = ButtonWidget.builder(Rainglow.translatableText("config.save"), button -> this.save()).build(); this.saveButton.active = false; } @@ -158,6 +155,7 @@ private void save() { } Rainglow.CONFIG.mode.setValue(this.mode.getId()); + this.saveButton.active = false; } private Tooltip createColourListLabel(RainglowMode mode) { @@ -192,11 +190,7 @@ private Tooltip createColourListLabel(RainglowMode mode) { @Override public void closeScreen() { - this.closeScreen(false); - } - - public void closeScreen(boolean saved) { - if (!saved && this.saveButton.active) { + if (this.saveButton.active) { this.isConfirming = true; this.clearAndInit(); } else {