diff --git a/build.gradle.kts b/build.gradle.kts index f83e17c..048c1d4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,7 +20,7 @@ addCompilerArgs("-parameters") repository(Repository.MAVEN_CENTRAL, Repository.JITPACK) dependencies { compileOnly("net.dv8tion", "JDA", "5.0.0-beta.24") // JDA - implementation("xyz.srnyx", "java-utilities", "1.0.0") // General Java utility library + implementation("xyz.srnyx", "java-utilities", "a71551bc2d") // General Java utility library implementation("io.github.freya022", "BotCommands", "2.10.3") // Command framework implementation("org.spongepowered", "configurate-yaml", "4.1.2") // Config manager implementation("org.postgresql", "postgresql", "42.7.3") // Database diff --git a/src/main/java/xyz/srnyx/lazylibrary/LazyLibrary.java b/src/main/java/xyz/srnyx/lazylibrary/LazyLibrary.java index ef2225e..8849155 100644 --- a/src/main/java/xyz/srnyx/lazylibrary/LazyLibrary.java +++ b/src/main/java/xyz/srnyx/lazylibrary/LazyLibrary.java @@ -94,11 +94,7 @@ public LazyLibrary() { // stop command new Thread(() -> { final Scanner scanner = new Scanner(System.in); - while (scanner.hasNextLine()) { - if (!scanner.nextLine().equals("stop")) continue; - onStop(); - System.exit(0); - } + while (scanner.hasNextLine()) if (scanner.nextLine().equals("stop")) stopBot(); }).start(); } @@ -140,6 +136,14 @@ public void onStop() { // Should be overridden } + /** + * Stops the bot (calls {@link #onStop()} and exits the program) + */ + public void stopBot() { + onStop(); + System.exit(0); + } + /** * Checks if the given {@link Long ID} is an owner *