Refactor to remove abstraction.
This commit is contained in:
@@ -17,6 +17,8 @@ import engine.objects.MaxSkills;
|
|||||||
import engine.objects.SkillsBase;
|
import engine.objects.SkillsBase;
|
||||||
import org.pmw.tinylog.Logger;
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -110,34 +112,27 @@ public class dbSkillBaseHandler extends dbHandlerBase {
|
|||||||
|
|
||||||
public void LOAD_ALL_RUNE_SKILLS() {
|
public void LOAD_ALL_RUNE_SKILLS() {
|
||||||
|
|
||||||
prepareCallable("SELECT * FROM `static_skill_skillsgranted`");
|
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_skill_skillsgranted`")) {
|
||||||
|
|
||||||
try {
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
ResultSet rs = executeQuery();
|
|
||||||
|
|
||||||
//shrines cached in rs for easy cache on creation.
|
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
|
||||||
int runeID = rs.getInt("runeID");
|
int runeID = rs.getInt("runeID");
|
||||||
int token = rs.getInt("token");
|
int token = rs.getInt("token");
|
||||||
int amount = rs.getInt("amount");
|
int amount = rs.getInt("amount");
|
||||||
|
|
||||||
if (SkillsBase.runeSkillsCache.get(runeID) == null)
|
if (SkillsBase.runeSkillsCache.get(runeID) == null)
|
||||||
SkillsBase.runeSkillsCache.put(runeID, new HashMap<>());
|
SkillsBase.runeSkillsCache.put(runeID, new HashMap<>());
|
||||||
|
|
||||||
SkillsBase.runeSkillsCache.get(runeID).put(token, amount);
|
SkillsBase.runeSkillsCache.get(runeID).put(token, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Logger.error( e.getErrorCode() + ' ' + e.getMessage(), e);
|
Logger.error(e);
|
||||||
} finally {
|
|
||||||
closeCallable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user