diff options
author | isxander <xander@isxander.dev> | 2023-11-22 17:14:40 +0000 |
---|---|---|
committer | isxander <xander@isxander.dev> | 2023-11-22 17:14:40 +0000 |
commit | 575fda29ea55fd6c2b5d9921a44f3e74c57dd1af (patch) | |
tree | 7c7afeeade547aba5ec7d9267cdcd147f3b1473f | |
parent | 4cdfa58b27d790786cbb2f17aa8f4635ea9d5a2d (diff) | |
download | YetAnotherConfigLib-575fda29ea55fd6c2b5d9921a44f3e74c57dd1af.tar.gz YetAnotherConfigLib-575fda29ea55fd6c2b5d9921a44f3e74c57dd1af.tar.bz2 YetAnotherConfigLib-575fda29ea55fd6c2b5d9921a44f3e74c57dd1af.zip |
Forget the pending value of options when they become unavailable.
-rw-r--r-- | common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java b/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java index e539f73..afe9517 100644 --- a/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java +++ b/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java @@ -89,8 +89,12 @@ public final class OptionImpl<T> implements Option<T> { this.available = available; - if (changed) - this.triggerListeners(false); + if (changed) { + if (!available) { + this.pendingValue = binding().getValue(); + } + this.triggerListeners(!available); + } } @Override |