Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit 5b0ddce

Browse files
committed
Fixed checkstyle issues.
1 parent f417275 commit 5b0ddce

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

src/main/java/net/javadiscord/javabot2/command/data/OptionChoiceConfig.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@
44
import org.javacord.api.interaction.SlashCommandOptionChoice;
55
import org.javacord.api.interaction.SlashCommandOptionChoiceBuilder;
66

7+
/**
8+
* DTO for a choice that a slash command option can have.
9+
*/
710
@Data
811
public class OptionChoiceConfig {
912
private String name;
1013
private String value;
1114

15+
/**
16+
* Converts this choice data into a Javacord object for use with the API.
17+
* @return The Javacord option choice object.
18+
*/
1219
public SlashCommandOptionChoice toData() {
1320
return new SlashCommandOptionChoiceBuilder()
1421
.setName(name)

src/main/java/net/javadiscord/javabot2/systems/moderation/WarnCommand.java

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,15 @@
1616
import java.time.Instant;
1717
import java.util.Map;
1818

19+
/**
20+
* Command that warns a user, which is used by moderators to enforce rules.
21+
*/
1922
public class WarnCommand implements SlashCommandHandler {
23+
/**
24+
* The maximum severity that a user can reach, after which they are banned.
25+
*/
2026
public static final int MAX_SEVERITY = 100;
2127

22-
private enum Severity {
23-
LOW(10), MEDIUM(20), HIGH(40);
24-
25-
private final int weight;
26-
27-
Severity(int weight) {
28-
this.weight = weight;
29-
}
30-
31-
public int getWeight() {
32-
return this.weight;
33-
}
34-
}
35-
36-
private static record WarnData(User user, long timestamp, Severity severity, String reason, User warnedBy, int totalSeverity, Server server){}
37-
3828
@Override
3929
public InteractionImmediateResponseBuilder handle(SlashCommandInteraction interaction) throws ResponseException {
4030
var server = interaction.getServer().orElseThrow(ResponseException.warning("This command can only be used in a server."));
@@ -96,4 +86,20 @@ private InteractionImmediateResponseBuilder banUser(SlashCommandInteraction inte
9686
.message(String.format("User %s was banned after receiving too many warnings.", user.getDisplayName(server)))
9787
.build();
9888
}
89+
90+
private enum Severity {
91+
LOW(10), MEDIUM(20), HIGH(40);
92+
93+
private final int weight;
94+
95+
Severity(int weight) {
96+
this.weight = weight;
97+
}
98+
99+
public int getWeight() {
100+
return this.weight;
101+
}
102+
}
103+
104+
private static record WarnData(User user, long timestamp, Severity severity, String reason, User warnedBy, int totalSeverity, Server server){}
99105
}

0 commit comments

Comments
 (0)