Refactor to remove abstraction.
This commit is contained in:
@@ -9,8 +9,12 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.objects.Resists;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@@ -21,17 +25,23 @@ public class dbResistHandler extends dbHandlerBase {
|
||||
}
|
||||
|
||||
public Resists GET_RESISTS_FOR_MOB(int resistID) {
|
||||
prepareCallable("SELECT * FROM `static_npc_mob_resists` WHERE `ID` = ?;");
|
||||
setInt(1, resistID);
|
||||
try {
|
||||
ResultSet rs = executeQuery();
|
||||
if (rs.next()) {
|
||||
return new Resists(rs);
|
||||
}
|
||||
|
||||
Resists resists = null;
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mob_resists` WHERE `ID` = ?;")) {
|
||||
|
||||
preparedStatement.setInt(1, resistID);
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
resists = new Resists(rs);
|
||||
|
||||
} catch (SQLException e) {
|
||||
} finally {
|
||||
closeCallable();
|
||||
Logger.error(e);
|
||||
}
|
||||
return null;
|
||||
|
||||
return resists;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user