Skip to content

Commit c4aeb1a

Browse files
committed
refactor(application-form): reduce visibility
The `RoleApplicationHandler` class is not making any use of inheritance as suggested by @Zabuzard and what's more, certain methods are unnecessarily marked as protected. Reduce visibility of methods marked as protected and make the `RoleApplicationHandler` class final. Suggested-by: Zabuzard <[email protected]> Signed-off-by: Chris Sdogkos <[email protected]>
1 parent c71ec52 commit c4aeb1a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

application/src/main/java/org/togetherjava/tjbot/features/roleapplication/RoleApplicationHandler.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* that submissions are sent to the appropriate application channel, and enforcing cooldowns for
3131
* users to prevent spamming.
3232
*/
33-
public class RoleApplicationHandler {
33+
public final class RoleApplicationHandler {
3434
private static final Logger logger = LoggerFactory.getLogger(RoleApplicationHandler.class);
3535

3636
private static final int APPLICATION_SUBMIT_COOLDOWN_MINUTES = 5;
@@ -67,7 +67,7 @@ public RoleApplicationHandler(RoleApplicationSystemConfig roleApplicationSystemC
6767
* @param args the arguments provided in the application submission
6868
* @param answer the answer provided by the applicant to the default question
6969
*/
70-
protected void sendApplicationResult(final ModalInteractionEvent event, List<String> args,
70+
private void sendApplicationResult(final ModalInteractionEvent event, List<String> args,
7171
String answer) throws IllegalArgumentException {
7272
Guild guild = event.getGuild();
7373

@@ -127,8 +127,7 @@ public Cache<Member, OffsetDateTime> getApplicationSubmitCooldown() {
127127
return applicationSubmitCooldown;
128128
}
129129

130-
protected void submitApplicationFromModalInteraction(ModalInteractionEvent event,
131-
List<String> args) {
130+
void submitApplicationFromModalInteraction(ModalInteractionEvent event, List<String> args) {
132131
Guild guild = event.getGuild();
133132

134133
if (guild == null) {
@@ -152,7 +151,7 @@ protected void submitApplicationFromModalInteraction(ModalInteractionEvent event
152151
applicationSubmitCooldown.put(event.getMember(), OffsetDateTime.now());
153152
}
154153

155-
protected long getMemberCooldownMinutes(Member member) {
154+
long getMemberCooldownMinutes(Member member) {
156155
OffsetDateTime timeSentCache = getApplicationSubmitCooldown().getIfPresent(member);
157156
if (timeSentCache != null) {
158157
Duration duration = Duration.between(timeSentCache, OffsetDateTime.now());

0 commit comments

Comments
 (0)