Refactored code
This commit is contained in:
1 parent
324dd41145
commit
7888bdf641
4 files changed
+8
-11
No files matched your search
@@ -55,6 +55,7 @@ public class MusicBot {
|
||||
System.out.println("Shutting down...");
|
||||
MusicManager.disconnectPlayers();
|
||||
jda.shutdown();
|
||||
DBController.shutdown();
|
||||
ThreadManager.shutdownExecutor();
|
||||
System.out.println("Shutdown complete");
|
||||
System.exit(0);
|
||||
|
||||
@@ -57,8 +57,12 @@ public class DBController {
|
||||
return database;
|
||||
}
|
||||
|
||||
public static void shutdown() throws SQLException {
|
||||
public static void shutdown() {
|
||||
try {
|
||||
database.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -120,7 +120,7 @@ public class DBBlacklist extends AbstractController {
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NullPointerException | IndexOutOfBoundsException e) { }
|
||||
} catch (NullPointerException | IndexOutOfBoundsException ignored) { }
|
||||
|
||||
success.accept(output);
|
||||
});
|
||||
@@ -129,14 +129,7 @@ public class DBBlacklist extends AbstractController {
|
||||
|
||||
public boolean isAlreadyBlacklisted(String word, String serverId) throws SQLException {
|
||||
ResultSet rs = database.prepareAndExecute("SELECT COUNT(*) FROM blacklist WHERE word = ? AND serverId = ?", word, serverId);
|
||||
if (rs.next()) {
|
||||
if (rs.getInt(1) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
return !rs.next() || rs.getInt(1) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,6 @@ public class WebModule {
|
||||
* <br>Needs to be executed before any other method call
|
||||
*
|
||||
* @return an instance of the WebModule class with the Response of the Web Request
|
||||
* @throws IOException
|
||||
*/
|
||||
public WebModule request() {
|
||||
|
||||
|
||||
Reference in new issue
Block a user