Properly load last known name when using SQL

This commit is contained in:
PikaMug 2021-06-29 05:28:34 -04:00
parent 44fb413656
commit bbd61ac078

View File

@ -12,6 +12,12 @@
package me.blackvein.quests.storage.implementation.sql; package me.blackvein.quests.storage.implementation.sql;
import me.blackvein.quests.Quest;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
import me.blackvein.quests.storage.implementation.StorageImplementation;
import me.blackvein.quests.storage.implementation.sql.connection.ConnectionFactory;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -26,12 +32,6 @@ import java.util.concurrent.ConcurrentSkipListSet;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import me.blackvein.quests.Quest;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
import me.blackvein.quests.storage.implementation.StorageImplementation;
import me.blackvein.quests.storage.implementation.sql.connection.ConnectionFactory;
public class SqlStorage implements StorageImplementation { public class SqlStorage implements StorageImplementation {
private static final String PLAYER_SELECT = "SELECT lastknownname, questpoints FROM '{prefix}players' WHERE uuid=?"; private static final String PLAYER_SELECT = "SELECT lastknownname, questpoints FROM '{prefix}players' WHERE uuid=?";
private static final String PLAYER_SELECT_UUID = "SELECT DISTINCT uuid FROM '{prefix}players'"; private static final String PLAYER_SELECT_UUID = "SELECT DISTINCT uuid FROM '{prefix}players'";
@ -161,7 +161,7 @@ public class SqlStorage implements StorageImplementation {
ps.setString(1, uniqueId.toString()); ps.setString(1, uniqueId.toString());
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) { while (rs.next()) {
quester.setLastKnownName(rs.getString("lastKnownName")); quester.setLastKnownName(rs.getString("lastknownname"));
quester.setQuestPoints(rs.getInt("questpoints")); quester.setQuestPoints(rs.getInt("questpoints"));
} }
} }