Explorar el Código

Minor data type fix

Reported by: valanths1990, siphonex, Avanael92, JMD
Zoey76 hace 9 años
padre
commit
f67e3d3ed5

+ 3 - 2
L2J_Server/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -22,6 +22,7 @@ import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Calendar;
@@ -6737,7 +6738,7 @@ public final class L2PcInstance extends L2Playable
 			statement.setInt(34, getNewbie());
 			statement.setInt(35, isNoble() ? 1 : 0);
 			statement.setLong(36, 0);
-			statement.setLong(37, getCreateDate().getTimeInMillis());
+			statement.setTimestamp(37, new Timestamp(getCreateDate().getTimeInMillis()));
 			statement.executeUpdate();
 		}
 		catch (Exception e)
@@ -6922,7 +6923,7 @@ public final class L2PcInstance extends L2Playable
 					player.setBookMarkSlot(rset.getInt("BookmarkSlot"));
 					
 					// character creation Time
-					player.getCreateDate().setTimeInMillis(rset.getLong("createDate"));
+					player.getCreateDate().setTimeInMillis(rset.getTimestamp("createDate").getTime());
 					
 					// Language
 					player.setLang(rset.getString("language"));

+ 3 - 1
L2J_Server/java/com/l2jserver/gameserver/taskmanager/tasks/TaskBirthday.java

@@ -22,6 +22,7 @@ import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.concurrent.TimeUnit;
 
 import com.l2jserver.Config;
 import com.l2jserver.L2DatabaseFactory;
@@ -52,6 +53,7 @@ public class TaskBirthday extends Task
 	@Override
 	public void onTimeElapsed(ExecutedTask task)
 	{
+		// TODO(Zoey76): Fix first run.
 		final int birthdayGiftCount = giveBirthdayGifts(task.getLastActivation());
 		
 		_log.info("BirthdayManager: " + birthdayGiftCount + " gifts sent.");
@@ -63,7 +65,7 @@ public class TaskBirthday extends Task
 		try (Connection con = L2DatabaseFactory.getInstance().getConnection();
 			PreparedStatement ps = con.prepareStatement(SELECT_PENDING_BIRTHDAY_GIFTS))
 		{
-			ps.setLong(1, lastActivation);
+			ps.setLong(1, TimeUnit.SECONDS.convert(lastActivation, TimeUnit.MILLISECONDS));
 			try (ResultSet rs = ps.executeQuery())
 			{
 				while (rs.next())