From 9c0e0584b04708f014db2ac3cc64c92052dbd2fd Mon Sep 17 00:00:00 2001 From: Luke100000 Date: Sat, 27 May 2023 13:15:08 +0200 Subject: [PATCH] fixed double inserts --- .../net/mca/client/gui/SkinLibraryScreen.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/common/src/main/java/net/mca/client/gui/SkinLibraryScreen.java b/common/src/main/java/net/mca/client/gui/SkinLibraryScreen.java index c8d34fac94..d65611e3c1 100644 --- a/common/src/main/java/net/mca/client/gui/SkinLibraryScreen.java +++ b/common/src/main/java/net/mca/client/gui/SkinLibraryScreen.java @@ -1118,7 +1118,7 @@ private void drawControls(LiteContent content, boolean advanced, int cx, int cy) // subscribe if (isOp() || Config.getServerConfig().allowEveryoneToAddContentGlobally) { - widgets.add(addDrawableChild(new ToggleableTooltipIconButtonWidget(0, 0, 0, 3 * 16, + widgets.add(new ToggleableTooltipIconButtonWidget(0, 0, 0, 3 * 16, getServerContentById(content.contentid()).isPresent(), Text.translatable("gui.skin_library.subscribe"), v -> { @@ -1130,23 +1130,23 @@ private void drawControls(LiteContent content, boolean advanced, int cx, int cy) }); } ((ToggleableTooltipButtonWidget) v).toggle = !((ToggleableTooltipButtonWidget) v).toggle; - }))); + })); } // like if (authenticated) { - widgets.add(addDrawableChild(new ToggleableTooltipIconButtonWidget(0, 0, 16, 3 * 16, + widgets.add(new ToggleableTooltipIconButtonWidget(0, 0, 16, 3 * 16, isLiked(content), Text.translatable("gui.skin_library.like"), v -> { ((ToggleableTooltipButtonWidget) v).toggle = !((ToggleableTooltipButtonWidget) v).toggle; setLike(content.contentid(), ((ToggleableTooltipButtonWidget) v).toggle); - }))); + })); } // edit if (advanced && canModifyContent(content)) { - widgets.add(addDrawableChild(new ToggleableTooltipIconButtonWidget(0, 0, 2 * 16, 3 * 16, + widgets.add(new ToggleableTooltipIconButtonWidget(0, 0, 2 * 16, 3 * 16, isLiked(content), Text.translatable("gui.skin_library.edit"), v -> { @@ -1157,40 +1157,40 @@ private void drawControls(LiteContent content, boolean advanced, int cx, int cy) if (workspace.skinType == SkinType.HAIR) color.setHSV(0, 0, 0.5); }); }); - }))); + })); } // delete if (advanced && canModifyContent(content)) { - widgets.add(addDrawableChild(new ToggleableTooltipIconButtonWidget(cx - 12 + 25, cy, 3 * 16, 3 * 16, + widgets.add(new ToggleableTooltipIconButtonWidget(cx - 12 + 25, cy, 3 * 16, 3 * 16, true, Text.translatable("gui.skin_library.delete"), v -> { deleteConfirmationContent = content; setPage(Page.DELETE); - }))); + })); } // advanced if (!advanced) { - widgets.add(addDrawableChild(new ToggleableTooltipIconButtonWidget(cx - 12 + 25, cy, 4 * 16, 4 * 16, + widgets.add(new ToggleableTooltipIconButtonWidget(cx - 12 + 25, cy, 4 * 16, 4 * 16, true, Text.translatable("gui.skin_library.edit"), v -> { focusedContent = content; setPage(Page.DETAIL); - }))); + })); } // ban if (advanced && isModerator()) { - widgets.add(addDrawableChild(new ToggleableTooltipIconButtonWidget(cx - 12 + 25, cy, 5 * 16, 4 * 16, + widgets.add(new ToggleableTooltipIconButtonWidget(cx - 12 + 25, cy, 5 * 16, 4 * 16, true, Text.translatable("gui.skin_library.ban"), v -> { setBan(content.userid(), true); reloadDatabase(); - }))); + })); } // add the widgets