Skip to content

Commit 08d1905

Browse files
committed
2 parents 85981ba + a34ff63 commit 08d1905

File tree

53 files changed

+166
-171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+166
-171
lines changed

src/commander/java/com/mcmoddev/mmdbot/commander/TheCommander.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
import com.mcmoddev.mmdbot.commander.util.EventListeners;
6060
import com.mcmoddev.mmdbot.commander.util.ThreadChannelCreatorEvents;
6161
import com.mcmoddev.mmdbot.commander.util.mc.MCVersions;
62-
import com.mcmoddev.mmdbot.commander.util.oldchannels.ChannelMessageChecker;
6362
import com.mcmoddev.mmdbot.commander.util.oldchannels.OldChannelsHelper;
6463
import com.mcmoddev.mmdbot.core.bot.Bot;
6564
import com.mcmoddev.mmdbot.core.bot.BotRegistry;
@@ -71,12 +70,12 @@
7170
import com.mcmoddev.mmdbot.core.commands.component.DeferredComponentListenerRegistry;
7271
import com.mcmoddev.mmdbot.core.commands.component.storage.ComponentStorage;
7372
import com.mcmoddev.mmdbot.core.event.Events;
74-
import com.mcmoddev.mmdbot.core.util.config.ConfigurateUtils;
7573
import com.mcmoddev.mmdbot.core.util.DotenvLoader;
7674
import com.mcmoddev.mmdbot.core.util.MessageUtilities;
7775
import com.mcmoddev.mmdbot.core.util.ReflectionsUtils;
7876
import com.mcmoddev.mmdbot.core.util.TaskScheduler;
7977
import com.mcmoddev.mmdbot.core.util.Utils;
78+
import com.mcmoddev.mmdbot.core.util.config.ConfigurateUtils;
8079
import com.mcmoddev.mmdbot.core.util.config.SnowflakeValue;
8180
import com.mcmoddev.mmdbot.core.util.dictionary.DictionaryUtils;
8281
import com.mcmoddev.mmdbot.core.util.event.DismissListener;
@@ -371,7 +370,8 @@ public void onCommand(final CommandEvent event, final Command command) {
371370
EventListeners.COMMANDS_LISTENER.addListener((EventListener) commandClient);
372371

373372
{
374-
record SlashCommandRegistration(Object fieldValue, RegisterSlashCommand annotation) {}
373+
record SlashCommandRegistration(Object fieldValue, RegisterSlashCommand annotation) {
374+
}
375375

376376
// Command register
377377
ReflectionsUtils.getFieldsAnnotatedWith(RegisterSlashCommand.class)

src/commander/java/com/mcmoddev/mmdbot/commander/commands/EvaluateCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@
6969
import java.util.concurrent.TimeUnit;
7070
import java.util.function.Consumer;
7171

72-
import static com.mcmoddev.mmdbot.core.util.event.DismissListener.createDismissButton;
7372
import static com.mcmoddev.mmdbot.commander.util.script.ScriptingUtils.ALLOWED_MENTIONS;
7473
import static com.mcmoddev.mmdbot.commander.util.script.ScriptingUtils.createGuild;
7574
import static com.mcmoddev.mmdbot.commander.util.script.ScriptingUtils.createMessageChannel;
7675
import static com.mcmoddev.mmdbot.commander.util.script.ScriptingUtils.createTextChannel;
7776
import static com.mcmoddev.mmdbot.commander.util.script.ScriptingUtils.getEmbedFromValue;
7877
import static com.mcmoddev.mmdbot.commander.util.script.ScriptingUtils.validateArgs;
78+
import static com.mcmoddev.mmdbot.core.util.event.DismissListener.createDismissButton;
7979

8080
public class EvaluateCommand extends SlashCommand {
8181

@@ -122,7 +122,7 @@ protected void execute(final SlashCommandEvent event) {
122122
return;
123123
}
124124
hook.editOriginal("There was an exception evaluating "
125-
+ exception.getLocalizedMessage())
125+
+ exception.getLocalizedMessage())
126126
.setActionRow(createDismissButton())
127127
.queue();
128128
}
@@ -164,7 +164,7 @@ public void onModalInteraction(@NotNull final ModalInteractionEvent event) {
164164
return;
165165
}
166166
hook.editOriginal("There was an exception evaluating "
167-
+ exception.getLocalizedMessage())
167+
+ exception.getLocalizedMessage())
168168
.setActionRow(createDismissButton(event))
169169
.queue();
170170
}

