refactor: remove some outputs in console command

This commit is contained in:
Chayapak 2024-11-17 17:01:43 +07:00
parent 71d9caa0db
commit b424f29972
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA
2 changed files with 6 additions and 4 deletions

View file

@ -48,8 +48,6 @@ public class ConsoleCommand extends Command {
if (server.equalsIgnoreCase("all")) {
eachBot.console.consoleServer = "all";
context.sendOutput(Component.text("Set the console server to all servers").color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor)));
continue;
}
@ -59,8 +57,6 @@ public class ConsoleCommand extends Command {
.filter(eachServer -> eachServer.toLowerCase().contains(server))
.findFirst()
.orElse("all");
context.sendOutput(Component.text("Set the console server to " + bot.console.consoleServer).color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor)));
} catch (ArrayIndexOutOfBoundsException e) {
throw new CommandException(Component.text("Invalid server: " + server));
}

View file

@ -38,6 +38,8 @@ public class LoggerUtilities {
}
public static void log (String message) { log(null, message, true, true); }
public static void log (Component message) { log(null, ComponentUtilities.stringifyAnsi(message)); }
public static void log (Bot bot, Component message) { log(bot, ComponentUtilities.stringifyAnsi(message)); }
public static void log (Bot bot, String message) { log(bot, message, true, true); }
public static void log (Bot bot, String message, boolean logToFile, boolean logToConsole) {
final String component = prefix(bot, Component.text("Log").color(NamedTextColor.GOLD), message);
@ -58,6 +60,8 @@ public class LoggerUtilities {
}
public static void info (String message) { info(null, message); }
public static void info (Component message) { info(null, ComponentUtilities.stringifyAnsi(message)); }
public static void info (Bot bot, Component message) { info(bot, ComponentUtilities.stringifyAnsi(message)); }
public static void info (Bot bot, String message) {
final String component = prefix(bot, Component.text("Info").color(NamedTextColor.GREEN), message);
@ -66,6 +70,8 @@ public class LoggerUtilities {
}
public static void error (String message) { error(null, message); }
public static void error (Component message) { error(null, ComponentUtilities.stringifyAnsi(message)); }
public static void error (Bot bot, Component message) { error(bot, ComponentUtilities.stringifyAnsi(message)); }
public static void error (Bot bot, String message) {
final String component = prefix(bot, Component.text("Error").color(NamedTextColor.RED), message);