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