Skip to content

Commit af0c407

Browse files
committed
Fix checkstyle errors
1 parent 05ebe4f commit af0c407

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/DetachFormSubcommand.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,26 +88,28 @@ public void handleAutoComplete(CommandAutoCompleteInteractionEvent event, AutoCo
8888
public static void detachFromMessage(FormData form, Guild guild) {
8989
if (!form.isAttached()) return;
9090
TextChannel formChannel = guild.getTextChannelById(form.getMessageChannel().get());
91-
if (formChannel != null) formChannel.retrieveMessageById(form.getMessageId().get()).queue(msg -> {
92-
List<ActionRow> components = msg.getComponents().stream().map(msgComponent -> {
93-
ActionRow row = msgComponent.asActionRow();
94-
List<ActionRowChildComponentUnion> cpts = row.getComponents().stream().filter(cpt -> {
95-
if (cpt instanceof Button btn) {
96-
String cptId = btn.getCustomId();
97-
String[] split = ComponentIdBuilder.split(cptId);
98-
if (split[0].equals(FormInteractionManager.FORM_COMPONENT_ID)) {
99-
return !split[1].equals(Long.toString(form.id()));
91+
if (formChannel != null) {
92+
formChannel.retrieveMessageById(form.getMessageId().get()).queue(msg -> {
93+
List<ActionRow> components = msg.getComponents().stream().map(msgComponent -> {
94+
ActionRow row = msgComponent.asActionRow();
95+
List<ActionRowChildComponentUnion> cpts = row.getComponents().stream().filter(cpt -> {
96+
if (cpt instanceof Button btn) {
97+
String cptId = btn.getCustomId();
98+
String[] split = ComponentIdBuilder.split(cptId);
99+
if (split[0].equals(FormInteractionManager.FORM_COMPONENT_ID)) {
100+
return !split[1].equals(Long.toString(form.id()));
101+
}
100102
}
103+
return true;
104+
}).toList();
105+
if (cpts.isEmpty()) {
106+
return null;
101107
}
102-
return true;
103-
}).toList();
104-
if (cpts.isEmpty()) {
105-
return null;
106-
}
107-
return ActionRow.of(cpts);
108-
}).filter(Objects::nonNull).toList();
109-
msg.editMessageComponents(components).queue();
110-
}, e -> ExceptionLogger.capture(e));
108+
return ActionRow.of(cpts);
109+
}).filter(Objects::nonNull).toList();
110+
msg.editMessageComponents(components).queue();
111+
}, e -> ExceptionLogger.capture(e));
112+
}
111113
}
112114

113115
}

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/dao/FormsRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public void addSubmission(User user, FormData form, Message message) {
240240
*
241241
* @param form form to remove the field from
242242
* @param index index of the field to remove
243-
* @return
243+
* @return true if changes were successfully made to the database.
244244
*/
245245
public boolean removeField(FormData form, int index) {
246246
List<FormField> fields = form.fields();

0 commit comments

Comments
 (0)