From ba924fcb398e15fc6ed5a48ad7ef865adc82292c Mon Sep 17 00:00:00 2001 From: syeyoung Date: Mon, 27 Feb 2023 21:37:20 +0900 Subject: - Make spam clicking menuitem not insert a billion items into the page stack Signed-off-by: syeyoung --- .../config/guiconfig/configv3/CategoryPageWidget.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 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 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(); + } } -- cgit