refactor: satisfy IntelliJ a bit

This commit is contained in:
Maya Winters
2026-12-04 23:34:34 +08:00
parent 566352af52
commit f6ef11b500
14 changed files with 56 additions and 60 deletions
@@ -2,21 +2,16 @@ package land.chipmunk.parker2991.nitoribot.nightofnights.command;
import land.chipmunk.parker2991.nitoribot.nightofnights.NitoriBot;
import land.chipmunk.parker2991.nitoribot.nightofnights.data.PlayerProfileData;
import land.chipmunk.parker2991.nitoribot.nightofnights.data.chat.ChatType;
import land.chipmunk.parker2991.nitoribot.nightofnights.data.chat.ParsedChatType;
import land.chipmunk.parker2991.nitoribot.nightofnights.data.PlayerProfileData;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.componentToAnsi;
import land.chipmunk.parker2991.nitoribot.nightofnights.discord.SlashCommandEvent;
import net.dv8tion.jda.api.events.Event;
import net.dv8tion.jda.api.events.GenericEvent;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import java.util.List;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.componentToAnsi;
public record CommandSource(
PlayerProfileData sender,
@@ -5,6 +5,7 @@ import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandContext;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandInfo;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandSource;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandTrustLevels;
import land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.JoinConfiguration;
@@ -207,15 +208,12 @@ public final class HelpCommand implements CommandInfo {
.color(convertColorString(bot.config.colors.help.owner))
);
Component component = Component
.empty()
return Component.empty()
.append(helpLayout)
.append(Component.join(
JoinConfiguration.separator(Component.space()),
getCommands(bot)
))
.color(convertColorString(bot.config.colors.commands.tertiary));
return component;
.color(ComponentUtil.convertColorString(bot.config.colors.commands.tertiary));
}
}
@@ -1,15 +1,16 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.commands.Public;
import land.chipmunk.parker2991.nitoribot.nightofnights.NitoriBot;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.*;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.convertColorString;
import land.chipmunk.parker2991.nitoribot.nightofnights.data.PlayerProfileData;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandContext;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandInfo;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandSource;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandTrustLevels;
import net.kyori.adventure.text.Component;
import java.util.List;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.convertColorString;
public final class NetmsgCommand implements CommandInfo {
@Override
public boolean getPlayerChatOnly () {
@@ -40,7 +41,7 @@ public final class NetmsgCommand implements CommandInfo {
}
@Override
public Component execute (CommandContext context) throws CommandError {
public Component execute (CommandContext context) {
final NitoriBot bot = context.bot();
final String message = String
.join(
@@ -62,7 +63,7 @@ public final class NetmsgCommand implements CommandInfo {
final CommandSource source = context.source();
for (NitoriBot eachBot : bot.bots) {
Component component = null;
Component component;
if (eachBot.options.isPrivate)
component = Component
.translatable(
@@ -1,14 +1,17 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.commands.Public;
import land.chipmunk.parker2991.nitoribot.nightofnights.NitoriBot;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.*;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandContext;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandInfo;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandSource;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandTrustLevels;
import net.kyori.adventure.text.Component;
import java.util.List;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.BetweenUtil.between;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.convertColorString;
import java.util.List;
public final class RTPCommand implements CommandInfo {
@Override
public CommandTrustLevels getTrustLevel () {
@@ -40,7 +43,7 @@ public final class RTPCommand implements CommandInfo {
}
@Override
public Component execute (CommandContext context) throws CommandError {
public Component execute (CommandContext context) {
final NitoriBot bot = context.bot();
final CommandSource source = context.source();
final double posX = between(
@@ -1,13 +1,16 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.commands.admin;
import land.chipmunk.parker2991.nitoribot.nightofnights.NitoriBot;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.*;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.convertColorString;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandContext;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandInfo;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandSource;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandTrustLevels;
import net.kyori.adventure.text.Component;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.convertColorString;
public final class NetcmdCommand implements CommandInfo {
@Override
@@ -36,7 +39,7 @@ public final class NetcmdCommand implements CommandInfo {
}
@Override
public Component execute (CommandContext context) throws CommandError {
public Component execute (CommandContext context) {
final NitoriBot bot = context.bot();
final String[] args = context.args();
final CommandSource source = context.source();
@@ -2,7 +2,6 @@ package land.chipmunk.parker2991.nitoribot.nightofnights.commands.console;
import land.chipmunk.parker2991.nitoribot.nightofnights.NitoriBot;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandContext;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandError;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandInfo;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandTrustLevels;
import net.kyori.adventure.text.Component;
@@ -42,17 +41,15 @@ public final class ConsoleCommand implements CommandInfo {
}
@Override
public Component execute (CommandContext context) throws CommandError {
public Component execute (CommandContext context) {
final NitoriBot bot = context.bot();
final String[] args = context.args();
Component component = null;
switch (args[0].toLowerCase()) {
case "server" -> {
for (final NitoriBot eachBot : bot.bots) {
if (eachBot.options.serverName.toLowerCase().equals(args[1])) {
eachBot.console.server = eachBot.options.serverName;
component = Component.text("Set the console server to " + eachBot.console.server);
}
if (args[0].equalsIgnoreCase("server")) {
for (final NitoriBot eachBot : bot.bots) {
if (eachBot.options.serverName.toLowerCase().equals(args[1])) {
eachBot.console.server = eachBot.options.serverName;
component = Component.text("Set the console server to " + eachBot.console.server);
}
}
}
@@ -2,14 +2,16 @@ package land.chipmunk.parker2991.nitoribot.nightofnights.commands.owner;
import land.chipmunk.parker2991.nitoribot.nightofnights.Main;
import land.chipmunk.parker2991.nitoribot.nightofnights.NitoriBot;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.*;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.convertColorString;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandContext;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandInfo;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandSource;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandTrustLevels;
import net.kyori.adventure.text.Component;
import java.util.List;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.convertColorString;
public final class KillCommand implements CommandInfo {
@Override
public CommandTrustLevels getTrustLevel () {
@@ -41,7 +43,7 @@ public final class KillCommand implements CommandInfo {
}
@Override
public Component execute (CommandContext context) throws CommandError {
public Component execute (CommandContext context) {
NitoriBot bot = context.bot();
CommandSource source = context.source();
@@ -1,19 +1,20 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.commands.owner;
import jdk.jshell.*;
import land.chipmunk.parker2991.nitoribot.nightofnights.Main;
import land.chipmunk.parker2991.nitoribot.nightofnights.NitoriBot;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.*;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.convertColorString;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandContext;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandInfo;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandSource;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandTrustLevels;
import net.dv8tion.jda.api.entities.Activity;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.convertColorString;
public final class ServerEvalCommand implements CommandInfo {
@Override
public CommandTrustLevels getTrustLevel () {
@@ -44,7 +45,7 @@ public final class ServerEvalCommand implements CommandInfo {
}
@Override
public Component execute (CommandContext context) throws CommandError {
public Component execute (CommandContext context) {
final NitoriBot bot = context.bot();
final CommandSource source = context.source();
Component component = null;
@@ -2,7 +2,6 @@ package land.chipmunk.parker2991.nitoribot.nightofnights.commands.trusted;
import land.chipmunk.parker2991.nitoribot.nightofnights.NitoriBot;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandContext;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandError;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandInfo;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandTrustLevels;
import land.chipmunk.parker2991.nitoribot.nightofnights.data.CloopData;
@@ -39,7 +38,7 @@ public final class CloopCommand implements CommandInfo {
}
@Override
public Component execute (CommandContext context) throws CommandError {
public Component execute (CommandContext context) {
final NitoriBot bot = context.bot();
final String[] args = context.args();
Component component = null;
@@ -1,8 +1,5 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.data.blocks;
import java.util.ArrayList;
import java.util.List;
public class BlockRegistries {
public String block;
public final STATES[] states = new STATES[]{};
@@ -7,6 +7,4 @@ public record BlockData(
int id,
List<Integer> stateIds
) {
public void stateIds (List<Integer> stateIds) {
}
}
@@ -4,17 +4,19 @@ import land.chipmunk.parker2991.nitoribot.nightofnights.NitoriBot;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandInfo;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandMessageSource;
import land.chipmunk.parker2991.nitoribot.nightofnights.command.CommandSource;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.componentToAnsi;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
import net.kyori.adventure.text.Component;
import org.jspecify.annotations.NonNull;
public class SlashCommandEvent extends ListenerAdapter {
private NitoriBot bot;
import static land.chipmunk.parker2991.nitoribot.nightofnights.util.ComponentUtil.componentToAnsi;
public final class SlashCommandEvent extends ListenerAdapter {
private final NitoriBot bot;
@Override
public void onSlashCommandInteraction (SlashCommandInteractionEvent event) {
public void onSlashCommandInteraction (@NonNull SlashCommandInteractionEvent event) {
for (CommandInfo commands : bot.commandManager.commands) {
if (event
.getName()
@@ -189,7 +189,7 @@ public final class DiscordModule extends ListenerAdapter implements Listener {
}
}
public DiscordModule (NitoriBot bot) throws InterruptedException {
public DiscordModule (NitoriBot bot) {
this.bot = bot;
this.channel = client.getTextChannelById(bot.options.discordChannelId);
bot.listenerManager.addListener(this);
@@ -7,7 +7,7 @@ import java.util.List;
// TODO
public final class ExtrasMessagingModule {
private NitoriBot bot;
private final NitoriBot bot;
public final List<String> channels = new ArrayList<>();
public ExtrasMessagingModule (NitoriBot bot) {