Skip to content

Commit

Permalink
fix default button flooding all buttons in SimpleButtonMap
Browse files Browse the repository at this point in the history
  • Loading branch information
HSGamer committed Jun 29, 2024
1 parent 9a1e9b5 commit 116867b
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,18 @@ public void stop() {
Map<Integer, DisplayButton> map = new HashMap<>();
IntFunction<DisplayButton> getDisplayButton = i -> map.computeIfAbsent(i, s -> new DisplayButton());

buttonSlotMap.forEach((button, slots) -> {
DisplayButton displayButton = button.display(uuid);
if (displayButton == null) return;
slots.forEach(slot -> getDisplayButton.apply(slot).apply(displayButton));
});

Button defaultButton = getDefaultButton();
DisplayButton defaultDisplayButton = defaultButton.display(uuid);
if (defaultDisplayButton != null) {
inventorySize.getSlots().forEach(i -> getDisplayButton.apply(i).apply(defaultDisplayButton));
}

buttonSlotMap.forEach((button, slots) -> {
DisplayButton displayButton = button.display(uuid);
if (displayButton == null) return;
slots.forEach(slot -> getDisplayButton.apply(slot).apply(displayButton));
});

return map;
}
}

0 comments on commit 116867b

Please sign in to comment.