Skip to content

Commit

Permalink
fixed double inserts
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke100000 committed May 27, 2023
1 parent f2f9ecf commit 9c0e058
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions common/src/main/java/net/mca/client/gui/SkinLibraryScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand All @@ -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 -> {
Expand All @@ -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
Expand Down

0 comments on commit 9c0e058

Please sign in to comment.