Refactored code and optimized imports
This commit is contained in:
1 parent
b2c63d73f1
commit
9cef6fb085
5 files changed
+21
-17
No files matched your search
@@ -1,9 +1,5 @@
|
|||||||
package netneutrality;
|
package netneutrality;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.security.auth.login.LoginException;
|
|
||||||
|
|
||||||
import net.dv8tion.jda.core.AccountType;
|
import net.dv8tion.jda.core.AccountType;
|
||||||
import net.dv8tion.jda.core.JDA;
|
import net.dv8tion.jda.core.JDA;
|
||||||
import net.dv8tion.jda.core.JDABuilder;
|
import net.dv8tion.jda.core.JDABuilder;
|
||||||
@@ -20,6 +16,9 @@ import netneutrality.utils.Settings;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.security.auth.login.LoginException;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class MusicBot {
|
public class MusicBot {
|
||||||
|
|
||||||
private static JDA jda;
|
private static JDA jda;
|
||||||
@@ -56,6 +55,7 @@ public class MusicBot {
|
|||||||
System.out.println("Shutting down...");
|
System.out.println("Shutting down...");
|
||||||
MusicManager.disconnectPlayers();
|
MusicManager.disconnectPlayers();
|
||||||
jda.shutdown();
|
jda.shutdown();
|
||||||
|
ThreadManager.shutdownExecutor();
|
||||||
System.out.println("Shutdown complete");
|
System.out.println("Shutdown complete");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class MysqlDatabase {
|
|||||||
private int nbRow;
|
private int nbRow;
|
||||||
private String dbName;
|
private String dbName;
|
||||||
|
|
||||||
public MysqlDatabase(String dbName) {
|
MysqlDatabase(String dbName) {
|
||||||
this.dbName = dbName;
|
this.dbName = dbName;
|
||||||
try {
|
try {
|
||||||
MusicBot.LOGGER.info("Connecting to database...");
|
MusicBot.LOGGER.info("Connecting to database...");
|
||||||
@@ -41,11 +41,17 @@ public class MysqlDatabase {
|
|||||||
*
|
*
|
||||||
* @param query The SQL query to execute
|
* @param query The SQL query to execute
|
||||||
* @return {@link ResultSet}
|
* @return {@link ResultSet}
|
||||||
* @throws SQLException
|
|
||||||
*/
|
*/
|
||||||
public ResultSet query(String query) throws SQLException {
|
public ResultSet query(String query) {
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt;
|
||||||
|
try {
|
||||||
|
stmt = connection.createStatement();
|
||||||
return stmt.executeQuery(query);
|
return stmt.executeQuery(query);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package netneutrality.handler;
|
package netneutrality.handler;
|
||||||
|
|
||||||
import java.time.OffsetDateTime;
|
|
||||||
|
|
||||||
import net.dv8tion.jda.core.entities.Member;
|
import net.dv8tion.jda.core.entities.Member;
|
||||||
import net.dv8tion.jda.core.entities.Message;
|
import net.dv8tion.jda.core.entities.Message;
|
||||||
import net.dv8tion.jda.core.entities.MessageChannel;
|
import net.dv8tion.jda.core.entities.MessageChannel;
|
||||||
import net.dv8tion.jda.core.entities.PrivateChannel;
|
import net.dv8tion.jda.core.entities.PrivateChannel;
|
||||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
|
||||||
public class MessageRateLimit {
|
public class MessageRateLimit {
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
package netneutrality.http;
|
package netneutrality.http;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import okhttp3.*;
|
import okhttp3.*;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public class WebModule {
|
public class WebModule {
|
||||||
|
|
||||||
private String url;
|
private String url;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import netneutrality.MusicBot;
|
|||||||
import netneutrality.handler.LogHandler;
|
import netneutrality.handler.LogHandler;
|
||||||
import netneutrality.utils.MessageFunction;
|
import netneutrality.utils.MessageFunction;
|
||||||
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
Reference in new issue
Block a user