feat: *console printdisconnectedcause <true|false>
very useful for debugging
This commit is contained in:
parent
597a694727
commit
3811790c93
2 changed files with 18 additions and 1 deletions
|
@ -41,6 +41,8 @@ public class Bot {
|
|||
|
||||
public Session session;
|
||||
|
||||
public boolean printDisconnectedCause = false;
|
||||
|
||||
public boolean loggedIn = false;
|
||||
|
||||
public final ExecutorService executorService = Main.executorService;
|
||||
|
@ -251,6 +253,8 @@ public class Bot {
|
|||
|
||||
final Throwable cause = disconnectedEvent.getCause();
|
||||
|
||||
if (printDisconnectedCause && cause != null) cause.printStackTrace();
|
||||
|
||||
// lazy fix #69420
|
||||
if (cause instanceof OutOfMemoryError) System.exit(1);
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ public class ConsoleCommand extends Command {
|
|||
"Controls stuff about console",
|
||||
new String[] {
|
||||
"server <server>",
|
||||
"logtoconsole <true|false>"
|
||||
"logtoconsole <true|false>",
|
||||
"printdisconnectedreason <true|false>"
|
||||
},
|
||||
new String[] {},
|
||||
TrustLevel.OWNER,
|
||||
|
@ -77,6 +78,18 @@ public class ConsoleCommand extends Command {
|
|||
bool ? Component.text("enabled").color(NamedTextColor.GREEN) : Component.text("disabled").color(NamedTextColor.RED)
|
||||
).color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
|
||||
}
|
||||
case "printdisconnectedreason" -> {
|
||||
context.checkOverloadArgs(2);
|
||||
|
||||
final boolean bool = context.getBoolean(true);
|
||||
|
||||
bot.printDisconnectedCause = bool;
|
||||
|
||||
return Component.translatable(
|
||||
"Printing the disconnected cause is now %s",
|
||||
bool ? Component.text("enabled").color(NamedTextColor.GREEN) : Component.text("disabled").color(NamedTextColor.RED)
|
||||
).color(ColorUtilities.getColorByString(bot.config.colorPalette.defaultColor));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue