refactored code
This commit is contained in:
1 parent
325aa1df77
commit
9902a3c913
4 files changed
+8
-12
No files matched your search
@@ -56,16 +56,6 @@ public class MusicBot {
|
||||
MusicBot.shutdown();
|
||||
}));
|
||||
|
||||
ConsoleHandler consoleInput = new ConsoleHandler();
|
||||
|
||||
switch (consoleInput.init()) {
|
||||
|
||||
case "quit":
|
||||
System.exit(0);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void shutdown() {
|
||||
|
||||
@@ -25,9 +25,11 @@ public class MysqlConnector {
|
||||
* @return {@link MysqlConnector}
|
||||
*/
|
||||
public MysqlConnector connect() throws SQLException {
|
||||
String jdbc = "jdbc:mysql://" + dbHost + ":3306/" + dbName;
|
||||
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
c = DriverManager.getConnection("jdbc:mysql://" + dbHost + ":3306/" + dbName, dbUser, dbPass);
|
||||
c = DriverManager.getConnection(jdbc, dbUser, dbPass);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ public class DBGuild extends AbstractController {
|
||||
public void insertGuildInDB(Guild g) {
|
||||
if (!database.exists("guilds", "guild_id", g.getId())) {
|
||||
database.prepareAndExecuteAsync("INSERT INTO guilds VALUES(?, ?, ?)", g.getId(), "0", null).blocking();
|
||||
database.prepareAndExecuteAsync("INSERT INTO guild_settings VALUES(?)", g.getId()).blocking();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,10 @@ public class NewCommandListener extends ListenerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
c.execute(event, args);
|
||||
if (c.canBeExecutedBy(event.getGuild(), event.getMember())) {
|
||||
c.execute(event, args);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user