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