Calendar should never be used to get current time.
This commit is contained in:
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-15
@@ -195,11 +195,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -211,7 +212,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -596,8 +597,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,9 +614,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -713,14 +715,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -781,21 +784,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -809,7 +813,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -825,7 +825,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||||
@@ -170,9 +170,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -181,7 +182,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1235,7 +1236,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1346,7 +1347,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-15
@@ -195,11 +195,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -211,7 +212,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -596,8 +597,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,9 +614,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -713,14 +715,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -781,21 +784,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -809,7 +813,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -825,7 +825,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||||
@@ -170,9 +170,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -181,7 +182,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1235,7 +1236,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1346,7 +1347,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -195,11 +195,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -211,7 +212,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -596,8 +597,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,9 +614,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -713,14 +715,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -781,21 +784,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -809,7 +813,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -825,7 +825,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||||
@@ -170,9 +170,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -181,7 +182,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1235,7 +1236,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1346,7 +1347,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-15
@@ -192,11 +192,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -208,7 +209,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -587,8 +588,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,9 +605,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -687,14 +689,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -752,21 +755,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -780,7 +784,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -825,7 +825,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||||
@@ -170,9 +170,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -181,7 +182,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1235,7 +1236,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1346,7 +1347,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-15
@@ -192,11 +192,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -208,7 +209,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -587,8 +588,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,9 +605,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -687,14 +689,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -752,21 +755,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -780,7 +784,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -825,7 +825,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HR_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HR_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||||
@@ -170,9 +170,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -181,7 +182,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1235,7 +1236,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1346,7 +1347,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-15
@@ -192,11 +192,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -208,7 +209,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -587,8 +588,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,9 +605,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -687,14 +689,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -752,21 +755,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -780,7 +784,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -825,7 +825,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||||
@@ -170,9 +170,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -181,7 +182,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1235,7 +1236,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1346,7 +1347,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-15
@@ -192,11 +192,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -208,7 +209,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -587,8 +588,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,9 +605,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -687,14 +689,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -752,21 +755,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -780,7 +784,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -825,7 +825,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||||
@@ -170,9 +170,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -181,7 +182,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1235,7 +1236,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1346,7 +1347,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-15
@@ -193,11 +193,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -209,7 +210,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -588,8 +589,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,9 +606,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -688,14 +690,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -753,21 +756,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -781,7 +785,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -823,7 +823,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||||
@@ -171,9 +171,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -182,7 +183,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1238,7 +1239,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1349,7 +1350,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-15
@@ -193,11 +193,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -209,7 +210,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -600,8 +601,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,9 +618,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -700,14 +702,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -765,21 +768,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -791,7 +795,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -823,7 +823,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||||
@@ -170,9 +170,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -181,7 +182,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1236,7 +1237,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1347,7 +1348,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-15
@@ -193,11 +193,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -209,7 +210,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -600,8 +601,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,9 +618,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -700,14 +702,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -765,21 +768,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -791,7 +795,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -823,7 +823,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
+6
-5
@@ -102,7 +102,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||||
@@ -170,9 +170,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -181,7 +182,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1236,7 +1237,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1347,7 +1348,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,15 +72,15 @@ public class Couple
|
|||||||
|
|
||||||
public Couple(Player player1, Player player2)
|
public Couple(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+19
-15
@@ -193,11 +193,12 @@ public class Olympiad extends ListenersContainer
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -209,7 +210,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
loadNoblesRank();
|
loadNoblesRank();
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
@@ -600,8 +601,8 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_olympiadEnd > System.currentTimeMillis())
|
||||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
return _olympiadEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,9 +618,10 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return _validationEnd - Calendar.getInstance().getTimeInMillis();
|
return _validationEnd - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -700,14 +702,15 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -765,21 +768,22 @@ public class Olympiad extends ListenersContainer
|
|||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
|
|
||||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
// if (_compEnd > System.currentTimeMillis())
|
||||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
return _compEnd - System.currentTimeMillis();
|
||||||
// return 10;
|
// return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return _nextWeeklyChange - Calendar.getInstance().getTimeInMillis();
|
return _nextWeeklyChange - currentTime;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -791,7 +795,7 @@ public class Olympiad extends ListenersContainer
|
|||||||
resetWeeklyMatches();
|
resetWeeklyMatches();
|
||||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||||
|
|
||||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -823,7 +823,7 @@ public class FortSiege implements Siegable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (delay < 0)
|
if (delay < 0)
|
||||||
{
|
{
|
||||||
// siege time in past
|
// siege time in past
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = new SystemMessage(SystemMessageId.THE_CASTLE_SIEGE_ENDS_IN_S1_H);
|
final SystemMessage sm = new SystemMessage(SystemMessageId.THE_CASTLE_SIEGE_ENDS_IN_S1_H);
|
||||||
@@ -170,9 +170,10 @@ public class Siege implements Siegable
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_castle.isTimeRegistrationOver())
|
if (!_castle.isTimeRegistrationOver())
|
||||||
{
|
{
|
||||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||||
if (regTimeRemaining > 0)
|
if (regTimeRemaining > 0)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||||
@@ -181,7 +182,7 @@ public class Siege implements Siegable
|
|||||||
endTimeRegistration(true);
|
endTimeRegistration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||||
@@ -1236,7 +1237,7 @@ public class Siege implements Siegable
|
|||||||
public void correctSiegeDateTime()
|
public void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one
|
// Since siege has past reschedule it to the next one
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1347,7 +1348,7 @@ public class Siege implements Siegable
|
|||||||
{
|
{
|
||||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||||
// Schedule Time registration end
|
// Schedule Time registration end
|
||||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||||
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
_castle.getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||||
_castle.setTimeRegistrationOver(false);
|
_castle.setTimeRegistrationOver(false);
|
||||||
|
|
||||||
|
|||||||
+3
-4
@@ -22,7 +22,6 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -526,10 +525,10 @@ public class MailBBSManager extends BaseBBSManager
|
|||||||
public void sendLetter(String recipients, String subjectValue, String messageValue, Player activeChar)
|
public void sendLetter(String recipients, String subjectValue, String messageValue, Player activeChar)
|
||||||
{
|
{
|
||||||
// Current time.
|
// Current time.
|
||||||
final long currentDate = Calendar.getInstance().getTimeInMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
// Get the current time - 1 day under timestamp format.
|
// Get the current time - 1 day under timestamp format.
|
||||||
final Timestamp ts = new Timestamp(currentDate - 86400000);
|
final Timestamp ts = new Timestamp(currentTime - 86400000);
|
||||||
|
|
||||||
// Check sender mails based on previous timestamp. If more than 10 mails have been found for today, then cancel the use.
|
// Check sender mails based on previous timestamp. If more than 10 mails have been found for today, then cancel the use.
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -567,7 +566,7 @@ public class MailBBSManager extends BaseBBSManager
|
|||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
// Get the current time under timestamp format.
|
// Get the current time under timestamp format.
|
||||||
final Timestamp time = new Timestamp(currentDate);
|
final Timestamp time = new Timestamp(currentTime);
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
for (String recipientName : recipientNames)
|
for (String recipientName : recipientNames)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
|||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -62,12 +61,13 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
|
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parseCmd("_bbsmemo", player);
|
parseCmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -259,6 +259,8 @@ public class CastleManorManager
|
|||||||
|
|
||||||
protected void init()
|
protected void init()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
if (APPROVE == -1)
|
if (APPROVE == -1)
|
||||||
{
|
{
|
||||||
final Calendar manorRefresh = Calendar.getInstance();
|
final Calendar manorRefresh = Calendar.getInstance();
|
||||||
@@ -272,7 +274,7 @@ public class CastleManorManager
|
|||||||
periodApprove.set(Calendar.MINUTE, NEXT_PERIOD_APPROVE_MIN);
|
periodApprove.set(Calendar.MINUTE, NEXT_PERIOD_APPROVE_MIN);
|
||||||
periodApprove.set(Calendar.SECOND, 0);
|
periodApprove.set(Calendar.SECOND, 0);
|
||||||
periodApprove.set(Calendar.MILLISECOND, 0);
|
periodApprove.set(Calendar.MILLISECOND, 0);
|
||||||
final boolean isApproved = (periodApprove.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (manorRefresh.getTimeInMillis() > Calendar.getInstance().getTimeInMillis());
|
final boolean isApproved = (periodApprove.getTimeInMillis() < currentTime) && (manorRefresh.getTimeInMillis() > currentTime);
|
||||||
APPROVE = isApproved ? 1 : 0;
|
APPROVE = isApproved ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +282,7 @@ public class CastleManorManager
|
|||||||
firstDelay.set(Calendar.SECOND, 0);
|
firstDelay.set(Calendar.SECOND, 0);
|
||||||
firstDelay.set(Calendar.MILLISECOND, 0);
|
firstDelay.set(Calendar.MILLISECOND, 0);
|
||||||
firstDelay.add(Calendar.MINUTE, 1);
|
firstDelay.add(Calendar.MINUTE, 1);
|
||||||
ThreadPool.scheduleAtFixedRate(new ManorTask(), firstDelay.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(), 60000);
|
ThreadPool.scheduleAtFixedRate(new ManorTask(), firstDelay.getTimeInMillis() - currentTime, 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNextPeriod()
|
public void setNextPeriod()
|
||||||
|
|||||||
+9
-8
@@ -310,7 +310,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
protected void timeSelector()
|
protected void timeSelector()
|
||||||
{
|
{
|
||||||
timeCalculator();
|
timeCalculator();
|
||||||
final long currentTime = Calendar.getInstance().getTimeInMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
// if current time >= time of entry beginning and if current time < time of entry beginning + time of entry end
|
// if current time >= time of entry beginning and if current time < time of entry beginning + time of entry end
|
||||||
if ((currentTime >= _coolDownTimeEnd) && (currentTime < _entryTimeEnd)) // entry time check
|
if ((currentTime >= _coolDownTimeEnd) && (currentTime < _entryTimeEnd)) // entry time check
|
||||||
{
|
{
|
||||||
@@ -1695,7 +1695,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
if (_inAttackTime)
|
if (_inAttackTime)
|
||||||
{
|
{
|
||||||
final Calendar tmp = Calendar.getInstance();
|
final Calendar tmp = Calendar.getInstance();
|
||||||
tmp.setTimeInMillis(Calendar.getInstance().getTimeInMillis() - _warmUpTimeEnd);
|
tmp.setTimeInMillis(System.currentTimeMillis() - _warmUpTimeEnd);
|
||||||
if ((tmp.get(Calendar.MINUTE) + 5) < Config.FS_TIME_ATTACK)
|
if ((tmp.get(Calendar.MINUTE) + 5) < Config.FS_TIME_ATTACK)
|
||||||
{
|
{
|
||||||
managerSay((byte) tmp.get(Calendar.MINUTE)); // byte because minute cannot be more than 59
|
managerSay((byte) tmp.get(Calendar.MINUTE)); // byte because minute cannot be more than 59
|
||||||
@@ -1727,7 +1727,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
// if this is first launch - search time when entry time will be ended: counting difference between time when entry time ends and current time and then launching change time task
|
// if this is first launch - search time when entry time will be ended: counting difference between time when entry time ends and current time and then launching change time task
|
||||||
if (_firstTimeRun)
|
if (_firstTimeRun)
|
||||||
{
|
{
|
||||||
interval = _entryTimeEnd - Calendar.getInstance().getTimeInMillis();
|
interval = _entryTimeEnd - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1758,7 +1758,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
// searching time when warmup time will be ended: counting difference between time when warmup time ends and current time and then launching change time task
|
// searching time when warmup time will be ended: counting difference between time when warmup time ends and current time and then launching change time task
|
||||||
if (_firstTimeRun)
|
if (_firstTimeRun)
|
||||||
{
|
{
|
||||||
interval = _warmUpTimeEnd - Calendar.getInstance().getTimeInMillis();
|
interval = _warmUpTimeEnd - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1789,9 +1789,10 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
spawnMysteriousBox(31923);
|
spawnMysteriousBox(31923);
|
||||||
spawnMysteriousBox(31924);
|
spawnMysteriousBox(31924);
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_firstTimeRun)
|
if (!_firstTimeRun)
|
||||||
{
|
{
|
||||||
_warmUpTimeEnd = Calendar.getInstance().getTimeInMillis();
|
_warmUpTimeEnd = currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
long interval = 0;
|
long interval = 0;
|
||||||
@@ -1805,7 +1806,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
{
|
{
|
||||||
final Calendar inter = Calendar.getInstance();
|
final Calendar inter = Calendar.getInstance();
|
||||||
inter.set(Calendar.MINUTE, (int) min);
|
inter.set(Calendar.MINUTE, (int) min);
|
||||||
ThreadPool.schedule(new ManagerSay(), inter.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
ThreadPool.schedule(new ManagerSay(), inter.getTimeInMillis() - currentTime);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1817,7 +1818,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
// searching time when attack time will be ended: counting difference between time when attack time ends and current time and then launching change time task
|
// searching time when attack time will be ended: counting difference between time when attack time ends and current time and then launching change time task
|
||||||
if (_firstTimeRun)
|
if (_firstTimeRun)
|
||||||
{
|
{
|
||||||
interval = _attackTimeEnd - Calendar.getInstance().getTimeInMillis();
|
interval = _attackTimeEnd - currentTime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1855,7 +1856,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
_firstTimeRun = false; // cooldown phase ends event hour, so it will be not first run
|
_firstTimeRun = false; // cooldown phase ends event hour, so it will be not first run
|
||||||
}
|
}
|
||||||
|
|
||||||
final long interval = time.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long interval = time.getTimeInMillis() - System.currentTimeMillis();
|
||||||
_changeEntryTimeTask = ThreadPool.schedule(new ChangeEntryTime(), interval);
|
_changeEntryTimeTask = ThreadPool.schedule(new ChangeEntryTime(), interval);
|
||||||
if (_changeCoolDownTimeTask != null)
|
if (_changeCoolDownTimeTask != null)
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-5
@@ -21,7 +21,6 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
@@ -189,7 +188,7 @@ public class RaidBossSpawnManager
|
|||||||
final int RespawnMinDelay = boss.getSpawn().getRespawnMinDelay();
|
final int RespawnMinDelay = boss.getSpawn().getRespawnMinDelay();
|
||||||
final int RespawnMaxDelay = boss.getSpawn().getRespawnMaxDelay();
|
final int RespawnMaxDelay = boss.getSpawn().getRespawnMaxDelay();
|
||||||
final long respawnDelay = Rnd.get((int) (RespawnMinDelay * 1000 * Config.RAID_MIN_RESPAWN_MULTIPLIER), (int) (RespawnMaxDelay * 1000 * Config.RAID_MAX_RESPAWN_MULTIPLIER));
|
final long respawnDelay = Rnd.get((int) (RespawnMinDelay * 1000 * Config.RAID_MIN_RESPAWN_MULTIPLIER), (int) (RespawnMaxDelay * 1000 * Config.RAID_MAX_RESPAWN_MULTIPLIER));
|
||||||
final long respawnTime = Calendar.getInstance().getTimeInMillis() + respawnDelay;
|
final long respawnTime = System.currentTimeMillis() + respawnDelay;
|
||||||
info.set("currentHP", boss.getMaxHp());
|
info.set("currentHP", boss.getMaxHp());
|
||||||
info.set("currentMP", boss.getMaxMp());
|
info.set("currentMP", boss.getMaxMp());
|
||||||
info.set("respawnTime", respawnTime);
|
info.set("respawnTime", respawnTime);
|
||||||
@@ -229,9 +228,9 @@ public class RaidBossSpawnManager
|
|||||||
|
|
||||||
double hp = currentHP;
|
double hp = currentHP;
|
||||||
final int bossId = spawnDat.getNpcId();
|
final int bossId = spawnDat.getNpcId();
|
||||||
final long time = Calendar.getInstance().getTimeInMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||||
if ((respawnTime == 0) || (time > respawnTime))
|
if ((respawnTime == 0) || (currentTime > respawnTime))
|
||||||
{
|
{
|
||||||
final RaidBoss raidboss = bossId == 25328 ? DayNightSpawnManager.getInstance().handleBoss(spawnDat) : (RaidBoss) spawnDat.doSpawn();
|
final RaidBoss raidboss = bossId == 25328 ? DayNightSpawnManager.getInstance().handleBoss(spawnDat) : (RaidBoss) spawnDat.doSpawn();
|
||||||
if (raidboss != null)
|
if (raidboss != null)
|
||||||
@@ -260,7 +259,7 @@ public class RaidBossSpawnManager
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScheduledFuture<?> futureSpawn;
|
ScheduledFuture<?> futureSpawn;
|
||||||
final long spawnTime = respawnTime - Calendar.getInstance().getTimeInMillis();
|
final long spawnTime = respawnTime - currentTime;
|
||||||
futureSpawn = ThreadPool.schedule(new SpawnSchedule(bossId), spawnTime);
|
futureSpawn = ThreadPool.schedule(new SpawnSchedule(bossId), spawnTime);
|
||||||
_schedules.put(bossId, futureSpawn);
|
_schedules.put(bossId, futureSpawn);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,15 +77,15 @@ public class Wedding
|
|||||||
|
|
||||||
public Wedding(Player player1, Player player2)
|
public Wedding(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
|
|||||||
+16
-12
@@ -235,11 +235,12 @@ public class Olympiad
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -251,7 +252,7 @@ public class Olympiad
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
}
|
}
|
||||||
@@ -833,7 +834,7 @@ public class Olympiad
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
return (_olympiadEnd - Calendar.getInstance().getTimeInMillis());
|
return (_olympiadEnd - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void manualSelectHeroes()
|
public void manualSelectHeroes()
|
||||||
@@ -848,9 +849,10 @@ public class Olympiad
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return (_validationEnd - Calendar.getInstance().getTimeInMillis());
|
return (_validationEnd - currentTime);
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -894,14 +896,15 @@ public class Olympiad
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return (_compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (_compStart.getTimeInMillis() - currentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -960,19 +963,20 @@ public class Olympiad
|
|||||||
_compEnd = _compStart.getTimeInMillis() + COMP_PERIOD;
|
_compEnd = _compStart.getTimeInMillis() + COMP_PERIOD;
|
||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
return (_compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
return (_compEnd - Calendar.getInstance().getTimeInMillis());
|
return _compEnd - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return (_nextWeeklyChange - Calendar.getInstance().getTimeInMillis());
|
return (_nextWeeklyChange - currentTime);
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -391,17 +391,19 @@ public class ClanHallAuction
|
|||||||
World.getInstance().getPlayer(_highestBidderName).sendMessage("You have been out bidded");
|
World.getInstance().getPlayer(_highestBidderName).sendMessage("You have been out bidded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
_highestBidderId = bidder.getClanId();
|
_highestBidderId = bidder.getClanId();
|
||||||
_highestBidderMaxBid = bid;
|
_highestBidderMaxBid = bid;
|
||||||
_highestBidderName = bidder.getClan().getLeaderName();
|
_highestBidderName = bidder.getClan().getLeaderName();
|
||||||
if (_bidders.get(_highestBidderId) == null)
|
if (_bidders.get(_highestBidderId) == null)
|
||||||
{
|
{
|
||||||
_bidders.put(_highestBidderId, new Bidder(_highestBidderName, bidder.getClan().getName(), bid, Calendar.getInstance().getTimeInMillis()));
|
_bidders.put(_highestBidderId, new Bidder(_highestBidderName, bidder.getClan().getName(), bid, currentTime));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_bidders.get(_highestBidderId).setBid(bid);
|
_bidders.get(_highestBidderId).setBid(bid);
|
||||||
_bidders.get(_highestBidderId).setTimeBid(Calendar.getInstance().getTimeInMillis());
|
_bidders.get(_highestBidderId).setTimeBid(currentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
bidder.sendMessage("You have bidded successfully");
|
bidder.sendMessage("You have bidded successfully");
|
||||||
|
|||||||
+3
-3
@@ -82,7 +82,7 @@ public class FortSiege
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(new ScheduleEndSiegeTask(_fortInst), timeRemaining - 3600000); // Prepare task for 1 hr left.
|
ThreadPool.schedule(new ScheduleEndSiegeTask(_fortInst), timeRemaining - 3600000); // Prepare task for 1 hr left.
|
||||||
@@ -147,7 +147,7 @@ public class FortSiege
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
// Prepare task for 24 before siege start to end registration
|
// Prepare task for 24 before siege start to end registration
|
||||||
@@ -920,7 +920,7 @@ public class FortSiege
|
|||||||
*/
|
*/
|
||||||
public void checkAutoTask()
|
public void checkAutoTask()
|
||||||
{
|
{
|
||||||
if (getFort().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getFort().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
clearSiegeDate();
|
clearSiegeDate();
|
||||||
saveSiegeDate();
|
saveSiegeDate();
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public class Siege
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
// Prepare task for 1 hr left.
|
// Prepare task for 1 hr left.
|
||||||
@@ -209,7 +209,7 @@ public class Siege
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
// Prepare task for 24 before siege start to end registration
|
// Prepare task for 24 before siege start to end registration
|
||||||
@@ -1247,7 +1247,7 @@ public class Siege
|
|||||||
private void correctSiegeDateTime()
|
private void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one (14 days)
|
// Since siege has past reschedule it to the next one (14 days)
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1485,7 +1485,7 @@ public class Siege
|
|||||||
/** Set the date for the next siege. */
|
/** Set the date for the next siege. */
|
||||||
private void setNextSiegeDate()
|
private void setNextSiegeDate()
|
||||||
{
|
{
|
||||||
while (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
while (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Set next siege date if siege has passed
|
// Set next siege date if siege has passed
|
||||||
// Schedule to happen in 14 days
|
// Schedule to happen in 14 days
|
||||||
|
|||||||
+1
-2
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -713,7 +712,7 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
|
|
||||||
private void onEnterAio(Player player)
|
private void onEnterAio(Player player)
|
||||||
{
|
{
|
||||||
final long now = Calendar.getInstance().getTimeInMillis();
|
final long now = System.currentTimeMillis();
|
||||||
final long endDay = player.getAioEndTime();
|
final long endDay = player.getAioEndTime();
|
||||||
if (now > endDay)
|
if (now > endDay)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-3
@@ -16,8 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
@@ -101,7 +99,7 @@ public class SiegeInfo implements IClientOutgoingPacket
|
|||||||
packet.writeD(0); // Ally ID
|
packet.writeD(0); // Ally ID
|
||||||
packet.writeS(""); // Ally Name
|
packet.writeS(""); // Ally Name
|
||||||
}
|
}
|
||||||
packet.writeD((int) (Calendar.getInstance().getTimeInMillis() / 1000));
|
packet.writeD((int) (System.currentTimeMillis() / 1000));
|
||||||
packet.writeD((int) _siegeDate);
|
packet.writeD((int) _siegeDate);
|
||||||
packet.writeD(0); // number of choices?
|
packet.writeD(0); // number of choices?
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
+3
-4
@@ -22,7 +22,6 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -526,10 +525,10 @@ public class MailBBSManager extends BaseBBSManager
|
|||||||
public void sendLetter(String recipients, String subjectValue, String messageValue, Player activeChar)
|
public void sendLetter(String recipients, String subjectValue, String messageValue, Player activeChar)
|
||||||
{
|
{
|
||||||
// Current time.
|
// Current time.
|
||||||
final long currentDate = Calendar.getInstance().getTimeInMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
// Get the current time - 1 day under timestamp format.
|
// Get the current time - 1 day under timestamp format.
|
||||||
final Timestamp ts = new Timestamp(currentDate - 86400000);
|
final Timestamp ts = new Timestamp(currentTime - 86400000);
|
||||||
|
|
||||||
// Check sender mails based on previous timestamp. If more than 10 mails have been found for today, then cancel the use.
|
// Check sender mails based on previous timestamp. If more than 10 mails have been found for today, then cancel the use.
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -567,7 +566,7 @@ public class MailBBSManager extends BaseBBSManager
|
|||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
// Get the current time under timestamp format.
|
// Get the current time under timestamp format.
|
||||||
final Timestamp time = new Timestamp(currentDate);
|
final Timestamp time = new Timestamp(currentTime);
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
for (String recipientName : recipientNames)
|
for (String recipientName : recipientNames)
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
|||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -62,12 +61,13 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
|
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parseCmd("_bbsmemo", player);
|
parseCmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -259,6 +259,8 @@ public class CastleManorManager
|
|||||||
|
|
||||||
protected void init()
|
protected void init()
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
if (APPROVE == -1)
|
if (APPROVE == -1)
|
||||||
{
|
{
|
||||||
final Calendar manorRefresh = Calendar.getInstance();
|
final Calendar manorRefresh = Calendar.getInstance();
|
||||||
@@ -272,7 +274,7 @@ public class CastleManorManager
|
|||||||
periodApprove.set(Calendar.MINUTE, NEXT_PERIOD_APPROVE_MIN);
|
periodApprove.set(Calendar.MINUTE, NEXT_PERIOD_APPROVE_MIN);
|
||||||
periodApprove.set(Calendar.SECOND, 0);
|
periodApprove.set(Calendar.SECOND, 0);
|
||||||
periodApprove.set(Calendar.MILLISECOND, 0);
|
periodApprove.set(Calendar.MILLISECOND, 0);
|
||||||
final boolean isApproved = (periodApprove.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (manorRefresh.getTimeInMillis() > Calendar.getInstance().getTimeInMillis());
|
final boolean isApproved = (periodApprove.getTimeInMillis() < currentTime) && (manorRefresh.getTimeInMillis() > currentTime);
|
||||||
APPROVE = isApproved ? 1 : 0;
|
APPROVE = isApproved ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +282,7 @@ public class CastleManorManager
|
|||||||
firstDelay.set(Calendar.SECOND, 0);
|
firstDelay.set(Calendar.SECOND, 0);
|
||||||
firstDelay.set(Calendar.MILLISECOND, 0);
|
firstDelay.set(Calendar.MILLISECOND, 0);
|
||||||
firstDelay.add(Calendar.MINUTE, 1);
|
firstDelay.add(Calendar.MINUTE, 1);
|
||||||
ThreadPool.scheduleAtFixedRate(new ManorTask(), firstDelay.getTimeInMillis() - Calendar.getInstance().getTimeInMillis(), 60000);
|
ThreadPool.scheduleAtFixedRate(new ManorTask(), firstDelay.getTimeInMillis() - currentTime, 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNextPeriod()
|
public void setNextPeriod()
|
||||||
|
|||||||
+9
-8
@@ -310,7 +310,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
protected void timeSelector()
|
protected void timeSelector()
|
||||||
{
|
{
|
||||||
timeCalculator();
|
timeCalculator();
|
||||||
final long currentTime = Calendar.getInstance().getTimeInMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
// if current time >= time of entry beginning and if current time < time of entry beginning + time of entry end
|
// if current time >= time of entry beginning and if current time < time of entry beginning + time of entry end
|
||||||
if ((currentTime >= _coolDownTimeEnd) && (currentTime < _entryTimeEnd)) // entry time check
|
if ((currentTime >= _coolDownTimeEnd) && (currentTime < _entryTimeEnd)) // entry time check
|
||||||
{
|
{
|
||||||
@@ -1695,7 +1695,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
if (_inAttackTime)
|
if (_inAttackTime)
|
||||||
{
|
{
|
||||||
final Calendar tmp = Calendar.getInstance();
|
final Calendar tmp = Calendar.getInstance();
|
||||||
tmp.setTimeInMillis(Calendar.getInstance().getTimeInMillis() - _warmUpTimeEnd);
|
tmp.setTimeInMillis(System.currentTimeMillis() - _warmUpTimeEnd);
|
||||||
if ((tmp.get(Calendar.MINUTE) + 5) < Config.FS_TIME_ATTACK)
|
if ((tmp.get(Calendar.MINUTE) + 5) < Config.FS_TIME_ATTACK)
|
||||||
{
|
{
|
||||||
managerSay((byte) tmp.get(Calendar.MINUTE)); // byte because minute cannot be more than 59
|
managerSay((byte) tmp.get(Calendar.MINUTE)); // byte because minute cannot be more than 59
|
||||||
@@ -1727,7 +1727,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
// if this is first launch - search time when entry time will be ended: counting difference between time when entry time ends and current time and then launching change time task
|
// if this is first launch - search time when entry time will be ended: counting difference between time when entry time ends and current time and then launching change time task
|
||||||
if (_firstTimeRun)
|
if (_firstTimeRun)
|
||||||
{
|
{
|
||||||
interval = _entryTimeEnd - Calendar.getInstance().getTimeInMillis();
|
interval = _entryTimeEnd - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1758,7 +1758,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
// searching time when warmup time will be ended: counting difference between time when warmup time ends and current time and then launching change time task
|
// searching time when warmup time will be ended: counting difference between time when warmup time ends and current time and then launching change time task
|
||||||
if (_firstTimeRun)
|
if (_firstTimeRun)
|
||||||
{
|
{
|
||||||
interval = _warmUpTimeEnd - Calendar.getInstance().getTimeInMillis();
|
interval = _warmUpTimeEnd - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1789,9 +1789,10 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
spawnMysteriousBox(31923);
|
spawnMysteriousBox(31923);
|
||||||
spawnMysteriousBox(31924);
|
spawnMysteriousBox(31924);
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!_firstTimeRun)
|
if (!_firstTimeRun)
|
||||||
{
|
{
|
||||||
_warmUpTimeEnd = Calendar.getInstance().getTimeInMillis();
|
_warmUpTimeEnd = currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
long interval = 0;
|
long interval = 0;
|
||||||
@@ -1805,7 +1806,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
{
|
{
|
||||||
final Calendar inter = Calendar.getInstance();
|
final Calendar inter = Calendar.getInstance();
|
||||||
inter.set(Calendar.MINUTE, (int) min);
|
inter.set(Calendar.MINUTE, (int) min);
|
||||||
ThreadPool.schedule(new ManagerSay(), inter.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
ThreadPool.schedule(new ManagerSay(), inter.getTimeInMillis() - currentTime);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1817,7 +1818,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
// searching time when attack time will be ended: counting difference between time when attack time ends and current time and then launching change time task
|
// searching time when attack time will be ended: counting difference between time when attack time ends and current time and then launching change time task
|
||||||
if (_firstTimeRun)
|
if (_firstTimeRun)
|
||||||
{
|
{
|
||||||
interval = _attackTimeEnd - Calendar.getInstance().getTimeInMillis();
|
interval = _attackTimeEnd - currentTime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1855,7 +1856,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
_firstTimeRun = false; // cooldown phase ends event hour, so it will be not first run
|
_firstTimeRun = false; // cooldown phase ends event hour, so it will be not first run
|
||||||
}
|
}
|
||||||
|
|
||||||
final long interval = time.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long interval = time.getTimeInMillis() - System.currentTimeMillis();
|
||||||
_changeEntryTimeTask = ThreadPool.schedule(new ChangeEntryTime(), interval);
|
_changeEntryTimeTask = ThreadPool.schedule(new ChangeEntryTime(), interval);
|
||||||
if (_changeCoolDownTimeTask != null)
|
if (_changeCoolDownTimeTask != null)
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-5
@@ -21,7 +21,6 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
@@ -189,7 +188,7 @@ public class RaidBossSpawnManager
|
|||||||
final int RespawnMinDelay = boss.getSpawn().getRespawnMinDelay();
|
final int RespawnMinDelay = boss.getSpawn().getRespawnMinDelay();
|
||||||
final int RespawnMaxDelay = boss.getSpawn().getRespawnMaxDelay();
|
final int RespawnMaxDelay = boss.getSpawn().getRespawnMaxDelay();
|
||||||
final long respawnDelay = Rnd.get((int) (RespawnMinDelay * 1000 * Config.RAID_MIN_RESPAWN_MULTIPLIER), (int) (RespawnMaxDelay * 1000 * Config.RAID_MAX_RESPAWN_MULTIPLIER));
|
final long respawnDelay = Rnd.get((int) (RespawnMinDelay * 1000 * Config.RAID_MIN_RESPAWN_MULTIPLIER), (int) (RespawnMaxDelay * 1000 * Config.RAID_MAX_RESPAWN_MULTIPLIER));
|
||||||
final long respawnTime = Calendar.getInstance().getTimeInMillis() + respawnDelay;
|
final long respawnTime = System.currentTimeMillis() + respawnDelay;
|
||||||
info.set("currentHP", boss.getMaxHp());
|
info.set("currentHP", boss.getMaxHp());
|
||||||
info.set("currentMP", boss.getMaxMp());
|
info.set("currentMP", boss.getMaxMp());
|
||||||
info.set("respawnTime", respawnTime);
|
info.set("respawnTime", respawnTime);
|
||||||
@@ -229,9 +228,9 @@ public class RaidBossSpawnManager
|
|||||||
|
|
||||||
double hp = currentHP;
|
double hp = currentHP;
|
||||||
final int bossId = spawnDat.getNpcId();
|
final int bossId = spawnDat.getNpcId();
|
||||||
final long time = Calendar.getInstance().getTimeInMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||||
if ((respawnTime == 0) || (time > respawnTime))
|
if ((respawnTime == 0) || (currentTime > respawnTime))
|
||||||
{
|
{
|
||||||
final RaidBoss raidboss = bossId == 25328 ? DayNightSpawnManager.getInstance().handleBoss(spawnDat) : (RaidBoss) spawnDat.doSpawn();
|
final RaidBoss raidboss = bossId == 25328 ? DayNightSpawnManager.getInstance().handleBoss(spawnDat) : (RaidBoss) spawnDat.doSpawn();
|
||||||
if (raidboss != null)
|
if (raidboss != null)
|
||||||
@@ -260,7 +259,7 @@ public class RaidBossSpawnManager
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScheduledFuture<?> futureSpawn;
|
ScheduledFuture<?> futureSpawn;
|
||||||
final long spawnTime = respawnTime - Calendar.getInstance().getTimeInMillis();
|
final long spawnTime = respawnTime - currentTime;
|
||||||
futureSpawn = ThreadPool.schedule(new SpawnSchedule(bossId), spawnTime);
|
futureSpawn = ThreadPool.schedule(new SpawnSchedule(bossId), spawnTime);
|
||||||
_schedules.put(bossId, futureSpawn);
|
_schedules.put(bossId, futureSpawn);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ public class Duel
|
|||||||
*/
|
*/
|
||||||
public int getRemainingTime()
|
public int getRemainingTime()
|
||||||
{
|
{
|
||||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -77,15 +77,15 @@ public class Wedding
|
|||||||
|
|
||||||
public Wedding(Player player1, Player player2)
|
public Wedding(Player player1, Player player2)
|
||||||
{
|
{
|
||||||
final int _tempPlayer1Id = player1.getObjectId();
|
final long currentTime = System.currentTimeMillis();
|
||||||
final int _tempPlayer2Id = player2.getObjectId();
|
_player1Id = player1.getObjectId();
|
||||||
_player1Id = _tempPlayer1Id;
|
_player2Id = player2.getObjectId();
|
||||||
_player2Id = _tempPlayer2Id;
|
|
||||||
_affiancedDate = Calendar.getInstance();
|
_affiancedDate = Calendar.getInstance();
|
||||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_affiancedDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
_weddingDate = Calendar.getInstance();
|
_weddingDate = Calendar.getInstance();
|
||||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
_weddingDate.setTimeInMillis(currentTime);
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
|
|||||||
+16
-12
@@ -235,11 +235,12 @@ public class Olympiad
|
|||||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
switch (_period)
|
switch (_period)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||||
{
|
{
|
||||||
setNewOlympiadEnd();
|
setNewOlympiadEnd();
|
||||||
}
|
}
|
||||||
@@ -251,7 +252,7 @@ public class Olympiad
|
|||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||||
}
|
}
|
||||||
@@ -841,7 +842,7 @@ public class Olympiad
|
|||||||
|
|
||||||
private long getMillisToOlympiadEnd()
|
private long getMillisToOlympiadEnd()
|
||||||
{
|
{
|
||||||
return (_olympiadEnd - Calendar.getInstance().getTimeInMillis());
|
return (_olympiadEnd - System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void manualSelectHeroes()
|
public void manualSelectHeroes()
|
||||||
@@ -856,9 +857,10 @@ public class Olympiad
|
|||||||
|
|
||||||
protected long getMillisToValidationEnd()
|
protected long getMillisToValidationEnd()
|
||||||
{
|
{
|
||||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_validationEnd > currentTime)
|
||||||
{
|
{
|
||||||
return (_validationEnd - Calendar.getInstance().getTimeInMillis());
|
return (_validationEnd - currentTime);
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@@ -902,14 +904,15 @@ public class Olympiad
|
|||||||
|
|
||||||
private long getMillisToCompBegin()
|
private long getMillisToCompBegin()
|
||||||
{
|
{
|
||||||
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if ((_compStart.getTimeInMillis() < currentTime) && (_compEnd > currentTime))
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
if (_compStart.getTimeInMillis() > currentTime)
|
||||||
{
|
{
|
||||||
return (_compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return (_compStart.getTimeInMillis() - currentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
return setNewCompBegin();
|
return setNewCompBegin();
|
||||||
@@ -968,19 +971,20 @@ public class Olympiad
|
|||||||
_compEnd = _compStart.getTimeInMillis() + COMP_PERIOD;
|
_compEnd = _compStart.getTimeInMillis() + COMP_PERIOD;
|
||||||
|
|
||||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||||
return (_compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long getMillisToCompEnd()
|
protected long getMillisToCompEnd()
|
||||||
{
|
{
|
||||||
return (_compEnd - Calendar.getInstance().getTimeInMillis());
|
return _compEnd - System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getMillisToWeekChange()
|
private long getMillisToWeekChange()
|
||||||
{
|
{
|
||||||
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
if (_nextWeeklyChange > currentTime)
|
||||||
{
|
{
|
||||||
return (_nextWeeklyChange - Calendar.getInstance().getTimeInMillis());
|
return (_nextWeeklyChange - currentTime);
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -391,17 +391,19 @@ public class ClanHallAuction
|
|||||||
World.getInstance().getPlayer(_highestBidderName).sendMessage("You have been out bidded");
|
World.getInstance().getPlayer(_highestBidderName).sendMessage("You have been out bidded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
_highestBidderId = bidder.getClanId();
|
_highestBidderId = bidder.getClanId();
|
||||||
_highestBidderMaxBid = bid;
|
_highestBidderMaxBid = bid;
|
||||||
_highestBidderName = bidder.getClan().getLeaderName();
|
_highestBidderName = bidder.getClan().getLeaderName();
|
||||||
if (_bidders.get(_highestBidderId) == null)
|
if (_bidders.get(_highestBidderId) == null)
|
||||||
{
|
{
|
||||||
_bidders.put(_highestBidderId, new Bidder(_highestBidderName, bidder.getClan().getName(), bid, Calendar.getInstance().getTimeInMillis()));
|
_bidders.put(_highestBidderId, new Bidder(_highestBidderName, bidder.getClan().getName(), bid, currentTime));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_bidders.get(_highestBidderId).setBid(bid);
|
_bidders.get(_highestBidderId).setBid(bid);
|
||||||
_bidders.get(_highestBidderId).setTimeBid(Calendar.getInstance().getTimeInMillis());
|
_bidders.get(_highestBidderId).setTimeBid(currentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
bidder.sendMessage("You have bidded successfully");
|
bidder.sendMessage("You have bidded successfully");
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class FortSiege
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
ThreadPool.schedule(new ScheduleEndSiegeTask(_fortInst), timeRemaining - 3600000); // Prepare task for 1 hr left.
|
ThreadPool.schedule(new ScheduleEndSiegeTask(_fortInst), timeRemaining - 3600000); // Prepare task for 1 hr left.
|
||||||
@@ -147,7 +147,7 @@ public class FortSiege
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
// Prepare task for 24 before siege start to end registration
|
// Prepare task for 24 before siege start to end registration
|
||||||
@@ -920,7 +920,7 @@ public class FortSiege
|
|||||||
*/
|
*/
|
||||||
public void checkAutoTask()
|
public void checkAutoTask()
|
||||||
{
|
{
|
||||||
if (getFort().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getFort().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
clearSiegeDate();
|
clearSiegeDate();
|
||||||
saveSiegeDate();
|
saveSiegeDate();
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public class Siege
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 3600000)
|
if (timeRemaining > 3600000)
|
||||||
{
|
{
|
||||||
// Prepare task for 1 hr left.
|
// Prepare task for 1 hr left.
|
||||||
@@ -209,7 +209,7 @@ public class Siege
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long timeRemaining = getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||||
if (timeRemaining > 86400000)
|
if (timeRemaining > 86400000)
|
||||||
{
|
{
|
||||||
// Prepare task for 24 before siege start to end registration
|
// Prepare task for 24 before siege start to end registration
|
||||||
@@ -1247,7 +1247,7 @@ public class Siege
|
|||||||
private void correctSiegeDateTime()
|
private void correctSiegeDateTime()
|
||||||
{
|
{
|
||||||
boolean corrected = false;
|
boolean corrected = false;
|
||||||
if (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Since siege has past reschedule it to the next one (14 days)
|
// Since siege has past reschedule it to the next one (14 days)
|
||||||
// This is usually caused by server being down
|
// This is usually caused by server being down
|
||||||
@@ -1485,7 +1485,7 @@ public class Siege
|
|||||||
/** Set the date for the next siege. */
|
/** Set the date for the next siege. */
|
||||||
private void setNextSiegeDate()
|
private void setNextSiegeDate()
|
||||||
{
|
{
|
||||||
while (getCastle().getSiegeDate().getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
while (getCastle().getSiegeDate().getTimeInMillis() < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
// Set next siege date if siege has passed
|
// Set next siege date if siege has passed
|
||||||
// Schedule to happen in 14 days
|
// Schedule to happen in 14 days
|
||||||
|
|||||||
+1
-2
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@@ -751,7 +750,7 @@ public class EnterWorld implements IClientIncomingPacket
|
|||||||
|
|
||||||
private void onEnterAio(Player player)
|
private void onEnterAio(Player player)
|
||||||
{
|
{
|
||||||
final long now = Calendar.getInstance().getTimeInMillis();
|
final long now = System.currentTimeMillis();
|
||||||
final long endDay = player.getAioEndTime();
|
final long endDay = player.getAioEndTime();
|
||||||
if (now > endDay)
|
if (now > endDay)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-3
@@ -16,8 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.network.serverpackets;
|
package org.l2jmobius.gameserver.network.serverpackets;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
import org.l2jmobius.commons.network.PacketWriter;
|
import org.l2jmobius.commons.network.PacketWriter;
|
||||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||||
import org.l2jmobius.gameserver.model.actor.Player;
|
import org.l2jmobius.gameserver.model.actor.Player;
|
||||||
@@ -101,7 +99,7 @@ public class SiegeInfo implements IClientOutgoingPacket
|
|||||||
packet.writeD(0); // Ally ID
|
packet.writeD(0); // Ally ID
|
||||||
packet.writeS(""); // Ally Name
|
packet.writeS(""); // Ally Name
|
||||||
}
|
}
|
||||||
packet.writeD((int) (Calendar.getInstance().getTimeInMillis() / 1000));
|
packet.writeD((int) (System.currentTimeMillis() / 1000));
|
||||||
packet.writeD((int) _siegeDate);
|
packet.writeD((int) _siegeDate);
|
||||||
packet.writeD(0); // number of choices?
|
packet.writeD(0); // number of choices?
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Vendored
+19
-18
@@ -285,56 +285,57 @@ public class AdminSiege implements IAdminCommandHandler
|
|||||||
{
|
{
|
||||||
if (st.hasMoreTokens())
|
if (st.hasMoreTokens())
|
||||||
{
|
{
|
||||||
final Calendar cal = Calendar.getInstance();
|
final long currentTime = System.currentTimeMillis();
|
||||||
cal.setTimeInMillis(castle.getSiegeDate().getTimeInMillis());
|
final Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTimeInMillis(castle.getSiegeDate().getTimeInMillis());
|
||||||
val = st.nextToken();
|
val = st.nextToken();
|
||||||
if ("month".equals(val))
|
if ("month".equals(val))
|
||||||
{
|
{
|
||||||
final int month = cal.get(Calendar.MONTH) + Integer.parseInt(st.nextToken());
|
final int month = calendar.get(Calendar.MONTH) + Integer.parseInt(st.nextToken());
|
||||||
if ((cal.getActualMinimum(Calendar.MONTH) > month) || (cal.getActualMaximum(Calendar.MONTH) < month))
|
if ((calendar.getActualMinimum(Calendar.MONTH) > month) || (calendar.getActualMaximum(Calendar.MONTH) < month))
|
||||||
{
|
{
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Unable to change Siege Date - Incorrect month value only " + cal.getActualMinimum(Calendar.MONTH) + "-" + cal.getActualMaximum(Calendar.MONTH) + " is accepted!");
|
BuilderUtil.sendSysMessage(activeChar, "Unable to change Siege Date - Incorrect month value only " + calendar.getActualMinimum(Calendar.MONTH) + "-" + calendar.getActualMaximum(Calendar.MONTH) + " is accepted!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cal.set(Calendar.MONTH, month);
|
calendar.set(Calendar.MONTH, month);
|
||||||
}
|
}
|
||||||
else if ("day".equals(val))
|
else if ("day".equals(val))
|
||||||
{
|
{
|
||||||
final int day = Integer.parseInt(st.nextToken());
|
final int day = Integer.parseInt(st.nextToken());
|
||||||
if ((cal.getActualMinimum(Calendar.DAY_OF_MONTH) > day) || (cal.getActualMaximum(Calendar.DAY_OF_MONTH) < day))
|
if ((calendar.getActualMinimum(Calendar.DAY_OF_MONTH) > day) || (calendar.getActualMaximum(Calendar.DAY_OF_MONTH) < day))
|
||||||
{
|
{
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Unable to change Siege Date - Incorrect day value only " + cal.getActualMinimum(Calendar.DAY_OF_MONTH) + "-" + cal.getActualMaximum(Calendar.DAY_OF_MONTH) + " is accepted!");
|
BuilderUtil.sendSysMessage(activeChar, "Unable to change Siege Date - Incorrect day value only " + calendar.getActualMinimum(Calendar.DAY_OF_MONTH) + "-" + calendar.getActualMaximum(Calendar.DAY_OF_MONTH) + " is accepted!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cal.set(Calendar.DAY_OF_MONTH, day);
|
calendar.set(Calendar.DAY_OF_MONTH, day);
|
||||||
}
|
}
|
||||||
else if ("hour".equals(val))
|
else if ("hour".equals(val))
|
||||||
{
|
{
|
||||||
final int hour = Integer.parseInt(st.nextToken());
|
final int hour = Integer.parseInt(st.nextToken());
|
||||||
if ((cal.getActualMinimum(Calendar.HOUR_OF_DAY) > hour) || (cal.getActualMaximum(Calendar.HOUR_OF_DAY) < hour))
|
if ((calendar.getActualMinimum(Calendar.HOUR_OF_DAY) > hour) || (calendar.getActualMaximum(Calendar.HOUR_OF_DAY) < hour))
|
||||||
{
|
{
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Unable to change Siege Date - Incorrect hour value only " + cal.getActualMinimum(Calendar.HOUR_OF_DAY) + "-" + cal.getActualMaximum(Calendar.HOUR_OF_DAY) + " is accepted!");
|
BuilderUtil.sendSysMessage(activeChar, "Unable to change Siege Date - Incorrect hour value only " + calendar.getActualMinimum(Calendar.HOUR_OF_DAY) + "-" + calendar.getActualMaximum(Calendar.HOUR_OF_DAY) + " is accepted!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cal.set(Calendar.HOUR_OF_DAY, hour);
|
calendar.set(Calendar.HOUR_OF_DAY, hour);
|
||||||
}
|
}
|
||||||
else if ("min".equals(val))
|
else if ("min".equals(val))
|
||||||
{
|
{
|
||||||
final int min = Integer.parseInt(st.nextToken());
|
final int min = Integer.parseInt(st.nextToken());
|
||||||
if ((cal.getActualMinimum(Calendar.MINUTE) > min) || (cal.getActualMaximum(Calendar.MINUTE) < min))
|
if ((calendar.getActualMinimum(Calendar.MINUTE) > min) || (calendar.getActualMaximum(Calendar.MINUTE) < min))
|
||||||
{
|
{
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Unable to change Siege Date - Incorrect minute value only " + cal.getActualMinimum(Calendar.MINUTE) + "-" + cal.getActualMaximum(Calendar.MINUTE) + " is accepted!");
|
BuilderUtil.sendSysMessage(activeChar, "Unable to change Siege Date - Incorrect minute value only " + calendar.getActualMinimum(Calendar.MINUTE) + "-" + calendar.getActualMaximum(Calendar.MINUTE) + " is accepted!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cal.set(Calendar.MINUTE, min);
|
calendar.set(Calendar.MINUTE, min);
|
||||||
}
|
}
|
||||||
if (cal.getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
if (calendar.getTimeInMillis() < currentTime)
|
||||||
{
|
{
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Unable to change Siege Date");
|
BuilderUtil.sendSysMessage(activeChar, "Unable to change Siege Date");
|
||||||
}
|
}
|
||||||
else if (cal.getTimeInMillis() != castle.getSiegeDate().getTimeInMillis())
|
else if (calendar.getTimeInMillis() != castle.getSiegeDate().getTimeInMillis())
|
||||||
{
|
{
|
||||||
castle.getSiegeDate().setTimeInMillis(cal.getTimeInMillis());
|
castle.getSiegeDate().setTimeInMillis(calendar.getTimeInMillis());
|
||||||
castle.getSiege().saveSiegeDate();
|
castle.getSiege().saveSiegeDate();
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Castle siege time for castle " + castle.getName() + " has been changed.");
|
BuilderUtil.sendSysMessage(activeChar, "Castle siege time for castle " + castle.getName() + " has been changed.");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -17,7 +17,6 @@
|
|||||||
package quests.Q00655_AGrandPlanForTamingWildBeasts;
|
package quests.Q00655_AGrandPlanForTamingWildBeasts;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||||
import org.l2jmobius.gameserver.enums.QuestSound;
|
import org.l2jmobius.gameserver.enums.QuestSound;
|
||||||
@@ -192,7 +191,7 @@ public class Q00655_AGrandPlanForTamingWildBeasts extends Quest
|
|||||||
private static long getMinutesToSiege()
|
private static long getMinutesToSiege()
|
||||||
{
|
{
|
||||||
final SiegableHall hall = CHSiegeManager.getInstance().getSiegableHall(ClanHallSiegeEngine.BEAST_FARM);
|
final SiegableHall hall = CHSiegeManager.getInstance().getSiegableHall(ClanHallSiegeEngine.BEAST_FARM);
|
||||||
return hall != null ? (hall.getNextSiegeTime() - Calendar.getInstance().getTimeInMillis()) / 3600 : -1;
|
return hall != null ? (hall.getNextSiegeTime() - System.currentTimeMillis()) / 3600 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
f.vload();
|
f.vload();
|
||||||
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
final Topic t = new Topic(TopicConstructorType.CREATE, getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, currentTime, player.getName(), player.getObjectId(), Topic.MEMO, 0);
|
||||||
f.addTopic(t);
|
f.addTopic(t);
|
||||||
getInstance().setMaxID(t.getID(), f);
|
getInstance().setMaxID(t.getID(), f);
|
||||||
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
|
final Post p = new Post(player.getName(), player.getObjectId(), currentTime, t.getID(), f.getID(), ar4);
|
||||||
PostBBSManager.getInstance().addPostByTopic(p, t);
|
PostBBSManager.getInstance().addPostByTopic(p, t);
|
||||||
parsecmd("_bbsmemo", player);
|
parsecmd("_bbsmemo", player);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -197,7 +197,7 @@ public class FourSepulchersManager
|
|||||||
protected void timeSelector()
|
protected void timeSelector()
|
||||||
{
|
{
|
||||||
timeCalculator();
|
timeCalculator();
|
||||||
final long currentTime = Calendar.getInstance().getTimeInMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
// if current time >= time of entry beginning and if current time < time of entry beginning + time of entry end
|
// if current time >= time of entry beginning and if current time < time of entry beginning + time of entry end
|
||||||
if ((currentTime >= _coolDownTimeEnd) && (currentTime < _entryTimeEnd)) // entry time check
|
if ((currentTime >= _coolDownTimeEnd) && (currentTime < _entryTimeEnd)) // entry time check
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-4
@@ -171,7 +171,7 @@ public class RaidBossSpawnManager
|
|||||||
final int respawnMinDelay = (int) (boss.getSpawn().getRespawnMinDelay() * Config.RAID_MIN_RESPAWN_MULTIPLIER);
|
final int respawnMinDelay = (int) (boss.getSpawn().getRespawnMinDelay() * Config.RAID_MIN_RESPAWN_MULTIPLIER);
|
||||||
final int respawnMaxDelay = (int) (boss.getSpawn().getRespawnMaxDelay() * Config.RAID_MAX_RESPAWN_MULTIPLIER);
|
final int respawnMaxDelay = (int) (boss.getSpawn().getRespawnMaxDelay() * Config.RAID_MAX_RESPAWN_MULTIPLIER);
|
||||||
final int respawnDelay = Rnd.get(respawnMinDelay, respawnMaxDelay);
|
final int respawnDelay = Rnd.get(respawnMinDelay, respawnMaxDelay);
|
||||||
final long respawnTime = Calendar.getInstance().getTimeInMillis() + respawnDelay;
|
final long respawnTime = System.currentTimeMillis() + respawnDelay;
|
||||||
info.set("currentHP", boss.getMaxHp());
|
info.set("currentHP", boss.getMaxHp());
|
||||||
info.set("currentMP", boss.getMaxMp());
|
info.set("currentMP", boss.getMaxMp());
|
||||||
info.set("respawnTime", respawnTime);
|
info.set("respawnTime", respawnTime);
|
||||||
@@ -211,9 +211,9 @@ public class RaidBossSpawnManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int bossId = spawnDat.getId();
|
final int bossId = spawnDat.getId();
|
||||||
final long time = Calendar.getInstance().getTimeInMillis();
|
final long currentTime = System.currentTimeMillis();
|
||||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||||
if ((respawnTime == 0) || (time > respawnTime))
|
if ((respawnTime == 0) || (currentTime > respawnTime))
|
||||||
{
|
{
|
||||||
final RaidBoss raidboss = bossId == 25328 ? DayNightSpawnManager.getInstance().handleBoss(spawnDat) : (RaidBoss) spawnDat.doSpawn();
|
final RaidBoss raidboss = bossId == 25328 ? DayNightSpawnManager.getInstance().handleBoss(spawnDat) : (RaidBoss) spawnDat.doSpawn();
|
||||||
if (raidboss != null)
|
if (raidboss != null)
|
||||||
@@ -233,7 +233,7 @@ public class RaidBossSpawnManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_schedules.put(bossId, ThreadPool.schedule(new SpawnSchedule(bossId), respawnTime - Calendar.getInstance().getTimeInMillis()));
|
_schedules.put(bossId, ThreadPool.schedule(new SpawnSchedule(bossId), respawnTime - currentTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
_spawns.put(bossId, spawnDat);
|
_spawns.put(bossId, spawnDat);
|
||||||
|
|||||||
+10
-5
@@ -45,9 +45,10 @@ public class FourSepulchersChangeAttackTimeTask implements Runnable
|
|||||||
manager.spawnMysteriousBox(31923);
|
manager.spawnMysteriousBox(31923);
|
||||||
manager.spawnMysteriousBox(31924);
|
manager.spawnMysteriousBox(31924);
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
if (!manager.isFirstTimeRun())
|
if (!manager.isFirstTimeRun())
|
||||||
{
|
{
|
||||||
manager.setWarmUpTimeEnd(Calendar.getInstance().getTimeInMillis());
|
manager.setWarmUpTimeEnd(currentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
long interval = 0;
|
long interval = 0;
|
||||||
@@ -59,9 +60,13 @@ public class FourSepulchersChangeAttackTimeTask implements Runnable
|
|||||||
// looking for next shout time....
|
// looking for next shout time....
|
||||||
if ((min % 5) == 0) // check if min can be divided by 5
|
if ((min % 5) == 0) // check if min can be divided by 5
|
||||||
{
|
{
|
||||||
final Calendar inter = Calendar.getInstance();
|
final Calendar calendar = Calendar.getInstance();
|
||||||
inter.set(Calendar.MINUTE, (int) min);
|
calendar.set(Calendar.MINUTE, (int) min);
|
||||||
ThreadPool.schedule(new FourSepulchersManagerSayTask(), inter.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
if (calendar.getTimeInMillis() < currentTime)
|
||||||
|
{
|
||||||
|
calendar.add(Calendar.MINUTE, 1);
|
||||||
|
}
|
||||||
|
ThreadPool.schedule(new FourSepulchersManagerSayTask(), calendar.getTimeInMillis() - currentTime);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -76,7 +81,7 @@ public class FourSepulchersChangeAttackTimeTask implements Runnable
|
|||||||
// and then launching change time task
|
// and then launching change time task
|
||||||
if (manager.isFirstTimeRun())
|
if (manager.isFirstTimeRun())
|
||||||
{
|
{
|
||||||
interval = manager.getAttackTimeEnd() - Calendar.getInstance().getTimeInMillis();
|
interval = manager.getAttackTimeEnd() - currentTime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-1
@@ -39,6 +39,7 @@ public class FourSepulchersChangeCoolDownTimeTask implements Runnable
|
|||||||
|
|
||||||
manager.clean();
|
manager.clean();
|
||||||
|
|
||||||
|
final long currentTime = System.currentTimeMillis();
|
||||||
final Calendar time = Calendar.getInstance();
|
final Calendar time = Calendar.getInstance();
|
||||||
// one hour = 55th min to 55 min of next hour, so we check for this,
|
// one hour = 55th min to 55 min of next hour, so we check for this,
|
||||||
// also check for first launch
|
// also check for first launch
|
||||||
@@ -52,7 +53,7 @@ public class FourSepulchersChangeCoolDownTimeTask implements Runnable
|
|||||||
manager.setFirstTimeRun(false);
|
manager.setFirstTimeRun(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
final long interval = time.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
final long interval = time.getTimeInMillis() - currentTime;
|
||||||
|
|
||||||
manager.setChangeEntryTimeTask(ThreadPool.schedule(new FourSepulchersChangeEntryTimeTask(), interval));
|
manager.setChangeEntryTimeTask(ThreadPool.schedule(new FourSepulchersChangeEntryTimeTask(), interval));
|
||||||
final ScheduledFuture<?> changeCoolDownTimeTask = manager.getChangeCoolDownTimeTask();
|
final ScheduledFuture<?> changeCoolDownTimeTask = manager.getChangeCoolDownTimeTask();
|
||||||
|
|||||||
+1
-2
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.instancemanager.tasks;
|
package org.l2jmobius.gameserver.instancemanager.tasks;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -38,7 +37,7 @@ public class FourSepulchersChangeEntryTimeTask implements Runnable
|
|||||||
manager.setAttackTime(false);
|
manager.setAttackTime(false);
|
||||||
manager.setCoolDownTime(false);
|
manager.setCoolDownTime(false);
|
||||||
|
|
||||||
final long interval = manager.isFirstTimeRun() ? manager.getEntrytTimeEnd() - Calendar.getInstance().getTimeInMillis() : Config.FS_TIME_ENTRY * 60000;
|
final long interval = manager.isFirstTimeRun() ? manager.getEntrytTimeEnd() - System.currentTimeMillis() : Config.FS_TIME_ENTRY * 60000;
|
||||||
// launching saying process...
|
// launching saying process...
|
||||||
ThreadPool.schedule(new FourSepulchersManagerSayTask(), 0);
|
ThreadPool.schedule(new FourSepulchersManagerSayTask(), 0);
|
||||||
manager.setChangeWarmUpTimeTask(ThreadPool.schedule(new FourSepulchersChangeWarmUpTimeTask(), interval));
|
manager.setChangeWarmUpTimeTask(ThreadPool.schedule(new FourSepulchersChangeWarmUpTimeTask(), interval));
|
||||||
|
|||||||
+1
-2
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.instancemanager.tasks;
|
package org.l2jmobius.gameserver.instancemanager.tasks;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -38,7 +37,7 @@ public class FourSepulchersChangeWarmUpTimeTask implements Runnable
|
|||||||
manager.setAttackTime(false);
|
manager.setAttackTime(false);
|
||||||
manager.setCoolDownTime(false);
|
manager.setCoolDownTime(false);
|
||||||
|
|
||||||
final long interval = manager.isFirstTimeRun() ? manager.getWarmUpTimeEnd() - Calendar.getInstance().getTimeInMillis() : Config.FS_TIME_WARMUP * 60000;
|
final long interval = manager.isFirstTimeRun() ? manager.getWarmUpTimeEnd() - System.currentTimeMillis() : Config.FS_TIME_WARMUP * 60000;
|
||||||
manager.setChangeAttackTimeTask(ThreadPool.schedule(new FourSepulchersChangeAttackTimeTask(), interval));
|
manager.setChangeAttackTimeTask(ThreadPool.schedule(new FourSepulchersChangeAttackTimeTask(), interval));
|
||||||
final ScheduledFuture<?> changeWarmUpTimeTask = manager.getChangeWarmUpTimeTask();
|
final ScheduledFuture<?> changeWarmUpTimeTask = manager.getChangeWarmUpTimeTask();
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user