aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2023-02-27 21:37:20 +0900
committersyeyoung <cyoung06@naver.com>2023-02-27 21:37:20 +0900
commitba924fcb398e15fc6ed5a48ad7ef865adc82292c (patch)
tree32cfbd44fa013482cacfdba8819872f6b3be135b
parenta2d6eb085cd199f63e97ad1632d4b47e5d94f6aa (diff)
downloadSkyblock-Dungeons-Guide-ba924fcb398e15fc6ed5a48ad7ef865adc82292c.tar.gz
Skyblock-Dungeons-Guide-ba924fcb398e15fc6ed5a48ad7ef865adc82292c.tar.bz2
Skyblock-Dungeons-Guide-ba924fcb398e15fc6ed5a48ad7ef865adc82292c.zip
- Make spam clicking menuitem not insert a billion items into the page stack
Signed-off-by: syeyoung <cyoung06@naver.com>
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryPageWidget.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryPageWidget.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryPageWidget.java
index 8565167a..035b715e 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryPageWidget.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/config/guiconfig/configv3/CategoryPageWidget.java
@@ -39,9 +39,11 @@ public class CategoryPageWidget extends AnnotatedImportOnlyWidget {
public final BindableAttribute categories = new BindableAttribute<>(WidgetList.class);
@Bind(variableName = "categoryShow")
public final BindableAttribute<String > showCategory = new BindableAttribute<>(String.class);
+ private String category;
public CategoryPageWidget(String category) {
super(new ResourceLocation("dungeonsguide:gui/config/categorypage.gui"));
items.setValue(buildMenu(category));
+ this.category = category;
List<Widget> widgets;
categories.setValue(widgets = buildCategory(category));
showCategory.setValue(widgets.isEmpty() ? "hide" : "show");
@@ -62,4 +64,19 @@ public class CategoryPageWidget extends AnnotatedImportOnlyWidget {
a -> new FeatureItem(a)
).collect(Collectors.toList());
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ CategoryPageWidget that = (CategoryPageWidget) o;
+
+ return category.equals(that.category);
+ }
+
+ @Override
+ public int hashCode() {
+ return category.hashCode();
+ }
}