Calendar should never be used to get current time.
This commit is contained in:
@@ -285,56 +285,57 @@ public class AdminSiege implements IAdminCommandHandler
|
||||
{
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(castle.getSiegeDate().getTimeInMillis());
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(castle.getSiegeDate().getTimeInMillis());
|
||||
val = st.nextToken();
|
||||
if ("month".equals(val))
|
||||
{
|
||||
final int month = cal.get(Calendar.MONTH) + Integer.parseInt(st.nextToken());
|
||||
if ((cal.getActualMinimum(Calendar.MONTH) > month) || (cal.getActualMaximum(Calendar.MONTH) < month))
|
||||
final int month = calendar.get(Calendar.MONTH) + Integer.parseInt(st.nextToken());
|
||||
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;
|
||||
}
|
||||
cal.set(Calendar.MONTH, month);
|
||||
calendar.set(Calendar.MONTH, month);
|
||||
}
|
||||
else if ("day".equals(val))
|
||||
{
|
||||
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;
|
||||
}
|
||||
cal.set(Calendar.DAY_OF_MONTH, day);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, day);
|
||||
}
|
||||
else if ("hour".equals(val))
|
||||
{
|
||||
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;
|
||||
}
|
||||
cal.set(Calendar.HOUR_OF_DAY, hour);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, hour);
|
||||
}
|
||||
else if ("min".equals(val))
|
||||
{
|
||||
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;
|
||||
}
|
||||
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");
|
||||
}
|
||||
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();
|
||||
BuilderUtil.sendSysMessage(activeChar, "Castle siege time for castle " + castle.getName() + " has been changed.");
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public class AdminTerritoryWar implements IAdminCommandHandler
|
||||
{
|
||||
if (st.hasMoreTokens())
|
||||
{
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(TerritoryWarManager.getInstance().getTWStartTimeInMillis());
|
||||
|
||||
@@ -102,7 +103,7 @@ public class AdminTerritoryWar implements IAdminCommandHandler
|
||||
cal.set(Calendar.MINUTE, min);
|
||||
}
|
||||
|
||||
if (cal.getTimeInMillis() < Calendar.getInstance().getTimeInMillis())
|
||||
if (cal.getTimeInMillis() < currentTime)
|
||||
{
|
||||
BuilderUtil.sendSysMessage(activeChar, "Unable to change TW Date!");
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package quests.Q00655_AGrandPlanForTamingWildBeasts;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.enums.QuestSound;
|
||||
@@ -192,7 +191,7 @@ public class Q00655_AGrandPlanForTamingWildBeasts extends Quest
|
||||
private static long getMinutesToSiege()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
@@ -87,11 +86,12 @@ public class TopicBBSManager extends BaseBBSManager
|
||||
}
|
||||
else
|
||||
{
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
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);
|
||||
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);
|
||||
parsecmd("_bbsmemo", player);
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ public class FourSepulchersManager
|
||||
protected void timeSelector()
|
||||
{
|
||||
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 ((currentTime >= _coolDownTimeEnd) && (currentTime < _entryTimeEnd)) // entry time check
|
||||
{
|
||||
|
||||
@@ -171,7 +171,7 @@ public class RaidBossSpawnManager
|
||||
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 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("currentMP", boss.getMaxMp());
|
||||
info.set("respawnTime", respawnTime);
|
||||
@@ -211,9 +211,9 @@ public class RaidBossSpawnManager
|
||||
}
|
||||
|
||||
final int bossId = spawnDat.getId();
|
||||
final long time = Calendar.getInstance().getTimeInMillis();
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
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();
|
||||
if (raidboss != null)
|
||||
@@ -233,7 +233,7 @@ public class RaidBossSpawnManager
|
||||
}
|
||||
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);
|
||||
|
||||
@@ -1273,7 +1273,7 @@ public class TerritoryWarManager implements Siegable
|
||||
_scheduledStartTWTask.cancel(false);
|
||||
try
|
||||
{
|
||||
final long timeRemaining = _startTWDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
||||
final long timeRemaining = _startTWDate.getTimeInMillis() - System.currentTimeMillis();
|
||||
if (timeRemaining > 7200000)
|
||||
{
|
||||
_isRegistrationOver = false;
|
||||
@@ -1352,7 +1352,7 @@ public class TerritoryWarManager implements Siegable
|
||||
try
|
||||
{
|
||||
_scheduledEndTWTask.cancel(false);
|
||||
final long timeRemaining = (_startTWDate.getTimeInMillis() + WARLENGTH) - Calendar.getInstance().getTimeInMillis();
|
||||
final long timeRemaining = (_startTWDate.getTimeInMillis() + WARLENGTH) - System.currentTimeMillis();
|
||||
if (timeRemaining > 3600000)
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.THE_TERRITORY_WAR_WILL_END_IN_S1_HOUR_S);
|
||||
|
||||
@@ -45,9 +45,10 @@ public class FourSepulchersChangeAttackTimeTask implements Runnable
|
||||
manager.spawnMysteriousBox(31923);
|
||||
manager.spawnMysteriousBox(31924);
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
if (!manager.isFirstTimeRun())
|
||||
{
|
||||
manager.setWarmUpTimeEnd(Calendar.getInstance().getTimeInMillis());
|
||||
manager.setWarmUpTimeEnd(currentTime);
|
||||
}
|
||||
|
||||
long interval = 0;
|
||||
@@ -57,11 +58,15 @@ public class FourSepulchersChangeAttackTimeTask implements Runnable
|
||||
for (double min = Calendar.getInstance().get(Calendar.MINUTE); min < manager.getCycleMin(); min++)
|
||||
{
|
||||
// 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();
|
||||
inter.set(Calendar.MINUTE, (int) min);
|
||||
ThreadPool.schedule(new FourSepulchersManagerSayTask(), inter.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
||||
final Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.MINUTE, (int) min);
|
||||
if (calendar.getTimeInMillis() < currentTime)
|
||||
{
|
||||
calendar.add(Calendar.MINUTE, 1);
|
||||
}
|
||||
ThreadPool.schedule(new FourSepulchersManagerSayTask(), calendar.getTimeInMillis() - currentTime);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +81,7 @@ public class FourSepulchersChangeAttackTimeTask implements Runnable
|
||||
// and then launching change time task
|
||||
if (manager.isFirstTimeRun())
|
||||
{
|
||||
interval = manager.getAttackTimeEnd() - Calendar.getInstance().getTimeInMillis();
|
||||
interval = manager.getAttackTimeEnd() - currentTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ public class FourSepulchersChangeCoolDownTimeTask implements Runnable
|
||||
|
||||
manager.clean();
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final Calendar time = Calendar.getInstance();
|
||||
// one hour = 55th min to 55 min of next hour, so we check for this,
|
||||
// also check for first launch
|
||||
@@ -52,7 +53,7 @@ public class FourSepulchersChangeCoolDownTimeTask implements Runnable
|
||||
manager.setFirstTimeRun(false);
|
||||
}
|
||||
|
||||
final long interval = time.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
||||
final long interval = time.getTimeInMillis() - currentTime;
|
||||
|
||||
manager.setChangeEntryTimeTask(ThreadPool.schedule(new FourSepulchersChangeEntryTimeTask(), interval));
|
||||
final ScheduledFuture<?> changeCoolDownTimeTask = manager.getChangeCoolDownTimeTask();
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.instancemanager.tasks;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
@@ -38,7 +37,7 @@ public class FourSepulchersChangeEntryTimeTask implements Runnable
|
||||
manager.setAttackTime(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...
|
||||
ThreadPool.schedule(new FourSepulchersManagerSayTask(), 0);
|
||||
manager.setChangeWarmUpTimeTask(ThreadPool.schedule(new FourSepulchersChangeWarmUpTimeTask(), interval));
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.instancemanager.tasks;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
@@ -38,7 +37,7 @@ public class FourSepulchersChangeWarmUpTimeTask implements Runnable
|
||||
manager.setAttackTime(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));
|
||||
final ScheduledFuture<?> changeWarmUpTimeTask = manager.getChangeWarmUpTimeTask();
|
||||
|
||||
|
||||
@@ -34,15 +34,10 @@ public class FourSepulchersManagerSayTask implements Runnable
|
||||
if (FourSepulchersManager.getInstance().isAttackTime())
|
||||
{
|
||||
final Calendar tmp = Calendar.getInstance();
|
||||
tmp.setTimeInMillis(Calendar.getInstance().getTimeInMillis() - FourSepulchersManager.getInstance().getWarmUpTimeEnd());
|
||||
tmp.setTimeInMillis(System.currentTimeMillis() - FourSepulchersManager.getInstance().getWarmUpTimeEnd());
|
||||
if ((tmp.get(Calendar.MINUTE) + 5) < Config.FS_TIME_ATTACK)
|
||||
{
|
||||
FourSepulchersManager.getInstance().managerSay((byte) tmp.get(Calendar.MINUTE)); // byte
|
||||
// because
|
||||
// minute
|
||||
// cannot be
|
||||
// more than
|
||||
// 59
|
||||
FourSepulchersManager.getInstance().managerSay((byte) tmp.get(Calendar.MINUTE)); // byte because minute cannot be more than 59
|
||||
ThreadPool.schedule(new FourSepulchersManagerSayTask(), 5 * 60000);
|
||||
}
|
||||
// attack time ending chat
|
||||
|
||||
@@ -72,15 +72,15 @@ public class Couple
|
||||
|
||||
public Couple(Player player1, Player player2)
|
||||
{
|
||||
final int _tempPlayer1Id = player1.getObjectId();
|
||||
final int _tempPlayer2Id = player2.getObjectId();
|
||||
_player1Id = _tempPlayer1Id;
|
||||
_player2Id = _tempPlayer2Id;
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
_player1Id = player1.getObjectId();
|
||||
_player2Id = player2.getObjectId();
|
||||
|
||||
_affiancedDate = Calendar.getInstance();
|
||||
_affiancedDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
||||
_affiancedDate.setTimeInMillis(currentTime);
|
||||
|
||||
_weddingDate = Calendar.getInstance();
|
||||
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
||||
_weddingDate.setTimeInMillis(currentTime);
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||
|
||||
@@ -558,7 +558,7 @@ public class Duel
|
||||
*/
|
||||
public int getRemainingTime()
|
||||
{
|
||||
return (int) (_duelEndTime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
|
||||
return (int) (_duelEndTime.getTimeInMillis() - System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -227,11 +227,12 @@ public class Olympiad extends ListenersContainer
|
||||
_nextWeeklyChange = Long.parseLong(olympiadProperties.getProperty("NextWeeklyChange", "0"));
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
switch (_period)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if ((_olympiadEnd == 0) || (_olympiadEnd < Calendar.getInstance().getTimeInMillis()))
|
||||
if ((_olympiadEnd == 0) || (_olympiadEnd < currentTime))
|
||||
{
|
||||
setNewOlympiadEnd();
|
||||
}
|
||||
@@ -243,7 +244,7 @@ public class Olympiad extends ListenersContainer
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
|
||||
if (_validationEnd > currentTime)
|
||||
{
|
||||
loadNoblesRank();
|
||||
_scheduledValdationTask = ThreadPool.schedule(new ValidationEndTask(), getMillisToValidationEnd());
|
||||
@@ -630,8 +631,8 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
private long getMillisToOlympiadEnd()
|
||||
{
|
||||
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
|
||||
return _olympiadEnd - Calendar.getInstance().getTimeInMillis();
|
||||
// if (_olympiadEnd > System.currentTimeMillis())
|
||||
return _olympiadEnd - System.currentTimeMillis();
|
||||
// return 10;
|
||||
}
|
||||
|
||||
@@ -647,9 +648,10 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -747,14 +749,15 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
|
||||
if (_compStart.getTimeInMillis() > currentTime)
|
||||
{
|
||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
||||
return _compStart.getTimeInMillis() - currentTime;
|
||||
}
|
||||
|
||||
return setNewCompBegin();
|
||||
@@ -815,21 +818,22 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
LOGGER.info("Olympiad System: New Schedule @ " + _compStart.getTime());
|
||||
|
||||
return _compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
||||
return _compStart.getTimeInMillis() - System.currentTimeMillis();
|
||||
}
|
||||
|
||||
protected long getMillisToCompEnd()
|
||||
{
|
||||
// if (_compEnd > Calendar.getInstance().getTimeInMillis())
|
||||
return _compEnd - Calendar.getInstance().getTimeInMillis();
|
||||
// if (_compEnd > System.currentTimeMillis())
|
||||
return _compEnd - System.currentTimeMillis();
|
||||
// return 10;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -843,7 +847,7 @@ public class Olympiad extends ListenersContainer
|
||||
resetWeeklyMatches();
|
||||
LOGGER.info("Olympiad System: Reset weekly matches to nobles");
|
||||
|
||||
_nextWeeklyChange = Calendar.getInstance().getTimeInMillis() + WEEKLY_PERIOD;
|
||||
_nextWeeklyChange = System.currentTimeMillis() + WEEKLY_PERIOD;
|
||||
}, getMillisToWeekChange(), WEEKLY_PERIOD);
|
||||
}
|
||||
|
||||
|
||||
@@ -367,17 +367,18 @@ public class ClanHallAuction
|
||||
}
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
_highestBidderId = bidder.getClanId();
|
||||
_highestBidderMaxBid = bid;
|
||||
_highestBidderName = bidder.getClan().getLeaderName();
|
||||
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
|
||||
{
|
||||
_bidders.get(_highestBidderId).setBid(bid);
|
||||
_bidders.get(_highestBidderId).setTimeBid(Calendar.getInstance().getTimeInMillis());
|
||||
_bidders.get(_highestBidderId).setTimeBid(currentTime);
|
||||
}
|
||||
bidder.sendPacket(SystemMessageId.YOUR_BID_HAS_BEEN_SUCCESSFULLY_PLACED);
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.model.AutoSpawnHandler;
|
||||
import org.l2jmobius.gameserver.model.AutoSpawnHandler.AutoSpawnInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
import org.l2jmobius.gameserver.model.siege.Castle;
|
||||
import org.l2jmobius.gameserver.model.skill.CommonSkill;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -598,7 +598,7 @@ public class SevenSigns
|
||||
final long nextPeriodChange = getMilliToPeriodChange();
|
||||
long nextQuestStart = 0;
|
||||
long nextValidStart = 0;
|
||||
long tillDate = date.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
||||
long tillDate = date.getTimeInMillis() - System.currentTimeMillis();
|
||||
while (((2 * PERIOD_MAJOR_LENGTH) + (2 * PERIOD_MINOR_LENGTH)) < tillDate)
|
||||
{
|
||||
tillDate -= ((2 * PERIOD_MAJOR_LENGTH) + (2 * PERIOD_MINOR_LENGTH));
|
||||
|
||||
@@ -821,7 +821,7 @@ public class FortSiege implements Siegable
|
||||
return;
|
||||
}
|
||||
|
||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
||||
final long delay = getFort().getSiegeDate().getTimeInMillis() - System.currentTimeMillis();
|
||||
if (delay < 0)
|
||||
{
|
||||
// siege time in past
|
||||
|
||||
@@ -101,7 +101,7 @@ public class Siege implements Siegable
|
||||
|
||||
try
|
||||
{
|
||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
||||
final long timeRemaining = _siegeEndDate.getTimeInMillis() - System.currentTimeMillis();
|
||||
if (timeRemaining > 3600000)
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HOUR_S_UNTIL_CASTLE_SIEGE_CONCLUSION);
|
||||
@@ -169,9 +169,10 @@ public class Siege implements Siegable
|
||||
|
||||
try
|
||||
{
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
if (!isTimeRegistrationOver())
|
||||
{
|
||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
||||
final long regTimeRemaining = getTimeRegistrationOverDate().getTimeInMillis() - currentTime;
|
||||
if (regTimeRemaining > 0)
|
||||
{
|
||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), regTimeRemaining);
|
||||
@@ -180,7 +181,7 @@ public class Siege implements Siegable
|
||||
endTimeRegistration(true);
|
||||
}
|
||||
|
||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - Calendar.getInstance().getTimeInMillis();
|
||||
final long timeRemaining = getSiegeDate().getTimeInMillis() - currentTime;
|
||||
if (timeRemaining > 86400000)
|
||||
{
|
||||
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castleInst), timeRemaining - 86400000); // Prepare task for 24 before siege start to end registration
|
||||
@@ -1203,7 +1204,7 @@ public class Siege implements Siegable
|
||||
public void correctSiegeDateTime()
|
||||
{
|
||||
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
|
||||
// This is usually caused by server being down
|
||||
@@ -1314,7 +1315,7 @@ public class Siege implements Siegable
|
||||
{
|
||||
setNextSiegeDate(); // Set the next set date for 2 weeks from now
|
||||
// Schedule Time registration end
|
||||
getTimeRegistrationOverDate().setTimeInMillis(Calendar.getInstance().getTimeInMillis());
|
||||
getTimeRegistrationOverDate().setTimeInMillis(System.currentTimeMillis());
|
||||
getTimeRegistrationOverDate().add(Calendar.DAY_OF_MONTH, 1);
|
||||
getCastle().setTimeRegistrationOver(false);
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
@@ -38,8 +37,8 @@ public class ExShowDominionRegistry implements IClientOutgoingPacket
|
||||
private int _mercReq = 0x00;
|
||||
private int _isMercRegistered = 0x00;
|
||||
private int _isClanRegistered = 0x00;
|
||||
private int _warTime = (int) (Calendar.getInstance().getTimeInMillis() / 1000);
|
||||
private final int _currentTime = (int) (Calendar.getInstance().getTimeInMillis() / 1000);
|
||||
private int _warTime = (int) (System.currentTimeMillis() / 1000);
|
||||
private final int _currentTime = (int) (System.currentTimeMillis() / 1000);
|
||||
|
||||
public ExShowDominionRegistry(int castleId, Player player)
|
||||
{
|
||||
|
||||
@@ -144,7 +144,7 @@ public class SiegeInfo implements IClientOutgoingPacket
|
||||
packet.writeD(0); // Ally ID
|
||||
packet.writeS(""); // Ally Name
|
||||
}
|
||||
packet.writeD((int) (Calendar.getInstance().getTimeInMillis() / 1000));
|
||||
packet.writeD((int) (System.currentTimeMillis() / 1000));
|
||||
packet.writeD((int) ((CHSiegeManager.getInstance().getSiegableHall(_hall.getId()).getNextSiegeTime()) / 1000));
|
||||
packet.writeD(0); // number of choices?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user