Reuse System.currentTimeMillis in player restore whiles.

This commit is contained in:
MobiusDevelopment
2019-11-05 11:01:53 +00:00
parent 7ea755f7c6
commit a5f2203a9f
18 changed files with 101 additions and 134 deletions

View File

@@ -7849,6 +7849,7 @@ public class PlayerInstance extends Playable
ps.setInt(2, _classIndex);
try (ResultSet rs = ps.executeQuery())
{
final long currentTime = System.currentTimeMillis();
while (rs.next())
{
final int remainingTime = rs.getInt("remaining_time");
@@ -7862,7 +7863,7 @@ public class PlayerInstance extends Playable
continue;
}
final long time = systime - System.currentTimeMillis();
final long time = systime - currentTime;
if (time > 10)
{
disableSkill(skill, time);
@@ -7907,16 +7908,14 @@ public class PlayerInstance extends Playable
try (ResultSet rs = ps.executeQuery())
{
int itemId;
@SuppressWarnings("unused")
int itemObjId;
long reuseDelay;
long systime;
boolean isInInventory;
long remainingTime;
final long currentTime = System.currentTimeMillis();
while (rs.next())
{
itemId = rs.getInt("itemId");
itemObjId = rs.getInt("itemObjId");
reuseDelay = rs.getLong("reuseDelay");
systime = rs.getLong("systime");
isInInventory = true;
@@ -7931,8 +7930,7 @@ public class PlayerInstance extends Playable
if ((item != null) && (item.getId() == itemId) && (item.getReuseDelay() > 0))
{
remainingTime = systime - System.currentTimeMillis();
// Hardcoded to 10 seconds.
remainingTime = systime - currentTime;
if (remainingTime > 10)
{
addTimeStampItem(item, reuseDelay, systime);