src/commander/java/com/mcmoddev/mmdbot/commander/commands/RoleSelectCommand.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
import net.dv8tion.jda.api.EmbedBuilder;
3636
import net.dv8tion.jda.api.MessageBuilder;
3737
import net.dv8tion.jda.api.Permission;
38-
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
39-
import net.dv8tion.jda.api.entities.emoji.Emoji;
4038
import net.dv8tion.jda.api.entities.Guild;
4139
import net.dv8tion.jda.api.entities.MessageEmbed;
4240
import net.dv8tion.jda.api.entities.MessageReaction;
4341
import net.dv8tion.jda.api.entities.Role;
42+
import net.dv8tion.jda.api.entities.emoji.CustomEmoji;
43+
import net.dv8tion.jda.api.entities.emoji.Emoji;
4444
import net.dv8tion.jda.api.entities.emoji.UnicodeEmoji;
4545
import net.dv8tion.jda.api.events.GenericEvent;
4646
import net.dv8tion.jda.api.events.message.react.GenericMessageReactionEvent;
@@ -57,7 +57,6 @@
5757
import net.dv8tion.jda.api.interactions.components.selections.SelectOption;
5858
import net.dv8tion.jda.api.interactions.components.text.TextInput;
5959
import net.dv8tion.jda.api.interactions.components.text.TextInputStyle;
60-
import net.dv8tion.jda.internal.utils.EncodingUtil;
6160
import org.jetbrains.annotations.NotNull;
6261

