diff options
author | xander <xander@isxander.dev> | 2022-09-05 19:16:17 +0100 |
---|---|---|
committer | xander <xander@isxander.dev> | 2022-09-05 19:16:24 +0100 |
commit | 4a524a13e9c003dbd27c60ff937c7e86e29c4f9e (patch) | |
tree | f285a293bdd130354aac58ac22c9d93786581dbb /src/main/java/dev/isxander/yacl/gui/YACLScreen.java | |
parent | 6dd21acc75fb5f334df724db4fbc0582dd901876 (diff) | |
download | YetAnotherConfigLib-4a524a13e9c003dbd27c60ff937c7e86e29c4f9e.tar.gz YetAnotherConfigLib-4a524a13e9c003dbd27c60ff937c7e86e29c4f9e.tar.bz2 YetAnotherConfigLib-4a524a13e9c003dbd27c60ff937c7e86e29c4f9e.zip |
require restart attribute
Diffstat (limited to 'src/main/java/dev/isxander/yacl/gui/YACLScreen.java')
-rw-r--r-- | src/main/java/dev/isxander/yacl/gui/YACLScreen.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/YACLScreen.java b/src/main/java/dev/isxander/yacl/gui/YACLScreen.java index ccd3929..986a4f6 100644 --- a/src/main/java/dev/isxander/yacl/gui/YACLScreen.java +++ b/src/main/java/dev/isxander/yacl/gui/YACLScreen.java @@ -69,7 +69,12 @@ public class YACLScreen extends Screen { saveButtonMessage = null; if (pendingChanges()) { - OptionUtils.forEachOptions(config, Option::applyValue); + AtomicBoolean requiresRestart = new AtomicBoolean(false); + OptionUtils.forEachOptions(config, option -> { + if (option.requiresRestart()) + requiresRestart.set(true); + option.applyValue(); + }); OptionUtils.forEachOptions(config, option -> { if (option.changed()) { YACLConstants.LOGGER.error("Option '{}' was saved as '{}' but the changes don't seem to have applied.", option.name().getString(), option.pendingValue()); @@ -77,6 +82,9 @@ public class YACLScreen extends Screen { } }); config.saveFunction().run(); + if (requiresRestart.get()) { + client.setScreen(new RequireRestartScreen(this)); + } } else close(); }); actionDim.expand(-actionDim.width() / 2 - 2, 0).move(-actionDim.width() / 2 - 2, -22); |