Change default birthday and tempban to fix conversion issue

ResultSet#getLong on a timestamp field is not allowed
This commit is contained in:
P0nk
2021-04-02 16:11:41 +02:00
parent 7169a74e94
commit 754ab67de7
5 changed files with 46 additions and 23 deletions

View File

@@ -30,6 +30,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -11036,8 +11037,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
try (PreparedStatement ps = con.prepareStatement("SELECT tempban FROM accounts WHERE id = ?")) {
ps.setInt(1, accountId);
ResultSet rs = ps.executeQuery();
if(!rs.next()) return "Account does not exist.";
if(rs.getLong("tempban") != 0 && !rs.getString("tempban").equals("2018-06-20 00:00:00.0")) return "Account has been banned.";
if (!rs.next()) {
return "Account does not exist.";
}
LocalDateTime tempban = rs.getTimestamp("tempban").toLocalDateTime();
if(!tempban.equals(DefaultDates.getTempban())) {
return "Account has been banned.";
}
} catch(SQLException e) {
e.printStackTrace();
FilePrinter.printError(FilePrinter.CHANGE_CHARACTER_NAME, e);