6362
import java.awt.Color;
@@ -91,7 +90,7 @@ private RoleSelectCommand() {
9190
userPermissions = new Permission[]{
9291
Permission.MANAGE_ROLES
9392
};
94-
children = new SlashCommand[] {
93+
children = new SlashCommand[]{
9594
command("buttons", "Creates a role panel with buttons.", event -> executeSub(event, false), new OptionData(OptionType.STRING, "roles", "Mention the roles to add to the panel.", true)),
9695
command("dropdown", "Creates a dropdown role panel.", event -> executeSub(event, true), new OptionData(OptionType.STRING, "roles", "Mention the roles to add to the panel.", true)),
9796
command("reaction", "Creates a reaction role panel.", event -> {
@@ -133,7 +132,7 @@ private RoleSelectCommand() {
133132
.formatted(e.getLocalizedMessage())).mentionRepliedUser(false).queue();
134133
TheCommander.LOGGER.error("There was an error running the `/role-select reaction` command", e);
135134
}
136-
}, new OptionData(OptionType.STRING, "message", "The ID of the message on which to create the panel.", true),
135+
}, new OptionData(OptionType.STRING, "message", "The ID of the message on which to create the panel.", true),
137136
new OptionData(OptionType.ROLE, "role", "The role to add to the panel.", true),
138137
new OptionData(OptionType.STRING, "emote", "The emote which will be associated with that role.", true),
139138
new OptionData(OptionType.BOOLEAN, "permanent", "If the role assigned by the panel is permanent.")
@@ -370,6 +369,7 @@ private static SlashCommand command(String cmdName, String description, Consumer
370369
this.help = description;
371370
this.options = List.of(cmdOptions);
372371
}
372+
373373
@Override
374374
protected void execute(final SlashCommandEvent event) {
375375
consumer.accept(event);

src/commander/java/com/mcmoddev/mmdbot/commander/commands/comchannels/CommunityChannelCommand.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@
3838
import net.dv8tion.jda.api.interactions.commands.OptionType;
3939
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
4040

41-
import java.util.ArrayList;
42-
import java.util.Comparator;
43-
import java.util.EnumSet;
44-
import java.util.List;
45-
import java.util.Objects;
46-
import java.util.Set;
41+
import java.util.*;
4742

4843
/**
4944
* Create a community channel owned by the specified user.
@@ -76,7 +71,7 @@ public final class CommunityChannelCommand extends SlashCommand {
7671
public CommunityChannelCommand() {
7772
super();
7873
name = "community-channel";
79-
children = new SlashCommand[] {
74+
children = new SlashCommand[]{
8075
new Create(), new Transfer(), new Owner()
8176
};
8277
}

src/commander/java/com/mcmoddev/mmdbot/commander/commands/tricks/AddTrickCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public static final class Prefix extends Command {
155155

156156
public Prefix() {
157157
name = "addtrick";
158-
aliases = new String[] {"add-trick"};
158+
aliases = new String[]{"add-trick"};
159159
requiredRole = "Bot Maintainer";
160160
guildOnly = true;
161161
children = Tricks.getTrickTypes().entrySet().stream().map(e -> new PrefixSubCmd(e.getKey(), e.getValue())).toArray(Command[]::new);

src/commander/java/com/mcmoddev/mmdbot/commander/config/Configuration.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@
2020
*/
2121
package com.mcmoddev.mmdbot.commander.config;
2222

23-
import com.jagrosh.jdautilities.commons.utils.SafeIdUtil;
2423
import com.mcmoddev.mmdbot.core.util.config.SnowflakeValue;
25-
import net.dv8tion.jda.api.Permission;
2624
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
2725
import org.spongepowered.configurate.objectmapping.meta.Comment;
2826
import org.spongepowered.configurate.objectmapping.meta.Required;
2927
import org.spongepowered.configurate.objectmapping.meta.Setting;
3028

3129
import java.util.ArrayList;
32-
import java.util.EnumSet;
3330
import java.util.List;
3431

3532
@SuppressWarnings("FieldMayBeFinal")

src/commander/java/com/mcmoddev/mmdbot/commander/config/GuildConfiguration.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.jagrosh.jdautilities.command.GuildSettingsManager;
2424
import com.mcmoddev.mmdbot.core.util.config.SnowflakeValue;
2525
import it.unimi.dsi.fastutil.longs.Long2ObjectFunction;
26-
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
2726
import net.dv8tion.jda.api.Permission;
2827
import net.dv8tion.jda.api.entities.Guild;
2928
import org.jsoup.internal.ReturnsAreNonnullByDefault;
@@ -33,7 +32,6 @@
3332
import org.spongepowered.configurate.objectmapping.meta.Setting;
3433

3534
import javax.annotation.Nullable;
36-
import java.util.List;
3735
import java.util.Set;
3836

3937
@ConfigSerializable
@@ -44,6 +42,7 @@ public final class GuildConfiguration {
4442
@Required
4543
@Setting("channels")
4644
private Channels channels = new Channels();
45+
4746
public Channels channels() {
4847
return channels;
4948
}
@@ -54,6 +53,7 @@ public static final class Channels {
5453
@Setting("community")
5554
@Comment("Community channels related configuration")
5655
private Community community = new Community();
56+
5757
public Community community() {
5858
return community;
5959
}
@@ -64,6 +64,7 @@ public static final class Community {
6464
@Setting("category")
6565
@Comment("The snowflake ID of the channel category where new community channels are created under")
6666
private SnowflakeValue category = SnowflakeValue.EMPTY;
67+
6768
public SnowflakeValue category() {
6869
return category;
6970
}
@@ -72,6 +73,7 @@ public SnowflakeValue category() {
7273
@Setting("archival_duration")
7374
@Comment("The number of days that need to pass without a message sent for a community channel to start the archival process.")
7475
private int archivalDuration = 60;
76+
7577
public int archivalDuration() {
7678
return archivalDuration;
7779
}
@@ -89,6 +91,7 @@ public SnowflakeValue archivedCategory() {
8991
@Setting("archival_notifier")
9092
@Comment("The ID of the channel where archival notifications will be sent.")
9193
private SnowflakeValue archivalNotifier = SnowflakeValue.EMPTY;
94+
9295
public SnowflakeValue archivalNotifier() {
9396
return archivalNotifier;
9497
}
@@ -110,6 +113,7 @@ This can be either bitfield, or a list of strings of the names of permissions (s
110113
Note: the bot can only assign permissions to channel owners if the bot has those permissions
111114
Example: ["Manage Messages", "MANAGE_PERMISSIONS"]""")
112115
private PermissionList ownerPermissions = new PermissionList(Set.of(Permission.MESSAGE_MANAGE));
116+
113117
public PermissionList ownerPermissions() {
114118
return ownerPermissions;
115119
}
@@ -118,6 +122,7 @@ public PermissionList ownerPermissions() {
118122
@Setting("channel_created_message")
119123
@Comment("The message to send in the channel after it is created.")
120124
private String channelCreatedMessage = "Welcome {user} to your new channel ({channel}) here at {guild}. Enjoy your stay!";
125+
121126
public String getChannelCreatedMessage() {
122127
return channelCreatedMessage;
123128
}
@@ -167,7 +172,8 @@ public int getLimitPerUser() {
167172
}
168173
}
169174

170-
public record SettingManager(Long2ObjectFunction<GuildConfiguration> getter) implements GuildSettingsManager<GuildConfiguration> {
175+
public record SettingManager(
176+
Long2ObjectFunction<GuildConfiguration> getter) implements GuildSettingsManager<GuildConfiguration> {
171177

172178
@Nullable
173179
@Override

src/commander/java/com/mcmoddev/mmdbot/commander/config/PermissionList.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public PermissionList deserialize(final Type type, final ConfigurationNode node)
5959
if (node.raw() instanceof Number num) {
6060
return new PermissionList(num.longValue());
6161
}
62-
final var list = node.get(new TypeToken<List<String>>() {});
62+
final var list = node.get(new TypeToken<List<String>>() {
63+
});
6364
if (list == null) return null;
6465
final EnumSet<Permission> permissions = EnumSet.noneOf(Permission.class);
6566
outer:
@@ -80,7 +81,8 @@ public void serialize(final Type type, @Nullable final PermissionList obj, final
8081
node.raw(null);
8182
return;
8283
}
83-
node.set(new TypeToken<List<String>>() {}.getType(), obj.delegate.stream().map(Permission::getName).toList());
84+
node.set(new TypeToken<List<String>>() {
85+
}.getType(), obj.delegate.stream().map(Permission::getName).toList());
8486
}
8587
}
8688
}

src/commander/java/com/mcmoddev/mmdbot/commander/custompings/CustomPingsListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
*/
2121
package com.mcmoddev.mmdbot.commander.custompings;
2222

23-
import static com.mcmoddev.mmdbot.commander.TheCommander.getInstance;
2423
import com.mcmoddev.mmdbot.commander.TheCommander;
2524
import com.mcmoddev.mmdbot.core.util.Utils;
2625
import com.mcmoddev.mmdbot.core.util.event.ThreadedEventListener;
@@ -44,6 +43,8 @@
4443

4544
import java.util.concurrent.Executors;
4645

46+
import static com.mcmoddev.mmdbot.commander.TheCommander.getInstance;
47+
4748
public class CustomPingsListener extends ListenerAdapter {
4849
public static final LazySupplier<EventListener> LISTENER = LazySupplier.of(() -> new ThreadedEventListener(Executors.newSingleThreadExecutor(r -> Utils.setThreadDaemon(new Thread(r, "CustomPingsListener"), true)),
4950
new CustomPingsListener()));

src/commander/java/com/mcmoddev/mmdbot/commander/docs/ConfigBasedElementLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
*/
2121
package com.mcmoddev.mmdbot.commander.docs;
2222

23-
import com.mcmoddev.mmdbot.core.util.config.ConfigurateUtils;
2423
import com.mcmoddev.mmdbot.core.util.Constants;
24+
import com.mcmoddev.mmdbot.core.util.config.ConfigurateUtils;
2525
import de.ialistannen.javadocapi.indexing.OnlineJavadocIndexer;
2626
import de.ialistannen.javadocapi.rendering.Java11PlusLinkResolver;
2727
import de.ialistannen.javadocapi.spoon.JavadocElementExtractor;

0 commit comments

Comments
 (0)