diff options
Diffstat (limited to 'src/main/java/dev/isxander/yacl/impl')
3 files changed, 23 insertions, 12 deletions
diff --git a/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java b/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java index 7d856b0..dcb9c7a 100644 --- a/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java +++ b/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java @@ -114,6 +114,11 @@ public class ButtonOptionImpl implements ButtonOption { } @Override + public boolean isPendingValueDefault() { + throw new UnsupportedOperationException(); + } + + @Override public void addListener(BiConsumer<Option<BiConsumer<YACLScreen, ButtonOption>>, BiConsumer<YACLScreen, ButtonOption>> changedListener) { } diff --git a/src/main/java/dev/isxander/yacl/impl/OptionImpl.java b/src/main/java/dev/isxander/yacl/impl/OptionImpl.java index 98a2f48..c76f115 100644 --- a/src/main/java/dev/isxander/yacl/impl/OptionImpl.java +++ b/src/main/java/dev/isxander/yacl/impl/OptionImpl.java @@ -125,12 +125,17 @@ public class OptionImpl<T> implements Option<T> { @Override public void forgetPendingValue() { - pendingValue = binding().getValue(); + requestSet(binding().getValue()); } @Override public void requestSetDefault() { - pendingValue = binding().defaultValue(); + requestSet(binding().defaultValue()); + } + + @Override + public boolean isPendingValueDefault() { + return binding().defaultValue().equals(pendingValue()); } @Override diff --git a/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java b/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java index 76a5868..6c7508d 100644 --- a/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java +++ b/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java @@ -1,8 +1,9 @@ package dev.isxander.yacl.impl.utils; import dev.isxander.yacl.api.utils.Dimension; +import dev.isxander.yacl.api.utils.MutableDimension; -public class DimensionIntegerImpl implements Dimension<Integer> { +public class DimensionIntegerImpl implements MutableDimension<Integer> { private int x, y; private int width, height; @@ -59,14 +60,14 @@ public class DimensionIntegerImpl implements Dimension<Integer> { } @Override - public Dimension<Integer> clone() { + public MutableDimension<Integer> clone() { return new DimensionIntegerImpl(x, y, width, height); } - @Override public Dimension<Integer> setX(Integer x) { this.x = x; return this; } - @Override public Dimension<Integer> setY(Integer y) { this.y = y; return this; } - @Override public Dimension<Integer> setWidth(Integer width) { this.width = width; return this; } - @Override public Dimension<Integer> setHeight(Integer height) { this.height = height; return this; } + @Override public MutableDimension<Integer> setX(Integer x) { this.x = x; return this; } + @Override public MutableDimension<Integer> setY(Integer y) { this.y = y; return this; } + @Override public MutableDimension<Integer> setWidth(Integer width) { this.width = width; return this; } + @Override public MutableDimension<Integer> setHeight(Integer height) { this.height = height; return this; } @Override public Dimension<Integer> withX(Integer x) { @@ -80,23 +81,23 @@ public class DimensionIntegerImpl implements Dimension<Integer> { @Override public Dimension<Integer> withWidth(Integer width) { - return clone().withWidth(width); + return clone().setWidth(width); } @Override public Dimension<Integer> withHeight(Integer height) { - return clone().withHeight(height); + return clone().setHeight(height); } @Override - public Dimension<Integer> move(Integer x, Integer y) { + public MutableDimension<Integer> move(Integer x, Integer y) { this.x += x; this.y += y; return this; } @Override - public Dimension<Integer> expand(Integer width, Integer height) { + public MutableDimension<Integer> expand(Integer width, Integer height) { this.width += width; this.height += height; return this; |