Refactored code

This commit is contained in:
Anthony committed 2018-04-02 10:17:06 -04:00
1 parent 324dd41145
commit 7888bdf641
4 files changed
+9 -12

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 {
database.close();
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() {