Bug fix update (fail)
This commit is contained in:
parent
4ff2163b49
commit
c2b013b4f5
@ -38,4 +38,4 @@ compileJava.options.encoding = 'UTF-8'
|
|||||||
compileJava.options.fork = true
|
compileJava.options.fork = true
|
||||||
|
|
||||||
// Change this if you are getting errors building
|
// Change this if you are getting errors building
|
||||||
compileJava.options.forkOptions.executable = 'C:\\Program Files\\Java\\jdk1.8.0_131\\bin\\javac.exe'
|
compileJava.options.forkOptions.executable = 'C:\\Program Files\\Java\\jdk1.8.0_144\\bin\\javac.exe'
|
@ -5,6 +5,7 @@ import com.zaxxer.hikari.HikariDataSource;
|
|||||||
import me.majrly.database.params.Parameter;
|
import me.majrly.database.params.Parameter;
|
||||||
import me.majrly.database.statements.Query;
|
import me.majrly.database.statements.Query;
|
||||||
import me.majrly.database.statements.Statement;
|
import me.majrly.database.statements.Statement;
|
||||||
|
import me.savvy.rixa.Rixa;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -113,7 +114,12 @@ public class Database {
|
|||||||
*/
|
*/
|
||||||
public Optional<PreparedStatement> prepare(Statement statement) {
|
public Optional<PreparedStatement> prepare(Statement statement) {
|
||||||
try {
|
try {
|
||||||
PreparedStatement preparedStatement = getConnection().get().prepareStatement(statement.getSQL());
|
Optional<Connection> optional = getConnection();
|
||||||
|
if (!optional.isPresent()) {
|
||||||
|
Rixa.getInstance().getLogger().severe("Could not find connection, GuildSettings:117");
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
PreparedStatement preparedStatement = optional.get().prepareStatement(statement.getSQL());
|
||||||
for (Map.Entry<Integer, Parameter> parameter : statement.getParameters().entrySet()) {
|
for (Map.Entry<Integer, Parameter> parameter : statement.getParameters().entrySet()) {
|
||||||
switch (parameter.getValue().getType()) {
|
switch (parameter.getValue().getType()) {
|
||||||
case STRING:
|
case STRING:
|
||||||
|
@ -111,7 +111,6 @@ public class Rixa {
|
|||||||
try {
|
try {
|
||||||
int shards = 5;
|
int shards = 5;
|
||||||
for (int i = 0; i < shards; i++) {
|
for (int i = 0; i < shards; i++) {
|
||||||
Thread.sleep(5000);
|
|
||||||
Logger.getLogger("Rixa").info("Loading shard #" + i);
|
Logger.getLogger("Rixa").info("Loading shard #" + i);
|
||||||
JDABuilder jda = new JDABuilder(AccountType.BOT)
|
JDABuilder jda = new JDABuilder(AccountType.BOT)
|
||||||
.setToken(config.getJsonObject().getString("secretToken"))
|
.setToken(config.getJsonObject().getString("secretToken"))
|
||||||
@ -128,12 +127,13 @@ public class Rixa {
|
|||||||
.useSharding(i, shards);
|
.useSharding(i, shards);
|
||||||
shardsList.add(jda.buildBlocking());
|
shardsList.add(jda.buildBlocking());
|
||||||
getInstance().getLogger().info("Shard #" + i + " has been loaded");
|
getInstance().getLogger().info("Shard #" + i + " has been loaded");
|
||||||
|
Thread.sleep(5000);
|
||||||
}
|
}
|
||||||
} catch (LoginException | InterruptedException | RateLimitedException e) {
|
} catch (LoginException | InterruptedException | RateLimitedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
Guilds.getGuilds().values().parallelStream().forEach((rixaGuild) -> rixaGuild.load());
|
//Guilds.getGuilds().values().parallelStream().forEach((rixaGuild) -> rixaGuild.load());
|
||||||
|
|
||||||
timeUp = System.currentTimeMillis();
|
timeUp = System.currentTimeMillis();
|
||||||
register(new InfoCommand(), new ServerInfoCommand(), new HelpCommand(),
|
register(new InfoCommand(), new ServerInfoCommand(), new HelpCommand(),
|
||||||
|
@ -71,15 +71,18 @@ public class RixaGuild {
|
|||||||
Result r = Result.ERROR;
|
Result r = Result.ERROR;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Query query = new Query("SELECT `guild_name` FROM `core` WHERE `guild_id` = '" + guild.getId() + "';");
|
Query query = new Query("SELECT `guild_name` FROM `core` WHERE `guild_id` = ?;");
|
||||||
|
query.setString(guild.getId());
|
||||||
Optional<?> optional = db.send(query);
|
Optional<?> optional = db.send(query);
|
||||||
if (!optional.isPresent() || !(optional.get() instanceof ResultSet)) {
|
|
||||||
r = Result.ERROR;
|
|
||||||
} else {
|
|
||||||
r = Result.SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r != Result.ERROR) {
|
if (!optional.isPresent()) {
|
||||||
|
if (!(optional.get() instanceof ResultSet)) {
|
||||||
|
Rixa.getInstance().getLogger().severe("Could not find " + guild.getName() + " in settings it wasn't an instance of result set!, GuildSettings:75");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Rixa.getInstance().getLogger().severe("Could not find " + guild.getName() + ", GuildSettings:75");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ResultSet set = (ResultSet) optional.get();
|
ResultSet set = (ResultSet) optional.get();
|
||||||
if (set.next()) {
|
if (set.next()) {
|
||||||
r = Result.TRUE;
|
r = Result.TRUE;
|
||||||
@ -87,7 +90,6 @@ public class RixaGuild {
|
|||||||
r = Result.FALSE;
|
r = Result.FALSE;
|
||||||
}
|
}
|
||||||
set.close();
|
set.close();
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -92,20 +92,25 @@ public class GuildSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkExists() {
|
private boolean checkExists() {
|
||||||
Result r = Result.FALSE;
|
Result r;
|
||||||
try {
|
try {
|
||||||
Query query = new Query("SELECT `guild_id` FROM `settings` WHERE `guild_id` = '" + guild.getId() + "'");
|
Query query = new Query("SELECT `guild_id` FROM `settings` WHERE `guild_id` = ?");
|
||||||
|
query.setString(guild.getId());
|
||||||
Optional<?> optional = Rixa.getDatabase().send(query);
|
Optional<?> optional = Rixa.getDatabase().send(query);
|
||||||
if (!optional.isPresent()) r = Result.ERROR;
|
if (!optional.isPresent()) {
|
||||||
if (!(optional.get() instanceof ResultSet)) r = Result.ERROR;
|
if (!(optional.get() instanceof ResultSet)) {
|
||||||
|
Rixa.getInstance().getLogger().severe("Could not find " + guild.getName() + " in settings it wasn't an instance of result set!, GuildSettings:97");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Rixa.getInstance().getLogger().severe("Could not find " + guild.getName() + ", GuildSettings:99");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ResultSet set = (ResultSet) optional.get();
|
ResultSet set = (ResultSet) optional.get();
|
||||||
if (r != Result.ERROR) {
|
|
||||||
if (set.next()) {
|
if (set.next()) {
|
||||||
r = Result.TRUE;
|
r = Result.TRUE;
|
||||||
} else {
|
} else {
|
||||||
r = Result.FALSE;
|
r = Result.FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
set.close();
|
set.close();
|
||||||
return r == Result.TRUE;
|
return r == Result.TRUE;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user