Addition of the Chronos class.
This commit is contained in:
@@ -21,6 +21,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.MountType;
|
||||
@@ -169,14 +170,14 @@ public class Antharas extends AbstractNpcAI
|
||||
_antharas = (GrandBossInstance) addSpawn(ANTHARAS, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
_antharas.setCurrentHpMp(curr_hp, curr_mp);
|
||||
addBoss(_antharas);
|
||||
_lastAttack = System.currentTimeMillis();
|
||||
_lastAttack = Chronos.currentTimeMillis();
|
||||
startQuestTimer("CHECK_ATTACK", 60000, _antharas, null);
|
||||
startQuestTimer("SPAWN_MINION", 300000, _antharas, null);
|
||||
break;
|
||||
}
|
||||
case DEAD:
|
||||
{
|
||||
final long remain = respawnTime - System.currentTimeMillis();
|
||||
final long remain = respawnTime - Chronos.currentTimeMillis();
|
||||
if (remain > 0)
|
||||
{
|
||||
startQuestTimer("CLEAR_STATUS", remain, null, null);
|
||||
@@ -272,7 +273,7 @@ public class Antharas extends AbstractNpcAI
|
||||
_antharas.setRandomWalking(false);
|
||||
_antharas.teleToLocation(181323, 114850, -7623, 32542);
|
||||
setStatus(IN_FIGHT);
|
||||
_lastAttack = System.currentTimeMillis();
|
||||
_lastAttack = Chronos.currentTimeMillis();
|
||||
zone.broadcastPacket(new PlaySound("BS02_A"));
|
||||
startQuestTimer("CAMERA_1", 23, _antharas, null);
|
||||
break;
|
||||
@@ -367,7 +368,7 @@ public class Antharas extends AbstractNpcAI
|
||||
}
|
||||
case "CHECK_ATTACK":
|
||||
{
|
||||
if ((npc != null) && ((_lastAttack + 900000) < System.currentTimeMillis()))
|
||||
if ((npc != null) && ((_lastAttack + 900000) < Chronos.currentTimeMillis()))
|
||||
{
|
||||
setStatus(ALIVE);
|
||||
for (Creature creature : zone.getCharactersInside())
|
||||
@@ -619,7 +620,7 @@ public class Antharas extends AbstractNpcAI
|
||||
@Override
|
||||
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
|
||||
{
|
||||
_lastAttack = System.currentTimeMillis();
|
||||
_lastAttack = Chronos.currentTimeMillis();
|
||||
if (npc.getId() == BOMBER)
|
||||
{
|
||||
if (npc.calculateDistance3D(attacker) < 230)
|
||||
@@ -765,7 +766,7 @@ public class Antharas extends AbstractNpcAI
|
||||
|
||||
private void setRespawn(long respawnTime)
|
||||
{
|
||||
GrandBossManager.getInstance().getStatSet(ANTHARAS).set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().getStatSet(ANTHARAS).set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
|
||||
}
|
||||
|
||||
private final void refreshAiParams(PlayerInstance attacker, int damage)
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package ai.bosses.Baium;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.CategoryType;
|
||||
@@ -136,7 +137,7 @@ public class Baium extends AbstractNpcAI
|
||||
final int heading = info.getInt("heading");
|
||||
_baium = (GrandBossInstance) addSpawn(BAIUM, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
_baium.setCurrentHpMp(curr_hp, curr_mp);
|
||||
_lastAttack = System.currentTimeMillis();
|
||||
_lastAttack = Chronos.currentTimeMillis();
|
||||
addBoss(_baium);
|
||||
|
||||
for (Location loc : ARCHANGEL_LOC)
|
||||
@@ -149,7 +150,7 @@ public class Baium extends AbstractNpcAI
|
||||
}
|
||||
case DEAD:
|
||||
{
|
||||
final long remain = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
final long remain = info.getLong("respawn_time") - Chronos.currentTimeMillis();
|
||||
if (remain > 0)
|
||||
{
|
||||
startQuestTimer("CLEAR_STATUS", remain, null, null);
|
||||
@@ -209,7 +210,7 @@ public class Baium extends AbstractNpcAI
|
||||
_baium.disableCoreAI(true);
|
||||
_baium.setRandomWalking(false);
|
||||
addBoss(_baium);
|
||||
_lastAttack = System.currentTimeMillis();
|
||||
_lastAttack = Chronos.currentTimeMillis();
|
||||
startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
|
||||
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
|
||||
startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
|
||||
@@ -375,7 +376,7 @@ public class Baium extends AbstractNpcAI
|
||||
}
|
||||
case "CHECK_ATTACK":
|
||||
{
|
||||
if ((npc != null) && ((_lastAttack + 1800000) < System.currentTimeMillis()))
|
||||
if ((npc != null) && ((_lastAttack + 1800000) < Chronos.currentTimeMillis()))
|
||||
{
|
||||
notifyEvent("CLEAR_ZONE", null, null);
|
||||
addSpawn(BAIUM_STONE, BAIUM_LOC, false, 0);
|
||||
@@ -383,7 +384,7 @@ public class Baium extends AbstractNpcAI
|
||||
}
|
||||
else if (npc != null)
|
||||
{
|
||||
if (((_lastAttack + 300000) < System.currentTimeMillis()) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)))
|
||||
if (((_lastAttack + 300000) < Chronos.currentTimeMillis()) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)))
|
||||
{
|
||||
npc.setTarget(npc);
|
||||
npc.doCast(HEAL_OF_BAIUM.getSkill());
|
||||
@@ -484,7 +485,7 @@ public class Baium extends AbstractNpcAI
|
||||
@Override
|
||||
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
|
||||
{
|
||||
_lastAttack = System.currentTimeMillis();
|
||||
_lastAttack = Chronos.currentTimeMillis();
|
||||
if (npc.getId() == BAIUM)
|
||||
{
|
||||
if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTI_STRIDER.getSkillId()) && !npc.isSkillDisabled(ANTI_STRIDER.getSkill()))
|
||||
@@ -663,7 +664,7 @@ public class Baium extends AbstractNpcAI
|
||||
|
||||
private void setRespawn(long respawnTime)
|
||||
{
|
||||
GrandBossManager.getInstance().getStatSet(BAIUM).set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
||||
GrandBossManager.getInstance().getStatSet(BAIUM).set("respawn_time", (Chronos.currentTimeMillis() + respawnTime));
|
||||
}
|
||||
|
||||
private void manageSkills(Npc npc)
|
||||
|
@@ -23,6 +23,7 @@ import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
@@ -88,7 +89,7 @@ public class Core extends AbstractNpcAI
|
||||
if (GrandBossManager.getInstance().getBossStatus(CORE) == DEAD)
|
||||
{
|
||||
// Load the unlock date and time for Core from DB.
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
final long temp = info.getLong("respawn_time") - Chronos.currentTimeMillis();
|
||||
// If Core is locked until a certain time, mark it so and start the unlock timer the unlock time has not yet expired.
|
||||
if (temp > 0)
|
||||
{
|
||||
@@ -204,7 +205,7 @@ public class Core extends AbstractNpcAI
|
||||
startQuestTimer("core_unlock", respawnTime, null, null);
|
||||
// Also save the respawn time so that the info is maintained past reboots.
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(CORE);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(CORE, info);
|
||||
startQuestTimer("despawn_minions", 20000, null, null);
|
||||
cancelQuestTimers("spawn_minion");
|
||||
|
@@ -20,6 +20,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
@@ -97,7 +98,7 @@ public class Orfen extends AbstractNpcAI
|
||||
if (status == DEAD)
|
||||
{
|
||||
// load the unlock date and time for Orfen from DB
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
final long temp = info.getLong("respawn_time") - Chronos.currentTimeMillis();
|
||||
// if Orfen is locked until a certain time, mark it so and start the unlock timer
|
||||
// the unlock time has not yet expired.
|
||||
if (temp > 0)
|
||||
@@ -328,7 +329,7 @@ public class Orfen extends AbstractNpcAI
|
||||
startQuestTimer("orfen_unlock", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ORFEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(ORFEN, info);
|
||||
cancelQuestTimer("check_minion_loc", npc, null);
|
||||
cancelQuestTimer("check_orfen_pos", npc, null);
|
||||
|
@@ -20,6 +20,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
@@ -96,7 +97,7 @@ public class QueenAnt extends AbstractNpcAI
|
||||
if (status == DEAD)
|
||||
{
|
||||
// load the unlock date and time for queen ant from DB
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
final long temp = info.getLong("respawn_time") - Chronos.currentTimeMillis();
|
||||
// if queen ant is locked until a certain time, mark it so and start the unlock timer
|
||||
// the unlock time has not yet expired.
|
||||
if (temp > 0)
|
||||
@@ -367,7 +368,7 @@ public class QueenAnt extends AbstractNpcAI
|
||||
cancelQuestTimer("heal", null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(QUEEN, info);
|
||||
_nurses.clear();
|
||||
_larva.deleteMe();
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package ai.bosses.Zaken;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -53,7 +54,7 @@ public class Zaken extends AbstractNpcAI
|
||||
if (status == DEAD)
|
||||
{
|
||||
// load the unlock date and time from DB
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
final long temp = info.getLong("respawn_time") - Chronos.currentTimeMillis();
|
||||
if (temp > 0)
|
||||
{
|
||||
startQuestTimer("zaken_unlock", temp, null, null);
|
||||
@@ -97,7 +98,7 @@ public class Zaken extends AbstractNpcAI
|
||||
startQuestTimer("zaken_unlock", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ZAKEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(ZAKEN, info);
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
@@ -46,8 +46,8 @@ import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcManorBypass;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.siege.Castle;
|
||||
import org.l2jmobius.gameserver.model.siege.Fort;
|
||||
import org.l2jmobius.gameserver.model.siege.Castle.CastleFunction;
|
||||
import org.l2jmobius.gameserver.model.siege.Fort;
|
||||
import org.l2jmobius.gameserver.model.teleporter.TeleportHolder;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExShowCropInfo;
|
||||
|
@@ -26,6 +26,7 @@ import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.xml.ClanHallData;
|
||||
import org.l2jmobius.gameserver.instancemanager.ClanHallAuctionManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -154,7 +155,7 @@ public class ClanHallAuctioneer extends AbstractNpcAI
|
||||
htmltext = htmltext.replace("%id%", String.valueOf(clanHallAuction.getClanHallId()));
|
||||
htmltext = htmltext.replace("%minBid%", String.valueOf(clanHallAuction.getHighestBid()));
|
||||
htmltext = htmltext.replace("%myBid%", String.valueOf(clanHallAuction.getClanBid(clan)));
|
||||
htmltext = htmltext.replace("%auctionEnd%", builder.appendPattern("dd/MM/yyyy HH").appendLiteral(" hour ").appendPattern("mm").appendLiteral(" minutes").toFormatter().format(Instant.ofEpochMilli(System.currentTimeMillis() + clanHallAuction.getRemaingTime()).atZone(ZoneId.systemDefault())));
|
||||
htmltext = htmltext.replace("%auctionEnd%", builder.appendPattern("dd/MM/yyyy HH").appendLiteral(" hour ").appendPattern("mm").appendLiteral(" minutes").toFormatter().format(Instant.ofEpochMilli(Chronos.currentTimeMillis() + clanHallAuction.getRemaingTime()).atZone(ZoneId.systemDefault())));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -190,7 +191,7 @@ public class ClanHallAuctioneer extends AbstractNpcAI
|
||||
final ClanHall clanHall = ClanHallData.getInstance().getClanHallById(clanHallAuction.getClanHallId());
|
||||
final Clan owner = clanHall.getOwner();
|
||||
final long remainingTime = clanHallAuction.getRemaingTime();
|
||||
final Instant endTime = Instant.ofEpochMilli(System.currentTimeMillis() + remainingTime);
|
||||
final Instant endTime = Instant.ofEpochMilli(Chronos.currentTimeMillis() + remainingTime);
|
||||
|
||||
final DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
|
||||
htmltext = getHtm(player, "ClanHallAuctioneer-bidInfo.html");
|
||||
@@ -248,7 +249,7 @@ public class ClanHallAuctioneer extends AbstractNpcAI
|
||||
final ClanHallAuction clanHallAuction = ClanHallAuctionManager.getInstance().getClanHallAuctionById(clanHallId);
|
||||
final Clan owner = clanHall.getOwner();
|
||||
final long remainingTime = clanHallAuction.getRemaingTime();
|
||||
final Instant endTime = Instant.ofEpochMilli(System.currentTimeMillis() + remainingTime);
|
||||
final Instant endTime = Instant.ofEpochMilli(Chronos.currentTimeMillis() + remainingTime);
|
||||
final DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
|
||||
final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
|
||||
html.setHtml(getHtm(player, "ClanHallAuctioneer-info.html"));
|
||||
@@ -297,7 +298,7 @@ public class ClanHallAuctioneer extends AbstractNpcAI
|
||||
sb.append("\"><font color=\"ffffaa\">&%");
|
||||
sb.append(clanHall.getResidenceId());
|
||||
sb.append(";[0]</font></a></td><td width=50>");
|
||||
sb.append(DateTimeFormatter.ofPattern("dd/MM/yyyy").format(Instant.ofEpochMilli(System.currentTimeMillis() + auction.getRemaingTime()).atZone(ZoneId.systemDefault())));
|
||||
sb.append(DateTimeFormatter.ofPattern("dd/MM/yyyy").format(Instant.ofEpochMilli(Chronos.currentTimeMillis() + auction.getRemaingTime()).atZone(ZoneId.systemDefault())));
|
||||
sb.append("</td><td width=70 align=right><font color=\"aaffff\">");
|
||||
sb.append(auction.getHighestBid());
|
||||
sb.append("</font></td></tr>");
|
||||
|
@@ -21,6 +21,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.xml.ClanHallData;
|
||||
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
@@ -73,7 +74,7 @@ public class ProvisionalHalls extends AbstractNpcAI
|
||||
if (resetTime > 0)
|
||||
{
|
||||
cancelQuestTimers(HALL_RESET_VAR + id);
|
||||
startQuestTimer(HALL_RESET_VAR + id, Math.max(1000, (TWO_WEEKS - (System.currentTimeMillis() - resetTime) - 30000)), null, null);
|
||||
startQuestTimer(HALL_RESET_VAR + id, Math.max(1000, (TWO_WEEKS - (Chronos.currentTimeMillis() - resetTime) - 30000)), null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,7 +127,7 @@ public class ProvisionalHalls extends AbstractNpcAI
|
||||
|
||||
for (int id : CLAN_HALLS.keySet())
|
||||
{
|
||||
if ((GlobalVariablesManager.getInstance().getInt(HALL_OWNER_VAR + id, 0) == 0) && ((GlobalVariablesManager.getInstance().getLong(HALL_TIME_VAR + id, 0) + TWO_WEEKS) < System.currentTimeMillis()))
|
||||
if ((GlobalVariablesManager.getInstance().getInt(HALL_OWNER_VAR + id, 0) == 0) && ((GlobalVariablesManager.getInstance().getLong(HALL_TIME_VAR + id, 0) + TWO_WEEKS) < Chronos.currentTimeMillis()))
|
||||
{
|
||||
player.reduceAdena("ProvisionalHall", HALL_PRICE, player, true);
|
||||
GlobalVariablesManager.getInstance().set(HALL_OWNER_VAR + id, player.getClanId());
|
||||
@@ -137,7 +138,7 @@ public class ProvisionalHalls extends AbstractNpcAI
|
||||
clanHall.setOwner(player.getClan());
|
||||
}
|
||||
player.sendMessage("Congratulations! You now own a provisional clan hall!");
|
||||
startQuestTimer("RESET_ORCHID_HALL", TWO_WEEKS - (System.currentTimeMillis() - calendar.getTimeInMillis()), null, null);
|
||||
startQuestTimer("RESET_ORCHID_HALL", TWO_WEEKS - (Chronos.currentTimeMillis() - calendar.getTimeInMillis()), null, null);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -177,7 +178,7 @@ public class ProvisionalHalls extends AbstractNpcAI
|
||||
else if (event.startsWith(HALL_RESET_VAR))
|
||||
{
|
||||
final String id = event.replace(HALL_RESET_VAR, "");
|
||||
if (((GlobalVariablesManager.getInstance().getLong(HALL_TIME_VAR + id, 0) + TWO_WEEKS) - 60000) <= System.currentTimeMillis())
|
||||
if (((GlobalVariablesManager.getInstance().getLong(HALL_TIME_VAR + id, 0) + TWO_WEEKS) - 60000) <= Chronos.currentTimeMillis())
|
||||
{
|
||||
final int clanId = GlobalVariablesManager.getInstance().getInt(HALL_OWNER_VAR + id, 0);
|
||||
if (clanId > 0)
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package events.HappyHours;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -39,7 +40,7 @@ public class HappyHours extends LongTimeEvent
|
||||
// Other
|
||||
private static final int MIN_LEVEL = 20;
|
||||
private static final int REWARD_INTERVAL = 60 * 60 * 1000; // 1 hour
|
||||
private static long _lastRewardTime = System.currentTimeMillis();
|
||||
private static long _lastRewardTime = Chronos.currentTimeMillis();
|
||||
|
||||
private HappyHours()
|
||||
{
|
||||
@@ -76,9 +77,9 @@ public class HappyHours extends LongTimeEvent
|
||||
{
|
||||
if (isEventPeriod())
|
||||
{
|
||||
if ((System.currentTimeMillis() - (_lastRewardTime + REWARD_INTERVAL)) > 0) // Exploit check - Just in case.
|
||||
if ((Chronos.currentTimeMillis() - (_lastRewardTime + REWARD_INTERVAL)) > 0) // Exploit check - Just in case.
|
||||
{
|
||||
_lastRewardTime = System.currentTimeMillis();
|
||||
_lastRewardTime = Chronos.currentTimeMillis();
|
||||
final ExShowScreenMessage screenMsg = new ExShowScreenMessage("You obtained 20 Sibi's coins.", ExShowScreenMessage.TOP_CENTER, 7000, 0, true, true);
|
||||
final SystemMessage systemMsg = new SystemMessage(SystemMessageId.YOU_OBTAINED_S1_SIBI_S_COINS);
|
||||
systemMsg.addInt(20);
|
||||
|
@@ -19,6 +19,7 @@ package handlers.admincommandhandlers;
|
||||
import java.util.Collection;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
|
||||
import org.l2jmobius.gameserver.model.CursedWeapon;
|
||||
@@ -209,7 +210,7 @@ public class AdminCursedWeapons implements IAdminCommandHandler
|
||||
{
|
||||
activeChar.addItem("AdminCursedWeaponAdd", id, 1, activeChar, true);
|
||||
}
|
||||
cw.setEndTime(System.currentTimeMillis() + (cw.getDuration() * 60000));
|
||||
cw.setEndTime(Chronos.currentTimeMillis() + (cw.getDuration() * 60000));
|
||||
cw.reActivate();
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@ package handlers.admincommandhandlers;
|
||||
import java.util.Calendar;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.GraciaSeedsManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -66,7 +67,7 @@ public class AdminGraciaSeeds implements IAdminCommandHandler
|
||||
if (GraciaSeedsManager.getInstance().getSoDTimeForNextStateChange() > 0)
|
||||
{
|
||||
final Calendar nextChangeDate = Calendar.getInstance();
|
||||
nextChangeDate.setTimeInMillis(System.currentTimeMillis() + GraciaSeedsManager.getInstance().getSoDTimeForNextStateChange());
|
||||
nextChangeDate.setTimeInMillis(Chronos.currentTimeMillis() + GraciaSeedsManager.getInstance().getSoDTimeForNextStateChange());
|
||||
html.replace("%sodtime%", nextChangeDate.getTime().toString());
|
||||
}
|
||||
else
|
||||
|
@@ -20,6 +20,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@@ -117,7 +118,7 @@ public class AdminInstanceZone implements IAdminCommandHandler
|
||||
int hours = 0;
|
||||
int minutes = 0;
|
||||
final int id = entry.getKey();
|
||||
final long remainingTime = (entry.getValue() - System.currentTimeMillis()) / 1000;
|
||||
final long remainingTime = (entry.getValue() - Chronos.currentTimeMillis()) / 1000;
|
||||
if (remainingTime > 0)
|
||||
{
|
||||
hours = (int) (remainingTime / 3600);
|
||||
|
@@ -24,6 +24,7 @@ import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
@@ -233,7 +234,7 @@ public class AdminPunishment implements IAdminCommandHandler
|
||||
long expirationTime = Integer.parseInt(exp);
|
||||
if (expirationTime > 0)
|
||||
{
|
||||
expirationTime = System.currentTimeMillis() + (expirationTime * 60 * 1000);
|
||||
expirationTime = Chronos.currentTimeMillis() + (expirationTime * 60 * 1000);
|
||||
}
|
||||
|
||||
final PunishmentAffect affect = PunishmentAffect.getByName(af);
|
||||
|
@@ -24,6 +24,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameServer;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
@@ -60,7 +61,7 @@ public class AdminServerInfo implements IAdminCommandHandler
|
||||
html.replace("%gameTime%", GameTimeController.getInstance().getGameHour() + ":" + GameTimeController.getInstance().getGameMinute());
|
||||
html.replace("%dayNight%", GameTimeController.getInstance().isNight() ? "Night" : "Day");
|
||||
html.replace("%geodata%", Config.PATHFINDING ? "Enabled" : "Disabled");
|
||||
html.replace("%serverTime%", SDF.format(new Date(System.currentTimeMillis())));
|
||||
html.replace("%serverTime%", SDF.format(new Date(Chronos.currentTimeMillis())));
|
||||
html.replace("%serverUpTime%", getServerUpTime());
|
||||
html.replace("%onlineAll%", getPlayersCount("ALL"));
|
||||
html.replace("%offlineTrade%", getPlayersCount("OFF_TRADE"));
|
||||
@@ -76,7 +77,7 @@ public class AdminServerInfo implements IAdminCommandHandler
|
||||
|
||||
private String getServerUpTime()
|
||||
{
|
||||
long time = System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis();
|
||||
long time = Chronos.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis();
|
||||
|
||||
final long days = TimeUnit.MILLISECONDS.toDays(time);
|
||||
time -= TimeUnit.DAYS.toMillis(days);
|
||||
|
@@ -21,6 +21,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.handler.IBypassHandler;
|
||||
@@ -133,7 +134,7 @@ public class FindPvP implements IBypassHandler
|
||||
player.setSpawnProtection(true);
|
||||
if (!player.isGM())
|
||||
{
|
||||
player.setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_PVP_TIME);
|
||||
player.setPvpFlagLasts(Chronos.currentTimeMillis() + Config.PVP_PVP_TIME);
|
||||
player.startPvPFlag();
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package handlers.dailymissionhandlers;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||
import org.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||
@@ -61,9 +62,9 @@ public class LoginMonthDailyMissionHandler extends AbstractDailyMissionHandler
|
||||
final long lastCompleted = entry.getLastCompleted();
|
||||
if (lastCompleted == 0) // Initial entry.
|
||||
{
|
||||
entry.setLastCompleted(System.currentTimeMillis());
|
||||
entry.setLastCompleted(Chronos.currentTimeMillis());
|
||||
}
|
||||
else if ((System.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||
else if ((Chronos.currentTimeMillis() - lastCompleted) > 2506000000L) // 2506000000L (29 day) delay.
|
||||
{
|
||||
entry.setProgress(1);
|
||||
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||
|
@@ -18,6 +18,7 @@ package handlers.dailymissionhandlers;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||
import org.l2jmobius.gameserver.handler.AbstractDailyMissionHandler;
|
||||
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||
@@ -63,7 +64,7 @@ public class LoginWeekendDailyMissionHandler extends AbstractDailyMissionHandler
|
||||
final int currentDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
|
||||
final long lastCompleted = entry.getLastCompleted();
|
||||
if (((currentDay == Calendar.SATURDAY) || (currentDay == Calendar.SUNDAY)) // Reward only on weekend.
|
||||
&& ((lastCompleted == 0) || ((System.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||
&& ((lastCompleted == 0) || ((Chronos.currentTimeMillis() - lastCompleted) > 172800000))) // Initial entry or 172800000 (2 day) delay.
|
||||
{
|
||||
entry.setProgress(1);
|
||||
entry.setStatus(DailyMissionStatus.AVAILABLE);
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package handlers.punishmenthandlers;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@@ -126,7 +127,7 @@ public class ChatBanHandler implements IPunishmentHandler
|
||||
*/
|
||||
private void applyToPlayer(PunishmentTask task, PlayerInstance player)
|
||||
{
|
||||
final long delay = ((task.getExpirationTime() - System.currentTimeMillis()) / 1000);
|
||||
final long delay = ((task.getExpirationTime() - Chronos.currentTimeMillis()) / 1000);
|
||||
if (delay > 0)
|
||||
{
|
||||
player.sendMessage("You've been chat banned for " + (delay > 60 ? ((delay / 60) + " minutes.") : delay + " seconds."));
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package handlers.punishmenthandlers;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||
@@ -180,7 +181,7 @@ public class JailHandler implements IPunishmentHandler
|
||||
player.sendPacket(msg);
|
||||
if (task != null)
|
||||
{
|
||||
final long delay = ((task.getExpirationTime() - System.currentTimeMillis()) / 1000);
|
||||
final long delay = ((task.getExpirationTime() - Chronos.currentTimeMillis()) / 1000);
|
||||
if (delay > 0)
|
||||
{
|
||||
player.sendMessage("You've been jailed for " + (delay > 60 ? ((delay / 60) + " minutes.") : delay + " seconds."));
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
@@ -65,7 +66,7 @@ public class Ban implements ITelnetCommand
|
||||
if (Util.isDigit(token))
|
||||
{
|
||||
time = Integer.parseInt(token) * 60 * 1000;
|
||||
time += System.currentTimeMillis();
|
||||
time += Chronos.currentTimeMillis();
|
||||
}
|
||||
if (args.length > 2)
|
||||
{
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
@@ -65,7 +66,7 @@ public class BanChat implements ITelnetCommand
|
||||
if (Util.isDigit(token))
|
||||
{
|
||||
time = Integer.parseInt(token) * 60 * 1000;
|
||||
time += System.currentTimeMillis();
|
||||
time += Chronos.currentTimeMillis();
|
||||
}
|
||||
if (args.length > 2)
|
||||
{
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
@@ -65,7 +66,7 @@ public class Jail implements ITelnetCommand
|
||||
if (Util.isDigit(token))
|
||||
{
|
||||
time = Integer.parseInt(token) * 60 * 1000;
|
||||
time += System.currentTimeMillis();
|
||||
time += Chronos.currentTimeMillis();
|
||||
}
|
||||
if (args.length > 2)
|
||||
{
|
||||
|
@@ -18,6 +18,7 @@ package handlers.usercommandhandlers;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.handler.IUserCommandHandler;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
@@ -46,7 +47,7 @@ public class ClanPenalty implements IUserCommandHandler
|
||||
final StringBuilder htmlContent = new StringBuilder(500);
|
||||
htmlContent.append("<html><body><center><table width=270 border=0 bgcolor=111111><tr><td width=170>Penalty</td><td width=100 align=center>Expiration Date</td></tr></table><table width=270 border=0><tr>");
|
||||
|
||||
if (player.getClanJoinExpiryTime() > System.currentTimeMillis())
|
||||
if (player.getClanJoinExpiryTime() > Chronos.currentTimeMillis())
|
||||
{
|
||||
htmlContent.append("<td width=170>Unable to join a clan.</td><td width=100 align=center>");
|
||||
htmlContent.append(format.format(player.getClanJoinExpiryTime()));
|
||||
@@ -54,7 +55,7 @@ public class ClanPenalty implements IUserCommandHandler
|
||||
penalty = true;
|
||||
}
|
||||
|
||||
if (player.getClanCreateExpiryTime() > System.currentTimeMillis())
|
||||
if (player.getClanCreateExpiryTime() > Chronos.currentTimeMillis())
|
||||
{
|
||||
htmlContent.append("<td width=170>Unable to create a clan.</td><td width=100 align=center>");
|
||||
htmlContent.append(format.format(player.getClanCreateExpiryTime()));
|
||||
@@ -62,7 +63,7 @@ public class ClanPenalty implements IUserCommandHandler
|
||||
penalty = true;
|
||||
}
|
||||
|
||||
if ((player.getClan() != null) && (player.getClan().getCharPenaltyExpiryTime() > System.currentTimeMillis()))
|
||||
if ((player.getClan() != null) && (player.getClan().getCharPenaltyExpiryTime() > Chronos.currentTimeMillis()))
|
||||
{
|
||||
htmlContent.append("<td width=170>Unable to invite a clan member.</td><td width=100 align=center>");
|
||||
htmlContent.append(format.format(player.getClan().getCharPenaltyExpiryTime()));
|
||||
|
@@ -20,6 +20,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.handler.IUserCommandHandler;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -74,7 +75,7 @@ public class Time implements IUserCommandHandler
|
||||
player.sendPacket(sm);
|
||||
if (Config.DISPLAY_SERVER_TIME)
|
||||
{
|
||||
player.sendMessage("Server time is " + SDF.format(new Date(System.currentTimeMillis())));
|
||||
player.sendMessage("Server time is " + SDF.format(new Date(Chronos.currentTimeMillis())));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ package handlers.voicedcommandhandlers;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
import org.l2jmobius.gameserver.handler.IVoicedCommandHandler;
|
||||
@@ -103,7 +104,7 @@ public class ChatAdmin implements IVoicedCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, System.currentTimeMillis() + (expirationTime * 1000 * 60), "Chat banned by moderator", activeChar.getName()));
|
||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, Chronos.currentTimeMillis() + (expirationTime * 1000 * 60), "Chat banned by moderator", activeChar.getName()));
|
||||
if (expirationTime > 0)
|
||||
{
|
||||
BuilderUtil.sendSysMessage(activeChar, "Player " + player.getName() + " chat banned for " + expirationTime + " minutes.");
|
||||
|
@@ -19,6 +19,7 @@ package handlers.voicedcommandhandlers;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.handler.IVoicedCommandHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.PremiumManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -74,7 +75,7 @@ public class Premium implements IVoicedCommandHandler
|
||||
html.append("<tr><td>Spoil Chance: <font color=\"LEVEL\">x" + (Config.RATE_SPOIL_DROP_CHANCE_MULTIPLIER * Config.PREMIUM_RATE_SPOIL_CHANCE) + " <br1></font></td></tr>");
|
||||
html.append("<tr><td>Spoil Amount: <font color=\"LEVEL\">x" + (Config.RATE_SPOIL_DROP_AMOUNT_MULTIPLIER * Config.PREMIUM_RATE_SPOIL_AMOUNT) + " <br1></font></td></tr>");
|
||||
html.append("<tr><td>Expires: <font color=\"00A5FF\">" + format.format(endDate) + "</font></td></tr>");
|
||||
html.append("<tr><td>Current Date: <font color=\"70FFCA\">" + format.format(System.currentTimeMillis()) + "<br><br></font></td></tr>");
|
||||
html.append("<tr><td>Current Date: <font color=\"70FFCA\">" + format.format(Chronos.currentTimeMillis()) + "<br><br></font></td></tr>");
|
||||
html.append("<tr><td><center>Premium Info & Rules<br></center></td></tr>");
|
||||
html.append("<tr><td><font color=\"70FFCA\">1. Premium accounts CAN NOT BE TRANSFERED.<br1></font></td></tr>");
|
||||
html.append("<tr><td><font color=\"70FFCA\">2. Premium does not effect party members.<br1></font></td></tr>");
|
||||
|
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Pantelis Andrianakis
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.l2jmobius.commons.util;
|
||||
|
||||
/**
|
||||
* Chronos updates an internal long value with System.currentTimeMillis() approximately every 1 millisecond.<br>
|
||||
* To get the current time in milliseconds use Chronos.currentTimeMillis()
|
||||
* @author Pantelis Andrianakis
|
||||
* @version February 3rd 2021
|
||||
*/
|
||||
public class Chronos extends Thread
|
||||
{
|
||||
private long _currentTimeMillis = System.currentTimeMillis();
|
||||
|
||||
public Chronos()
|
||||
{
|
||||
super.setName("Chronos");
|
||||
super.setPriority(MAX_PRIORITY);
|
||||
super.setDaemon(true);
|
||||
super.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
_currentTimeMillis = System.currentTimeMillis();
|
||||
|
||||
// Sleep for approximately 1 millisecond.
|
||||
try
|
||||
{
|
||||
Thread.sleep(1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond,the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.<br>
|
||||
* <br>
|
||||
* See the description of the class Date for a discussion of slight discrepancies that may arise between "computer time" and coordinated universal time (UTC).
|
||||
* @return the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
|
||||
*/
|
||||
public static long currentTimeMillis()
|
||||
{
|
||||
return getInstance()._currentTimeMillis;
|
||||
}
|
||||
|
||||
public static Chronos getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final Chronos INSTANCE = new Chronos();
|
||||
}
|
||||
}
|
@@ -32,6 +32,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.DeadLockDetector;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
@@ -179,7 +180,7 @@ public class GameServer
|
||||
|
||||
public GameServer() throws Exception
|
||||
{
|
||||
final long serverLoadStart = System.currentTimeMillis();
|
||||
final long serverLoadStart = Chronos.currentTimeMillis();
|
||||
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
@@ -462,7 +463,7 @@ public class GameServer
|
||||
final long totalMem = Runtime.getRuntime().maxMemory() / 1048576;
|
||||
LOGGER.info(getClass().getSimpleName() + ": Started, using " + getUsedMemoryMB() + " of " + totalMem + " MB total memory.");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Maximum number of connected players is " + Config.MAXIMUM_ONLINE_USERS + ".");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Server loaded in " + ((System.currentTimeMillis() - serverLoadStart) / 1000) + " seconds.");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Server loaded in " + ((Chronos.currentTimeMillis() - serverLoadStart) / 1000) + " seconds.");
|
||||
|
||||
ClientNetworkManager.getInstance().start();
|
||||
|
||||
|
@@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
@@ -97,7 +98,7 @@ public class GameTimeController extends Thread
|
||||
*/
|
||||
public int getGameTicks()
|
||||
{
|
||||
return (int) ((System.currentTimeMillis() - _referenceTime) / MILLIS_IN_TICK);
|
||||
return (int) ((Chronos.currentTimeMillis() - _referenceTime) / MILLIS_IN_TICK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,7 +156,7 @@ public class GameTimeController extends Thread
|
||||
|
||||
while (true)
|
||||
{
|
||||
nextTickTime = ((System.currentTimeMillis() / MILLIS_IN_TICK) * MILLIS_IN_TICK) + 100;
|
||||
nextTickTime = ((Chronos.currentTimeMillis() / MILLIS_IN_TICK) * MILLIS_IN_TICK) + 100;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -166,7 +167,7 @@ public class GameTimeController extends Thread
|
||||
LOGGER.log(Level.WARNING, getClass().getSimpleName(), e);
|
||||
}
|
||||
|
||||
sleepTime = nextTickTime - System.currentTimeMillis();
|
||||
sleepTime = nextTickTime - Chronos.currentTimeMillis();
|
||||
if (sleepTime > 0)
|
||||
{
|
||||
try
|
||||
|
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
@@ -42,7 +43,7 @@ public class ItemsAutoDestroy
|
||||
|
||||
public synchronized void addItem(ItemInstance item)
|
||||
{
|
||||
item.setDropTime(System.currentTimeMillis());
|
||||
item.setDropTime(Chronos.currentTimeMillis());
|
||||
_items.add(item);
|
||||
}
|
||||
|
||||
@@ -53,7 +54,7 @@ public class ItemsAutoDestroy
|
||||
return;
|
||||
}
|
||||
|
||||
final long curtime = System.currentTimeMillis();
|
||||
final long curtime = Chronos.currentTimeMillis();
|
||||
final Iterator<ItemInstance> itemIterator = _items.iterator();
|
||||
while (itemIterator.hasNext())
|
||||
{
|
||||
|
@@ -23,6 +23,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseBackup;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
import org.l2jmobius.gameserver.data.SchemeBufferTable;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
@@ -534,19 +535,19 @@ public class Shutdown extends Thread
|
||||
|
||||
protected void restartCounter()
|
||||
{
|
||||
_startTime = System.currentTimeMillis();
|
||||
_startTime = Chronos.currentTimeMillis();
|
||||
}
|
||||
|
||||
protected long getEstimatedTimeAndRestartCounter()
|
||||
{
|
||||
final long toReturn = System.currentTimeMillis() - _startTime;
|
||||
final long toReturn = Chronos.currentTimeMillis() - _startTime;
|
||||
restartCounter();
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
protected long getEstimatedTime()
|
||||
{
|
||||
return System.currentTimeMillis() - _startTime;
|
||||
return Chronos.currentTimeMillis() - _startTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
|
||||
@@ -308,7 +309,7 @@ public class CreatureAI extends AbstractAI
|
||||
|
||||
if (_actor.isAttackingNow())
|
||||
{
|
||||
ThreadPool.schedule(new CastTask(_actor, skill, target, item, forceUse, dontMove), _actor.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
|
||||
ThreadPool.schedule(new CastTask(_actor, skill, target, item, forceUse, dontMove), _actor.getAttackEndTime() - TimeUnit.MILLISECONDS.toNanos(Chronos.currentTimeMillis()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
@@ -39,7 +40,7 @@ public class WarehouseCacheManager
|
||||
|
||||
public void addCacheTask(PlayerInstance pc)
|
||||
{
|
||||
CACHED_WH.put(pc, System.currentTimeMillis());
|
||||
CACHED_WH.put(pc, Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void remCacheTask(PlayerInstance pc)
|
||||
@@ -56,7 +57,7 @@ public class WarehouseCacheManager
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final long cTime = System.currentTimeMillis();
|
||||
final long cTime = Chronos.currentTimeMillis();
|
||||
for (Entry<PlayerInstance, Long> entry : CACHED_WH.entrySet())
|
||||
{
|
||||
if ((cTime - entry.getValue().longValue()) > CACHE_TIME)
|
||||
|
@@ -39,6 +39,7 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@@ -124,7 +125,7 @@ public class BotReportTable
|
||||
final Calendar c = Calendar.getInstance();
|
||||
c.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour[0]));
|
||||
c.set(Calendar.MINUTE, Integer.parseInt(hour[1]));
|
||||
if (System.currentTimeMillis() < c.getTimeInMillis())
|
||||
if (Chronos.currentTimeMillis() < c.getTimeInMillis())
|
||||
{
|
||||
c.set(Calendar.DAY_OF_YEAR, c.get(Calendar.DAY_OF_YEAR) - 1);
|
||||
}
|
||||
@@ -290,7 +291,7 @@ public class BotReportTable
|
||||
return false;
|
||||
}
|
||||
|
||||
final long reuse = (System.currentTimeMillis() - rcdRep.getLastReporTime());
|
||||
final long reuse = (Chronos.currentTimeMillis() - rcdRep.getLastReporTime());
|
||||
if (reuse < Config.BOTREPORT_REPORT_DELAY)
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_CAN_MAKE_ANOTHER_REPORT_IN_S1_MINUTE_S_YOU_HAVE_S2_POINT_S_REMAINING_ON_THIS_ACCOUNT);
|
||||
@@ -301,7 +302,7 @@ public class BotReportTable
|
||||
}
|
||||
}
|
||||
|
||||
final long curTime = System.currentTimeMillis();
|
||||
final long curTime = Chronos.currentTimeMillis();
|
||||
if (rcd == null)
|
||||
{
|
||||
rcd = new ReportedCharData();
|
||||
@@ -418,12 +419,12 @@ public class BotReportTable
|
||||
final Calendar c = Calendar.getInstance();
|
||||
c.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour[0]));
|
||||
c.set(Calendar.MINUTE, Integer.parseInt(hour[1]));
|
||||
if (System.currentTimeMillis() > c.getTimeInMillis())
|
||||
if (Chronos.currentTimeMillis() > c.getTimeInMillis())
|
||||
{
|
||||
c.set(Calendar.DAY_OF_YEAR, c.get(Calendar.DAY_OF_YEAR) + 1);
|
||||
}
|
||||
|
||||
ThreadPool.schedule(new ResetPointTask(), c.getTimeInMillis() - System.currentTimeMillis());
|
||||
ThreadPool.schedule(new ResetPointTask(), c.getTimeInMillis() - Chronos.currentTimeMillis());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -464,7 +465,7 @@ public class BotReportTable
|
||||
{
|
||||
if (map.containsKey(objectId))
|
||||
{
|
||||
return (System.currentTimeMillis() - map.get(objectId)) > Config.BOTREPORT_REPORT_DELAY;
|
||||
return (Chronos.currentTimeMillis() - map.get(objectId)) > Config.BOTREPORT_REPORT_DELAY;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
|
||||
import org.l2jmobius.gameserver.data.xml.ClanHallData;
|
||||
import org.l2jmobius.gameserver.enums.ClanWarState;
|
||||
@@ -171,7 +172,7 @@ public class ClanTable
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_FAILED_TO_CREATE_A_CLAN);
|
||||
return null;
|
||||
}
|
||||
if (System.currentTimeMillis() < player.getClanCreateExpiryTime())
|
||||
if (Chronos.currentTimeMillis() < player.getClanCreateExpiryTime())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_DAYS_BEFORE_CREATING_A_NEW_CLAN);
|
||||
return null;
|
||||
@@ -346,7 +347,7 @@ public class ClanTable
|
||||
{
|
||||
destroyClan(clanId);
|
||||
}
|
||||
}, Math.max(getClan(clanId).getDissolvingExpiryTime() - System.currentTimeMillis(), 300000));
|
||||
}, Math.max(getClan(clanId).getDissolvingExpiryTime() - Chronos.currentTimeMillis(), 300000));
|
||||
}
|
||||
|
||||
public boolean isAllyExists(String allyName)
|
||||
|
@@ -26,6 +26,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.model.ManufactureItem;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
@@ -183,7 +184,7 @@ public class OfflineTraderTable
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(time);
|
||||
cal.add(Calendar.DAY_OF_YEAR, Config.OFFLINE_MAX_DAYS);
|
||||
if (cal.getTimeInMillis() <= System.currentTimeMillis())
|
||||
if (cal.getTimeInMillis() <= Chronos.currentTimeMillis())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.DailyMissionStatus;
|
||||
import org.l2jmobius.gameserver.model.DailyMissionDataHolder;
|
||||
import org.l2jmobius.gameserver.model.DailyMissionPlayerEntry;
|
||||
@@ -107,7 +108,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
|
||||
|
||||
final DailyMissionPlayerEntry entry = getPlayerEntry(player.getObjectId(), true);
|
||||
entry.setStatus(DailyMissionStatus.COMPLETED);
|
||||
entry.setLastCompleted(System.currentTimeMillis());
|
||||
entry.setLastCompleted(Chronos.currentTimeMillis());
|
||||
entry.setRecentlyCompleted(true);
|
||||
storePlayerEntry(entry);
|
||||
|
||||
|
@@ -23,6 +23,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
import org.l2jmobius.gameserver.enums.PlayerAction;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
@@ -115,7 +116,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
// Admin Commands must run through a long running task, otherwise a command that takes too much time will freeze the server, this way you'll feel only a minor spike.
|
||||
ThreadPool.execute(() ->
|
||||
{
|
||||
final long begin = System.currentTimeMillis();
|
||||
final long begin = Chronos.currentTimeMillis();
|
||||
try
|
||||
{
|
||||
if (Config.GMAUDIT)
|
||||
@@ -133,7 +134,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
|
||||
}
|
||||
finally
|
||||
{
|
||||
final long runtime = System.currentTimeMillis() - begin;
|
||||
final long runtime = Chronos.currentTimeMillis() - begin;
|
||||
if (runtime > 5000)
|
||||
{
|
||||
player.sendMessage("The execution of '" + fullCommand + "' took " + TimeAmountInterpreter.consolidateMillis(runtime) + ".");
|
||||
|
@@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
@@ -48,7 +49,7 @@ public class AntiFeedManager
|
||||
*/
|
||||
public void setLastDeathTime(int objectId)
|
||||
{
|
||||
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
||||
_lastDeathTimes.put(objectId, Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +82,7 @@ public class AntiFeedManager
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((Config.ANTIFEED_INTERVAL > 0) && _lastDeathTimes.containsKey(targetPlayer.getObjectId()) && ((System.currentTimeMillis() - _lastDeathTimes.get(targetPlayer.getObjectId())) < Config.ANTIFEED_INTERVAL))
|
||||
if ((Config.ANTIFEED_INTERVAL > 0) && _lastDeathTimes.containsKey(targetPlayer.getObjectId()) && ((Chronos.currentTimeMillis() - _lastDeathTimes.get(targetPlayer.getObjectId())) < Config.ANTIFEED_INTERVAL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -41,6 +41,7 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.ManorMode;
|
||||
@@ -276,7 +277,7 @@ public class CastleManorManager implements IXmlReader, IStorable
|
||||
}
|
||||
}
|
||||
// Schedule mode change
|
||||
ThreadPool.schedule(this::changeMode, (_nextModeChange.getTimeInMillis() - System.currentTimeMillis()));
|
||||
ThreadPool.schedule(this::changeMode, (_nextModeChange.getTimeInMillis() - Chronos.currentTimeMillis()));
|
||||
}
|
||||
|
||||
public void changeMode()
|
||||
|
@@ -35,6 +35,7 @@ import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.CursedWeapon;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
@@ -313,7 +314,7 @@ public class CursedWeaponsManager implements IXmlReader
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HAS_S2_MINUTE_S_OF_USAGE_TIME_REMAINING);
|
||||
sm.addString(cw.getName());
|
||||
// sm.addItemName(cw.getItemId());
|
||||
sm.addInt((int) ((cw.getEndTime() - System.currentTimeMillis()) / 60000));
|
||||
sm.addInt((int) ((cw.getEndTime() - Chronos.currentTimeMillis()) / 60000));
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.SpawnTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@@ -193,7 +194,7 @@ public class DBSpawnManager
|
||||
final int respawnMinDelay = (int) (npc.getSpawn().getRespawnMinDelay() * Config.RAID_MIN_RESPAWN_MULTIPLIER);
|
||||
final int respawnMaxDelay = (int) (npc.getSpawn().getRespawnMaxDelay() * Config.RAID_MAX_RESPAWN_MULTIPLIER);
|
||||
final int respawnDelay = Rnd.get(respawnMinDelay, respawnMaxDelay);
|
||||
final long respawnTime = System.currentTimeMillis() + respawnDelay;
|
||||
final long respawnTime = Chronos.currentTimeMillis() + respawnDelay;
|
||||
info.set("currentHP", npc.getMaxHp());
|
||||
info.set("currentMP", npc.getMaxMp());
|
||||
info.set("respawnTime", respawnTime);
|
||||
@@ -235,7 +236,7 @@ public class DBSpawnManager
|
||||
}
|
||||
|
||||
final int npcId = spawn.getId();
|
||||
final long time = System.currentTimeMillis();
|
||||
final long time = Chronos.currentTimeMillis();
|
||||
SpawnTable.getInstance().addNewSpawn(spawn, false);
|
||||
if ((respawnTime == 0) || (time > respawnTime))
|
||||
{
|
||||
@@ -257,7 +258,7 @@ public class DBSpawnManager
|
||||
}
|
||||
else
|
||||
{
|
||||
final long spawnTime = respawnTime - System.currentTimeMillis();
|
||||
final long spawnTime = respawnTime - Chronos.currentTimeMillis();
|
||||
_schedules.put(npcId, ThreadPool.schedule(() -> scheduleSpawn(npcId), spawnTime));
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.instancemanager.tasks.UpdateSoDStateTask;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
|
||||
@@ -104,7 +105,7 @@ public class GraciaSeedsManager
|
||||
case 2:
|
||||
{
|
||||
// Conquest Complete state, if too much time is passed than change to defense state
|
||||
final long timePast = System.currentTimeMillis() - _SoDLastStateChangeDate.getTimeInMillis();
|
||||
final long timePast = Chronos.currentTimeMillis() - _SoDLastStateChangeDate.getTimeInMillis();
|
||||
if (timePast >= Config.SOD_STAGE_2_LENGTH)
|
||||
{
|
||||
// change to Attack state because Defend statet is not implemented
|
||||
@@ -172,7 +173,7 @@ public class GraciaSeedsManager
|
||||
public void setSoDState(int value, boolean doSave)
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": New Seed of Destruction state -> " + value + ".");
|
||||
_SoDLastStateChangeDate.setTimeInMillis(System.currentTimeMillis());
|
||||
_SoDLastStateChangeDate.setTimeInMillis(Chronos.currentTimeMillis());
|
||||
_SoDState = value;
|
||||
// reset number of Tiat kills
|
||||
if (_SoDState == 1)
|
||||
@@ -198,7 +199,7 @@ public class GraciaSeedsManager
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
return ((_SoDLastStateChangeDate.getTimeInMillis() + Config.SOD_STAGE_2_LENGTH) - System.currentTimeMillis());
|
||||
return ((_SoDLastStateChangeDate.getTimeInMillis() + Config.SOD_STAGE_2_LENGTH) - Chronos.currentTimeMillis());
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
|
@@ -30,6 +30,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.util.PrimeFinder;
|
||||
|
||||
/**
|
||||
@@ -85,7 +86,7 @@ public class IdManager
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
Statement statement = con.createStatement())
|
||||
{
|
||||
final long cleanupStart = System.currentTimeMillis();
|
||||
final long cleanupStart = Chronos.currentTimeMillis();
|
||||
int cleanCount = 0;
|
||||
|
||||
// Characters
|
||||
@@ -157,7 +158,7 @@ public class IdManager
|
||||
statement.executeUpdate("UPDATE characters SET clanid=0, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0, clan_join_expiry_time=0, clan_create_expiry_time=0 WHERE characters.clanid > 0 AND characters.clanid NOT IN (SELECT clan_id FROM clan_data);");
|
||||
statement.executeUpdate("UPDATE fort SET owner=0 WHERE owner NOT IN (SELECT clan_id FROM clan_data);");
|
||||
|
||||
LOGGER.info("IdManager: Cleaned " + cleanCount + " elements from database in " + ((System.currentTimeMillis() - cleanupStart) / 1000) + " seconds.");
|
||||
LOGGER.info("IdManager: Cleaned " + cleanCount + " elements from database in " + ((Chronos.currentTimeMillis() - cleanupStart) / 1000) + " seconds.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -173,7 +174,7 @@ public class IdManager
|
||||
{
|
||||
try (PreparedStatement statement = con.prepareStatement(line))
|
||||
{
|
||||
statement.setLong(1, System.currentTimeMillis());
|
||||
statement.setLong(1, Chronos.currentTimeMillis());
|
||||
cleanCount += statement.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@ import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||
import org.l2jmobius.gameserver.data.xml.SpawnData;
|
||||
@@ -521,7 +522,7 @@ public class InstanceManager implements IXmlReader
|
||||
{
|
||||
// Check if instance penalty passed
|
||||
final long time = rs.getLong("time");
|
||||
if (time > System.currentTimeMillis())
|
||||
if (time > Chronos.currentTimeMillis())
|
||||
{
|
||||
// Load params
|
||||
final int charId = rs.getInt("charId");
|
||||
@@ -556,7 +557,7 @@ public class InstanceManager implements IXmlReader
|
||||
final List<Integer> invalidPenalty = new ArrayList<>(instanceTimes.size());
|
||||
for (Entry<Integer, Long> entry : instanceTimes.entrySet())
|
||||
{
|
||||
if (entry.getValue() <= System.currentTimeMillis())
|
||||
if (entry.getValue() <= Chronos.currentTimeMillis())
|
||||
{
|
||||
invalidPenalty.add(entry.getKey());
|
||||
}
|
||||
@@ -615,7 +616,7 @@ public class InstanceManager implements IXmlReader
|
||||
|
||||
// If reenter time is higher then current, delete it
|
||||
final long time = playerData.get(id);
|
||||
if (time <= System.currentTimeMillis())
|
||||
if (time <= Chronos.currentTimeMillis())
|
||||
{
|
||||
deleteInstanceTime(player, id);
|
||||
return -1;
|
||||
|
@@ -29,6 +29,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.ItemsAutoDestroy;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
@@ -83,7 +84,7 @@ public class ItemsOnGroundManager implements Runnable
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(str))
|
||||
{
|
||||
ps.setLong(1, System.currentTimeMillis());
|
||||
ps.setLong(1, Chronos.currentTimeMillis());
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@@ -29,6 +29,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.Mentee;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -145,7 +146,7 @@ public class MentorManager
|
||||
{
|
||||
final PlayerInstance player = World.getInstance().getPlayer(mentorId);
|
||||
final PlayerVariables vars = player != null ? player.getVariables() : new PlayerVariables(mentorId);
|
||||
vars.set("Mentor-Penalty-" + mentorId, String.valueOf(System.currentTimeMillis() + penalty));
|
||||
vars.set("Mentor-Penalty-" + mentorId, String.valueOf(Chronos.currentTimeMillis() + penalty));
|
||||
}
|
||||
|
||||
public long getMentorPenalty(int mentorId)
|
||||
|
@@ -29,6 +29,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.Containers;
|
||||
@@ -79,7 +80,7 @@ public class PremiumManager
|
||||
final PlayerInstance player = event.getPlayer();
|
||||
final String accountName = player.getAccountName();
|
||||
loadPremiumData(accountName);
|
||||
final long now = System.currentTimeMillis();
|
||||
final long now = Chronos.currentTimeMillis();
|
||||
final long premiumExpiration = getPremiumExpiration(accountName);
|
||||
player.setPremiumStatus(premiumExpiration > now);
|
||||
if (player.hasPremiumStatus())
|
||||
@@ -153,7 +154,7 @@ public class PremiumManager
|
||||
public void addPremiumTime(String accountName, int timeValue, TimeUnit timeUnit)
|
||||
{
|
||||
final long addTime = timeUnit.toMillis(timeValue);
|
||||
final long now = System.currentTimeMillis();
|
||||
final long now = Chronos.currentTimeMillis();
|
||||
// new premium task at least from now
|
||||
final long oldPremiumExpiration = Math.max(now, getPremiumExpiration(accountName));
|
||||
final long newPremiumExpiration = oldPremiumExpiration + addTime;
|
||||
|
@@ -25,6 +25,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.holders.PunishmentHolder;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||
@@ -71,7 +72,7 @@ public class PunishmentManager
|
||||
final String punishedBy = rset.getString("punishedBy");
|
||||
if ((type != null) && (affect != null))
|
||||
{
|
||||
if ((expirationTime > 0) && (System.currentTimeMillis() > expirationTime)) // expired task.
|
||||
if ((expirationTime > 0) && (Chronos.currentTimeMillis() > expirationTime)) // expired task.
|
||||
{
|
||||
expired++;
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.SpawnTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@@ -424,7 +425,7 @@ public class BlockChecker
|
||||
// Start up player parameters
|
||||
setUpPlayers();
|
||||
// Set the started time
|
||||
_startedTime = System.currentTimeMillis() + 300000;
|
||||
_startedTime = Chronos.currentTimeMillis() + 300000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,7 +525,7 @@ public class BlockChecker
|
||||
_redPoints += _numOfBoxes / 2;
|
||||
_bluePoints += _numOfBoxes / 2;
|
||||
|
||||
final int timeLeft = (int) ((_startedTime - System.currentTimeMillis()) / 1000);
|
||||
final int timeLeft = (int) ((_startedTime - Chronos.currentTimeMillis()) / 1000);
|
||||
final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, getBluePoints(), getRedPoints());
|
||||
_holder.broadCastPacketToTeam(changePoints);
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
|
||||
@@ -237,7 +238,7 @@ public class CursedWeapon implements INamable
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (System.currentTimeMillis() >= _endTime)
|
||||
if (Chronos.currentTimeMillis() >= _endTime)
|
||||
{
|
||||
endOfLife();
|
||||
}
|
||||
@@ -366,7 +367,7 @@ public class CursedWeapon implements INamable
|
||||
public void reActivate()
|
||||
{
|
||||
_isActivated = true;
|
||||
if ((_endTime - System.currentTimeMillis()) <= 0)
|
||||
if ((_endTime - Chronos.currentTimeMillis()) <= 0)
|
||||
{
|
||||
endOfLife();
|
||||
}
|
||||
@@ -384,7 +385,7 @@ public class CursedWeapon implements INamable
|
||||
dropIt(attackable, player);
|
||||
|
||||
// Start the Life Task
|
||||
_endTime = System.currentTimeMillis() + (_duration * 60000);
|
||||
_endTime = Chronos.currentTimeMillis() + (_duration * 60000);
|
||||
_removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000, _durationLost * 12000);
|
||||
return true;
|
||||
}
|
||||
@@ -678,7 +679,7 @@ public class CursedWeapon implements INamable
|
||||
|
||||
public long getTimeLeft()
|
||||
{
|
||||
return _endTime - System.currentTimeMillis();
|
||||
return _endTime - Chronos.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void goTo(PlayerInstance player)
|
||||
|
@@ -20,6 +20,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
import org.l2jmobius.gameserver.model.buylist.Product;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
@@ -151,14 +152,14 @@ public class ItemInfo
|
||||
_soulCrystalOptions = item.getSpecialAbilities();
|
||||
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
|
||||
_visualId = item.getVisualId();
|
||||
_visualExpiration = item.getVisualLifeTime() > 0 ? (item.getVisualLifeTime() - System.currentTimeMillis()) / 1000 : 0;
|
||||
_visualExpiration = item.getVisualLifeTime() > 0 ? (item.getVisualLifeTime() - Chronos.currentTimeMillis()) / 1000 : 0;
|
||||
}
|
||||
|
||||
public ItemInfo(ItemInstance item, int change)
|
||||
{
|
||||
this(item);
|
||||
_change = change;
|
||||
_visualExpiration = item.getVisualLifeTime() > 0 ? (item.getVisualLifeTime() - System.currentTimeMillis()) / 1000 : 0;
|
||||
_visualExpiration = item.getVisualLifeTime() > 0 ? (item.getVisualLifeTime() - Chronos.currentTimeMillis()) / 1000 : 0;
|
||||
}
|
||||
|
||||
public ItemInfo(TradeItem item)
|
||||
|
@@ -21,6 +21,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
import org.l2jmobius.gameserver.enums.MailType;
|
||||
@@ -104,7 +105,7 @@ public class Message
|
||||
_receiverId = receiverId;
|
||||
_subject = subject;
|
||||
_content = text;
|
||||
_expiration = (isCod ? System.currentTimeMillis() + (COD_EXPIRATION * 3600000) : System.currentTimeMillis() + (EXPIRATION * 3600000));
|
||||
_expiration = (isCod ? Chronos.currentTimeMillis() + (COD_EXPIRATION * 3600000) : Chronos.currentTimeMillis() + (EXPIRATION * 3600000));
|
||||
_hasAttachments = false;
|
||||
_unread = true;
|
||||
_deletedBySender = false;
|
||||
@@ -123,7 +124,7 @@ public class Message
|
||||
_receiverId = receiverId;
|
||||
_subject = subject;
|
||||
_content = content;
|
||||
_expiration = System.currentTimeMillis() + (EXPIRATION * 3600000);
|
||||
_expiration = Chronos.currentTimeMillis() + (EXPIRATION * 3600000);
|
||||
_reqAdena = 0;
|
||||
_hasAttachments = false;
|
||||
_unread = true;
|
||||
@@ -143,7 +144,7 @@ public class Message
|
||||
_receiverId = receiverId;
|
||||
_subject = subject;
|
||||
_content = content;
|
||||
_expiration = System.currentTimeMillis() + (EXPIRATION * 3600000);
|
||||
_expiration = Chronos.currentTimeMillis() + (EXPIRATION * 3600000);
|
||||
_hasAttachments = false;
|
||||
_unread = true;
|
||||
_deletedBySender = true;
|
||||
@@ -162,7 +163,7 @@ public class Message
|
||||
_receiverId = msg.getSenderId();
|
||||
_subject = "";
|
||||
_content = "";
|
||||
_expiration = System.currentTimeMillis() + (EXPIRATION * 3600000);
|
||||
_expiration = Chronos.currentTimeMillis() + (EXPIRATION * 3600000);
|
||||
_unread = true;
|
||||
_deletedBySender = true;
|
||||
_deletedByReceiver = false;
|
||||
@@ -182,7 +183,7 @@ public class Message
|
||||
_receiverId = receiverId;
|
||||
_subject = "";
|
||||
_content = item.getName();
|
||||
_expiration = System.currentTimeMillis() + (EXPIRATION * 3600000);
|
||||
_expiration = Chronos.currentTimeMillis() + (EXPIRATION * 3600000);
|
||||
_unread = true;
|
||||
_deletedBySender = true;
|
||||
_messageType = mailType;
|
||||
|
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.PetitionState;
|
||||
import org.l2jmobius.gameserver.enums.PetitionType;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
@@ -36,7 +37,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
*/
|
||||
public class Petition
|
||||
{
|
||||
private final long _submitTime = System.currentTimeMillis();
|
||||
private final long _submitTime = Chronos.currentTimeMillis();
|
||||
private final int _id;
|
||||
private final PetitionType _type;
|
||||
private PetitionState _state = PetitionState.PENDING;
|
||||
|
@@ -24,6 +24,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
@@ -258,7 +259,7 @@ public class Spawn extends Location implements IIdentifiable, INamable
|
||||
_scheduledCount++;
|
||||
|
||||
// Schedule the next respawn.
|
||||
RespawnTaskManager.getInstance().add(oldNpc, System.currentTimeMillis() + (hasRespawnRandom() ? Rnd.get(_respawnMinDelay, _respawnMaxDelay) : _respawnMinDelay));
|
||||
RespawnTaskManager.getInstance().add(oldNpc, Chronos.currentTimeMillis() + (hasRespawnRandom() ? Rnd.get(_respawnMinDelay, _respawnMaxDelay) : _respawnMinDelay));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
|
||||
@@ -52,7 +53,7 @@ public class TimeStamp
|
||||
_id2 = skill.getLevel();
|
||||
_id3 = skill.getSubLevel();
|
||||
_reuse = reuse;
|
||||
_stamp = systime > 0 ? systime : reuse != 0 ? System.currentTimeMillis() + reuse : 0;
|
||||
_stamp = systime > 0 ? systime : reuse != 0 ? Chronos.currentTimeMillis() + reuse : 0;
|
||||
_group = -1;
|
||||
}
|
||||
|
||||
@@ -68,7 +69,7 @@ public class TimeStamp
|
||||
_id2 = item.getObjectId();
|
||||
_id3 = 0;
|
||||
_reuse = reuse;
|
||||
_stamp = systime > 0 ? systime : reuse != 0 ? System.currentTimeMillis() + reuse : 0;
|
||||
_stamp = systime > 0 ? systime : reuse != 0 ? Chronos.currentTimeMillis() + reuse : 0;
|
||||
_group = item.getSharedReuseGroup();
|
||||
}
|
||||
|
||||
@@ -155,7 +156,7 @@ public class TimeStamp
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
final long remainingTime = Math.max(_stamp - System.currentTimeMillis(), 0);
|
||||
final long remainingTime = Math.max(_stamp - Chronos.currentTimeMillis(), 0);
|
||||
if (remainingTime == 0)
|
||||
{
|
||||
_stamp = 0;
|
||||
@@ -173,7 +174,7 @@ public class TimeStamp
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final boolean hasNotPassed = System.currentTimeMillis() < _stamp;
|
||||
final boolean hasNotPassed = Chronos.currentTimeMillis() < _stamp;
|
||||
if (!hasNotPassed)
|
||||
{
|
||||
_stamp = 0;
|
||||
|
@@ -28,6 +28,7 @@ import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.AttackableAI;
|
||||
import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
@@ -218,7 +219,7 @@ public class Attackable extends Npc
|
||||
if (_firstCommandChannelAttacked != null)
|
||||
{
|
||||
_commandChannelTimer = new CommandChannelTimer(this);
|
||||
_commandChannelLastAttack = System.currentTimeMillis();
|
||||
_commandChannelLastAttack = Chronos.currentTimeMillis();
|
||||
ThreadPool.schedule(_commandChannelTimer, 10000); // check for last attack
|
||||
_firstCommandChannelAttacked.broadcastPacket(new CreatureSay(null, ChatType.PARTYROOM_ALL, "", "You have looting rights!")); // TODO: retail msg
|
||||
}
|
||||
@@ -227,7 +228,7 @@ public class Attackable extends Npc
|
||||
}
|
||||
else if (attacker.getParty().getCommandChannel().equals(_firstCommandChannelAttacked)) // is in same channel
|
||||
{
|
||||
_commandChannelLastAttack = System.currentTimeMillis(); // update last attack time
|
||||
_commandChannelLastAttack = Chronos.currentTimeMillis(); // update last attack time
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -41,6 +41,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.EmptyQueue;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
@@ -1394,7 +1395,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
{
|
||||
if ((group > 0) && !_reuseTimeStampsItems.isEmpty())
|
||||
{
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
for (TimeStamp ts : _reuseTimeStampsItems.values())
|
||||
{
|
||||
if (ts.getSharedReuseGroup() == group)
|
||||
@@ -1524,7 +1525,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
{
|
||||
return;
|
||||
}
|
||||
_disabledSkills.put(skill.getReuseHashCode(), delay > 0 ? System.currentTimeMillis() + delay : Long.MAX_VALUE);
|
||||
_disabledSkills.put(skill.getReuseHashCode(), delay > 0 ? Chronos.currentTimeMillis() + delay : Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1572,7 +1573,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (stamp < System.currentTimeMillis())
|
||||
if (stamp < Chronos.currentTimeMillis())
|
||||
{
|
||||
_disabledSkills.remove(hashCode);
|
||||
return false;
|
||||
|
@@ -22,6 +22,7 @@ import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ItemsAutoDestroy;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
@@ -204,7 +205,7 @@ public class Npc extends Creature
|
||||
public void onRandomAnimation(int animationId)
|
||||
{
|
||||
// Send a packet SocialAction to all PlayerInstance in the _KnownPlayers of the NpcInstance
|
||||
final long now = System.currentTimeMillis();
|
||||
final long now = Chronos.currentTimeMillis();
|
||||
if ((now - _lastSocialBroadcast) > MINIMUM_SOCIAL_INTERVAL)
|
||||
{
|
||||
_lastSocialBroadcast = now;
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.games.BlockChecker;
|
||||
@@ -141,7 +142,7 @@ public class BlockInstance extends MonsterInstance
|
||||
{
|
||||
eng.increasePlayerPoints(player, team);
|
||||
|
||||
final int timeLeft = (int) ((eng.getStarterTime() - System.currentTimeMillis()) / 1000);
|
||||
final int timeLeft = (int) ((eng.getStarterTime() - Chronos.currentTimeMillis()) / 1000);
|
||||
final boolean isRed = eng.getHolder().getRedPlayers().contains(player);
|
||||
final ExCubeGameChangePoints changePoints = new ExCubeGameChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints());
|
||||
final ExCubeGameExtendedChangePoints secretPoints = new ExCubeGameExtendedChangePoints(timeLeft, eng.getBluePoints(), eng.getRedPoints(), isRed, player, eng.getPlayerPoints(player, isRed));
|
||||
|
@@ -46,6 +46,7 @@ import java.util.stream.Collectors;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
@@ -2799,7 +2800,7 @@ public class PlayerInstance extends Playable
|
||||
public void setOnlineTime(long time)
|
||||
{
|
||||
_onlineTime = time;
|
||||
_onlineBeginTime = System.currentTimeMillis();
|
||||
_onlineBeginTime = Chronos.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3844,22 +3845,22 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public boolean isSpawnProtected()
|
||||
{
|
||||
return (_spawnProtectEndTime != 0) && (_spawnProtectEndTime > System.currentTimeMillis());
|
||||
return (_spawnProtectEndTime != 0) && (_spawnProtectEndTime > Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
public boolean isTeleportProtected()
|
||||
{
|
||||
return (_teleportProtectEndTime != 0) && (_teleportProtectEndTime > System.currentTimeMillis());
|
||||
return (_teleportProtectEndTime != 0) && (_teleportProtectEndTime > Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void setSpawnProtection(boolean protect)
|
||||
{
|
||||
_spawnProtectEndTime = protect ? System.currentTimeMillis() + (Config.PLAYER_SPAWN_PROTECTION * 1000) : 0;
|
||||
_spawnProtectEndTime = protect ? Chronos.currentTimeMillis() + (Config.PLAYER_SPAWN_PROTECTION * 1000) : 0;
|
||||
}
|
||||
|
||||
public void setTeleportProtection(boolean protect)
|
||||
{
|
||||
_teleportProtectEndTime = protect ? System.currentTimeMillis() + (Config.PLAYER_TELEPORT_PROTECTION * 1000) : 0;
|
||||
_teleportProtectEndTime = protect ? Chronos.currentTimeMillis() + (Config.PLAYER_TELEPORT_PROTECTION * 1000) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5183,7 +5184,7 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
return;
|
||||
}
|
||||
setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_NORMAL_TIME);
|
||||
setPvpFlagLasts(Chronos.currentTimeMillis() + Config.PVP_NORMAL_TIME);
|
||||
if (_pvpFlag == 0)
|
||||
{
|
||||
startPvPFlag();
|
||||
@@ -5216,11 +5217,11 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
if (checkIfPvP(targetPlayer))
|
||||
{
|
||||
setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_PVP_TIME);
|
||||
setPvpFlagLasts(Chronos.currentTimeMillis() + Config.PVP_PVP_TIME);
|
||||
}
|
||||
else
|
||||
{
|
||||
setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_NORMAL_TIME);
|
||||
setPvpFlagLasts(Chronos.currentTimeMillis() + Config.PVP_NORMAL_TIME);
|
||||
}
|
||||
if (_pvpFlag == 0)
|
||||
{
|
||||
@@ -6099,7 +6100,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public long getUptime()
|
||||
{
|
||||
return System.currentTimeMillis() - _uptime;
|
||||
return Chronos.currentTimeMillis() - _uptime;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6343,7 +6344,7 @@ public class PlayerInstance extends Playable
|
||||
PreparedStatement statement = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?"))
|
||||
{
|
||||
statement.setInt(1, isOnlineInt());
|
||||
statement.setLong(2, System.currentTimeMillis());
|
||||
statement.setLong(2, Chronos.currentTimeMillis());
|
||||
statement.setInt(3, getObjectId());
|
||||
statement.execute();
|
||||
}
|
||||
@@ -6468,12 +6469,12 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
|
||||
if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
|
||||
if (player.getClanJoinExpiryTime() < Chronos.currentTimeMillis())
|
||||
{
|
||||
player.setClanJoinExpiryTime(0);
|
||||
}
|
||||
player.setClanCreateExpiryTime(rset.getLong("clan_create_expiry_time"));
|
||||
if (player.getClanCreateExpiryTime() < System.currentTimeMillis())
|
||||
if (player.getClanCreateExpiryTime() < Chronos.currentTimeMillis())
|
||||
{
|
||||
player.setClanCreateExpiryTime(0);
|
||||
}
|
||||
@@ -6535,7 +6536,7 @@ public class PlayerInstance extends Playable
|
||||
player.getAppearance().setTitleColor(titleColor);
|
||||
}
|
||||
player.setFistsWeaponItem(player.findFistsWeaponItem(activeClassId));
|
||||
player.setUptime(System.currentTimeMillis());
|
||||
player.setUptime(Chronos.currentTimeMillis());
|
||||
|
||||
currentHp = rset.getDouble("curHp");
|
||||
currentCp = rset.getDouble("curCp");
|
||||
@@ -7068,7 +7069,7 @@ public class PlayerInstance extends Playable
|
||||
long totalOnlineTime = _onlineTime;
|
||||
if (_onlineBeginTime > 0)
|
||||
{
|
||||
totalOnlineTime += (System.currentTimeMillis() - _onlineBeginTime) / 1000;
|
||||
totalOnlineTime += (Chronos.currentTimeMillis() - _onlineBeginTime) / 1000;
|
||||
}
|
||||
|
||||
statement.setLong(34, totalOnlineTime);
|
||||
@@ -7154,7 +7155,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
int buffIndex = 0;
|
||||
final List<Long> storedSkills = new ArrayList<>();
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
|
||||
// Store all effect data along with calulated remaining
|
||||
// reuse delays for matching skills. 'restore_type'= 0.
|
||||
@@ -7269,7 +7270,7 @@ public class PlayerInstance extends Playable
|
||||
ps1.setInt(1, getObjectId());
|
||||
ps1.execute();
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
for (TimeStamp ts : getItemReuseTimeStamps().values())
|
||||
{
|
||||
if ((ts != null) && (currentTime < ts.getStamp()))
|
||||
@@ -7549,7 +7550,7 @@ public class PlayerInstance extends Playable
|
||||
statement.setInt(2, _classIndex);
|
||||
try (ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
while (rset.next())
|
||||
{
|
||||
final int remainingTime = rset.getInt("remaining_time");
|
||||
@@ -7611,7 +7612,7 @@ public class PlayerInstance extends Playable
|
||||
long systime;
|
||||
boolean isInInventory;
|
||||
long remainingTime;
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
while (rset.next())
|
||||
{
|
||||
itemId = rset.getInt("itemId");
|
||||
@@ -7686,7 +7687,7 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
int slot;
|
||||
int symbolId;
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
while (rset.next())
|
||||
{
|
||||
slot = rset.getInt("slot");
|
||||
@@ -7809,7 +7810,7 @@ public class PlayerInstance extends Playable
|
||||
// Send Server->Client UserInfo packet to this PlayerInstance
|
||||
broadcastUserInfo(UserInfoType.BASE_STATS, UserInfoType.MAX_HPCPMP, UserInfoType.STATS, UserInfoType.SPEED);
|
||||
|
||||
final long remainingTime = getVariables().getLong("HennaDuration" + slot, 0) - System.currentTimeMillis();
|
||||
final long remainingTime = getVariables().getLong("HennaDuration" + slot, 0) - Chronos.currentTimeMillis();
|
||||
if ((henna.getDuration() < 0) || (remainingTime > 0))
|
||||
{
|
||||
// Add the recovered dyes to the player's inventory and notify them.
|
||||
@@ -7883,8 +7884,8 @@ public class PlayerInstance extends Playable
|
||||
// Task for henna duration
|
||||
if (henna.getDuration() > 0)
|
||||
{
|
||||
getVariables().set("HennaDuration" + i, System.currentTimeMillis() + (henna.getDuration() * 60000));
|
||||
_hennaRemoveSchedules.put(i, ThreadPool.schedule(new HennaDurationTask(this, i), System.currentTimeMillis() + (henna.getDuration() * 60000)));
|
||||
getVariables().set("HennaDuration" + i, Chronos.currentTimeMillis() + (henna.getDuration() * 60000));
|
||||
_hennaRemoveSchedules.put(i, ThreadPool.schedule(new HennaDurationTask(this, i), Chronos.currentTimeMillis() + (henna.getDuration() * 60000)));
|
||||
}
|
||||
|
||||
// Reward henna skills
|
||||
@@ -12255,7 +12256,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public int getBirthdays()
|
||||
{
|
||||
long time = (System.currentTimeMillis() - _createDate.getTimeInMillis()) / 1000;
|
||||
long time = (Chronos.currentTimeMillis() - _createDate.getTimeInMillis()) / 1000;
|
||||
time /= TimeUnit.DAYS.toMillis(365);
|
||||
return (int) time;
|
||||
}
|
||||
@@ -12496,7 +12497,7 @@ public class PlayerInstance extends Playable
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((_fallingTimestamp != 0) && (System.currentTimeMillis() < _fallingTimestamp))
|
||||
if ((_fallingTimestamp != 0) && (Chronos.currentTimeMillis() < _fallingTimestamp))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -12556,7 +12557,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void setFalling()
|
||||
{
|
||||
_fallingTimestamp = System.currentTimeMillis() + FALLING_VALIDATION_DELAY;
|
||||
_fallingTimestamp = Chronos.currentTimeMillis() + FALLING_VALIDATION_DELAY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12577,7 +12578,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void updateLastItemAuctionRequest()
|
||||
{
|
||||
_lastItemAuctionInfoRequest = System.currentTimeMillis();
|
||||
_lastItemAuctionInfoRequest = Chronos.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -12586,7 +12587,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean isItemAuctionPolling()
|
||||
{
|
||||
return (System.currentTimeMillis() - _lastItemAuctionInfoRequest) < 2000;
|
||||
return (Chronos.currentTimeMillis() - _lastItemAuctionInfoRequest) < 2000;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -12970,7 +12971,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void updateNotMoveUntil()
|
||||
{
|
||||
_notMoveUntil = System.currentTimeMillis() + Config.PLAYER_MOVEMENT_BLOCK_TIME;
|
||||
_notMoveUntil = Chronos.currentTimeMillis() + Config.PLAYER_MOVEMENT_BLOCK_TIME;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -13955,7 +13956,7 @@ public class PlayerInstance extends Playable
|
||||
public boolean isInTraingCamp()
|
||||
{
|
||||
final TrainingHolder trainingHolder = getTraingCampInfo();
|
||||
return (trainingHolder != null) && (trainingHolder.getEndTime() > System.currentTimeMillis());
|
||||
return (trainingHolder != null) && (trainingHolder.getEndTime() > Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
public AttendanceInfoHolder getAttendanceInfo()
|
||||
|
@@ -27,6 +27,7 @@ import java.util.regex.PatternSyntaxException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.data.xml.CategoryData;
|
||||
import org.l2jmobius.gameserver.data.xml.ClassListData;
|
||||
@@ -1042,13 +1043,13 @@ public class VillageMasterInstance extends NpcInstance
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_DISSOLVE_A_CLAN_DURING_A_SIEGE_OR_WHILE_PROTECTING_A_CASTLE);
|
||||
return;
|
||||
}
|
||||
if (clan.getDissolvingExpiryTime() > System.currentTimeMillis())
|
||||
if (clan.getDissolvingExpiryTime() > Chronos.currentTimeMillis())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_ALREADY_REQUESTED_THE_DISSOLUTION_OF_YOUR_CLAN);
|
||||
return;
|
||||
}
|
||||
|
||||
clan.setDissolvingExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_DISSOLVE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
|
||||
clan.setDissolvingExpiryTime(Chronos.currentTimeMillis() + (Config.ALT_CLAN_DISSOLVE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
|
||||
clan.updateClanInDB();
|
||||
|
||||
// The clan leader should take the XP penalty of a full death.
|
||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.model.actor.tasks.attackable;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
|
||||
/**
|
||||
@@ -40,7 +41,7 @@ public class CommandChannelTimer implements Runnable
|
||||
return;
|
||||
}
|
||||
|
||||
if ((System.currentTimeMillis() - _attackable.getCommandChannelLastAttack()) > Config.LOOT_RAIDS_PRIVILEGE_INTERVAL)
|
||||
if ((Chronos.currentTimeMillis() - _attackable.getCommandChannelLastAttack()) > Config.LOOT_RAIDS_PRIVILEGE_INTERVAL)
|
||||
{
|
||||
_attackable.setCommandChannelTimer(null);
|
||||
_attackable.setFirstCommandChannelAttacked(null);
|
||||
|
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.actor.tasks.player;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
|
||||
import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -92,12 +93,12 @@ public class IllegalPlayerActionTask implements Runnable
|
||||
}
|
||||
case KICKBAN:
|
||||
{
|
||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(_actor.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, System.currentTimeMillis() + (Config.DEFAULT_PUNISH_PARAM * 1000), _message, getClass().getSimpleName()));
|
||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(_actor.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN, Chronos.currentTimeMillis() + (Config.DEFAULT_PUNISH_PARAM * 1000), _message, getClass().getSimpleName()));
|
||||
break;
|
||||
}
|
||||
case JAIL:
|
||||
{
|
||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(_actor.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + (Config.DEFAULT_PUNISH_PARAM * 1000), _message, getClass().getSimpleName()));
|
||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(_actor.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.JAIL, Chronos.currentTimeMillis() + (Config.DEFAULT_PUNISH_PARAM * 1000), _message, getClass().getSimpleName()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
import org.l2jmobius.gameserver.taskmanager.BuyListTaskManager;
|
||||
@@ -134,7 +135,7 @@ public class Product
|
||||
|
||||
public void restartRestockTask(long nextRestockTime)
|
||||
{
|
||||
final long remainTime = nextRestockTime - System.currentTimeMillis();
|
||||
final long remainTime = nextRestockTime - Chronos.currentTimeMillis();
|
||||
if (remainTime > 0)
|
||||
{
|
||||
BuyListTaskManager.getInstance().update(this, remainTime);
|
||||
|
@@ -27,6 +27,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.CeremonyOfChaosResult;
|
||||
import org.l2jmobius.gameserver.instancemanager.CeremonyOfChaosManager;
|
||||
@@ -274,7 +275,7 @@ public class CeremonyOfChaosEvent extends AbstractEvent<CeremonyOfChaosMember>
|
||||
});
|
||||
}
|
||||
}
|
||||
_battleStartTime = System.currentTimeMillis();
|
||||
_battleStartTime = Chronos.currentTimeMillis();
|
||||
getTimers().addRepeatingTimer("update", 1000, null, null);
|
||||
}
|
||||
|
||||
@@ -471,7 +472,7 @@ public class CeremonyOfChaosEvent extends AbstractEvent<CeremonyOfChaosMember>
|
||||
|
||||
private void updateLifeTime(CeremonyOfChaosMember member)
|
||||
{
|
||||
member.setLifeTime(((int) (System.currentTimeMillis() - _battleStartTime) / 1000));
|
||||
member.setLifeTime(((int) (Chronos.currentTimeMillis() - _battleStartTime) / 1000));
|
||||
}
|
||||
|
||||
public List<CeremonyOfChaosMember> getWinners()
|
||||
|
@@ -34,6 +34,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.communitybbs.BB.Forum;
|
||||
import org.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
@@ -498,7 +499,7 @@ public class Clan implements IIdentifiable, INamable
|
||||
if (player.isClanLeader())
|
||||
{
|
||||
SiegeManager.getInstance().removeSiegeSkills(player);
|
||||
player.setClanCreateExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
|
||||
player.setClanCreateExpiryTime(Chronos.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
|
||||
}
|
||||
|
||||
// remove Clan skills from Player
|
||||
@@ -531,7 +532,7 @@ public class Clan implements IIdentifiable, INamable
|
||||
}
|
||||
else
|
||||
{
|
||||
removeMemberInDatabase(exMember, clanJoinExpiryTime, getLeaderId() == objectId ? System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000) : 0);
|
||||
removeMemberInDatabase(exMember, clanJoinExpiryTime, getLeaderId() == objectId ? Chronos.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000) : 0);
|
||||
}
|
||||
|
||||
// Notify to scripts
|
||||
@@ -1091,12 +1092,12 @@ public class Clan implements IIdentifiable, INamable
|
||||
setAllyId(clanData.getInt("ally_id"));
|
||||
setAllyName(clanData.getString("ally_name"));
|
||||
setAllyPenaltyExpiryTime(clanData.getLong("ally_penalty_expiry_time"), clanData.getInt("ally_penalty_type"));
|
||||
if (_allyPenaltyExpiryTime < System.currentTimeMillis())
|
||||
if (_allyPenaltyExpiryTime < Chronos.currentTimeMillis())
|
||||
{
|
||||
setAllyPenaltyExpiryTime(0, 0);
|
||||
}
|
||||
setCharPenaltyExpiryTime(clanData.getLong("char_penalty_expiry_time"));
|
||||
if ((_charPenaltyExpiryTime + (Config.ALT_CLAN_JOIN_DAYS * 86400000)) < System.currentTimeMillis()) // 24*60*60*1000 = 86400000
|
||||
if ((_charPenaltyExpiryTime + (Config.ALT_CLAN_JOIN_DAYS * 86400000)) < Chronos.currentTimeMillis()) // 24*60*60*1000 = 86400000
|
||||
{
|
||||
setCharPenaltyExpiryTime(0);
|
||||
}
|
||||
@@ -2185,7 +2186,7 @@ public class Clan implements IIdentifiable, INamable
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_ASK_YOURSELF_TO_APPLY_TO_A_CLAN);
|
||||
return false;
|
||||
}
|
||||
if (_charPenaltyExpiryTime > System.currentTimeMillis())
|
||||
if (_charPenaltyExpiryTime > Chronos.currentTimeMillis())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.AFTER_A_CLAN_MEMBER_IS_DISMISSED_FROM_A_CLAN_THE_CLAN_MUST_WAIT_AT_LEAST_A_DAY_BEFORE_ACCEPTING_A_NEW_MEMBER);
|
||||
return false;
|
||||
@@ -2197,7 +2198,7 @@ public class Clan implements IIdentifiable, INamable
|
||||
player.sendPacket(sm);
|
||||
return false;
|
||||
}
|
||||
if (target.getClanJoinExpiryTime() > System.currentTimeMillis())
|
||||
if (target.getClanJoinExpiryTime() > Chronos.currentTimeMillis())
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_CANNOT_JOIN_THE_CLAN_BECAUSE_ONE_DAY_HAS_NOT_YET_PASSED_SINCE_THEY_LEFT_ANOTHER_CLAN);
|
||||
sm.addString(target.getName());
|
||||
@@ -2246,7 +2247,7 @@ public class Clan implements IIdentifiable, INamable
|
||||
return false;
|
||||
}
|
||||
final Clan leaderClan = player.getClan();
|
||||
if ((leaderClan.getAllyPenaltyExpiryTime() > System.currentTimeMillis()) && (leaderClan.getAllyPenaltyType() == PENALTY_TYPE_DISMISS_CLAN))
|
||||
if ((leaderClan.getAllyPenaltyExpiryTime() > Chronos.currentTimeMillis()) && (leaderClan.getAllyPenaltyType() == PENALTY_TYPE_DISMISS_CLAN))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_MAY_NOT_ACCEPT_ANY_CLAN_WITHIN_A_DAY_AFTER_EXPELLING_ANOTHER_CLAN);
|
||||
return false;
|
||||
@@ -2282,7 +2283,7 @@ public class Clan implements IIdentifiable, INamable
|
||||
player.sendPacket(sm);
|
||||
return false;
|
||||
}
|
||||
if (targetClan.getAllyPenaltyExpiryTime() > System.currentTimeMillis())
|
||||
if (targetClan.getAllyPenaltyExpiryTime() > Chronos.currentTimeMillis())
|
||||
{
|
||||
if (targetClan.getAllyPenaltyType() == PENALTY_TYPE_CLAN_LEAVED)
|
||||
{
|
||||
@@ -2376,12 +2377,12 @@ public class Clan implements IIdentifiable, INamable
|
||||
player.sendPacket(SystemMessageId.TO_CREATE_AN_ALLIANCE_YOUR_CLAN_MUST_BE_LEVEL_5_OR_HIGHER);
|
||||
return;
|
||||
}
|
||||
if ((_allyPenaltyExpiryTime > System.currentTimeMillis()) && (_allyPenaltyType == PENALTY_TYPE_DISSOLVE_ALLY))
|
||||
if ((_allyPenaltyExpiryTime > Chronos.currentTimeMillis()) && (_allyPenaltyType == PENALTY_TYPE_DISSOLVE_ALLY))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_CREATE_A_NEW_ALLIANCE_WITHIN_1_DAY_OF_DISSOLUTION);
|
||||
return;
|
||||
}
|
||||
if (_dissolvingExpiryTime > System.currentTimeMillis())
|
||||
if (_dissolvingExpiryTime > Chronos.currentTimeMillis())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.AS_YOU_ARE_CURRENTLY_SCHEDULE_FOR_CLAN_DISSOLUTION_NO_ALLIANCE_CAN_BE_CREATED);
|
||||
return;
|
||||
@@ -2433,7 +2434,7 @@ public class Clan implements IIdentifiable, INamable
|
||||
|
||||
broadcastToOnlineAllyMembers(new SystemMessage(SystemMessageId.THE_ALLIANCE_HAS_BEEN_DISSOLVED));
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
for (Clan clan : ClanTable.getInstance().getClanAllies(getAllyId()))
|
||||
{
|
||||
if (clan.getId() != getId())
|
||||
@@ -2459,7 +2460,7 @@ public class Clan implements IIdentifiable, INamable
|
||||
player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
|
||||
return false;
|
||||
}
|
||||
if (System.currentTimeMillis() < _dissolvingExpiryTime)
|
||||
if (Chronos.currentTimeMillis() < _dissolvingExpiryTime)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.AS_YOU_ARE_CURRENTLY_SCHEDULE_FOR_CLAN_DISSOLUTION_YOUR_CLAN_LEVEL_CANNOT_BE_INCREASED);
|
||||
return false;
|
||||
|
@@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.enums.ClanWarState;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -54,9 +55,9 @@ public class ClanWar
|
||||
{
|
||||
_attackerClanId = attacker.getId();
|
||||
_attackedClanId = attacked.getId();
|
||||
_startTime = System.currentTimeMillis();
|
||||
_startTime = Chronos.currentTimeMillis();
|
||||
_state = ClanWarState.BLOOD_DECLARATION;
|
||||
_cancelTask = ThreadPool.schedule(this::clanWarTimeout, (_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) - System.currentTimeMillis());
|
||||
_cancelTask = ThreadPool.schedule(this::clanWarTimeout, (_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) - Chronos.currentTimeMillis());
|
||||
attacker.addWar(attacked.getId(), this);
|
||||
attacked.addWar(attacker.getId(), this);
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnClanWarStart(attacker, attacked));
|
||||
@@ -79,15 +80,15 @@ public class ClanWar
|
||||
_attackerKillCount.set(attackerKillCount);
|
||||
_attackedKillCount.set(attackedKillCount);
|
||||
_winnerClanId = winnerClan;
|
||||
if ((_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) > System.currentTimeMillis())
|
||||
if ((_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) > Chronos.currentTimeMillis())
|
||||
{
|
||||
_cancelTask = ThreadPool.schedule(this::clanWarTimeout, (_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) - System.currentTimeMillis());
|
||||
_cancelTask = ThreadPool.schedule(this::clanWarTimeout, (_startTime + TIME_TO_CANCEL_NON_MUTUAL_CLAN_WAR) - Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
if (_endTime > 0)
|
||||
{
|
||||
final long endTimePeriod = _endTime + (_state == ClanWarState.TIE ? TIME_TO_DELETION_AFTER_CANCELLATION : TIME_TO_DELETION_AFTER_DEFEAT);
|
||||
if (endTimePeriod > System.currentTimeMillis())
|
||||
if (endTimePeriod > Chronos.currentTimeMillis())
|
||||
{
|
||||
ThreadPool.schedule(() -> ClanTable.getInstance().deleteClanWars(_attackerClanId, _attackedClanId), 10000);
|
||||
}
|
||||
@@ -177,8 +178,8 @@ public class ClanWar
|
||||
winnerClan.broadcastToOnlineMembers(sm);
|
||||
|
||||
_winnerClanId = winnerClan.getId();
|
||||
_endTime = System.currentTimeMillis();
|
||||
ThreadPool.schedule(() -> ClanTable.getInstance().deleteClanWars(cancelor.getId(), winnerClan.getId()), (_endTime + TIME_TO_DELETION_AFTER_DEFEAT) - System.currentTimeMillis());
|
||||
_endTime = Chronos.currentTimeMillis();
|
||||
ThreadPool.schedule(() -> ClanTable.getInstance().deleteClanWars(cancelor.getId(), winnerClan.getId()), (_endTime + TIME_TO_DELETION_AFTER_DEFEAT) - Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void clanWarTimeout()
|
||||
@@ -196,8 +197,8 @@ public class ClanWar
|
||||
attackerClan.broadcastToOnlineMembers(sm);
|
||||
|
||||
_state = ClanWarState.TIE;
|
||||
_endTime = System.currentTimeMillis();
|
||||
ThreadPool.schedule(() -> ClanTable.getInstance().deleteClanWars(attackerClan.getId(), attackedClan.getId()), (_endTime + TIME_TO_DELETION_AFTER_CANCELLATION) - System.currentTimeMillis());
|
||||
_endTime = Chronos.currentTimeMillis();
|
||||
ThreadPool.schedule(() -> ClanTable.getInstance().deleteClanWars(attackerClan.getId(), attackedClan.getId()), (_endTime + TIME_TO_DELETION_AFTER_CANCELLATION) - Chronos.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -28,6 +28,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
|
||||
import it.sauronsoftware.cron4j.PastPredictor;
|
||||
@@ -112,7 +113,7 @@ public class EventScheduler
|
||||
|
||||
final Predictor predictor = new Predictor(_pattern);
|
||||
final long nextSchedule = predictor.nextMatchingTime();
|
||||
final long timeSchedule = nextSchedule - System.currentTimeMillis();
|
||||
final long timeSchedule = nextSchedule - Chronos.currentTimeMillis();
|
||||
if (timeSchedule <= (30 * 1000))
|
||||
{
|
||||
LOGGER.warning("Wrong reschedule for " + _eventManager.getClass().getSimpleName() + " end up run in " + (timeSchedule / 1000) + " seconds!");
|
||||
@@ -144,10 +145,10 @@ public class EventScheduler
|
||||
{
|
||||
ps.setString(1, _eventManager.getName());
|
||||
ps.setString(2, _name);
|
||||
ps.setTimestamp(3, new Timestamp(System.currentTimeMillis()));
|
||||
ps.setTimestamp(3, new Timestamp(Chronos.currentTimeMillis()));
|
||||
ps.setString(4, _eventManager.getName());
|
||||
ps.setString(5, _name);
|
||||
ps.setTimestamp(6, new Timestamp(System.currentTimeMillis()));
|
||||
ps.setTimestamp(6, new Timestamp(Chronos.currentTimeMillis()));
|
||||
ps.execute();
|
||||
return true;
|
||||
}
|
||||
|
@@ -78,7 +78,6 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerClanWH
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerCreate;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDelete;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerDlgAnswer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFameChanged;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerFishing;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaAdd;
|
||||
@@ -86,8 +85,10 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerHennaR
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemAdd;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemDestroy;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemDrop;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemEquip;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemTransfer;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLevelChanged;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogout;
|
||||
@@ -116,7 +117,6 @@ import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummon
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerSummonTalk;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTakeHero;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerTransform;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemUnequip;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerUnsummonAgathion;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnTrapAction;
|
||||
import org.l2jmobius.gameserver.model.events.impl.instance.OnInstanceCreated;
|
||||
|
@@ -20,6 +20,7 @@ import java.io.Serializable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
@@ -85,7 +86,7 @@ public class TrainingHolder implements Serializable
|
||||
|
||||
public long getElapsedTime()
|
||||
{
|
||||
return TimeUnit.SECONDS.convert(System.currentTimeMillis() - _startTime, TimeUnit.MILLISECONDS);
|
||||
return TimeUnit.SECONDS.convert(Chronos.currentTimeMillis() - _startTime, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public long getRemainingTime()
|
||||
|
@@ -39,6 +39,7 @@ import java.util.stream.Stream;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||
import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
||||
@@ -105,7 +106,7 @@ public class Instance implements IIdentifiable, INamable
|
||||
// Set basic instance info
|
||||
_id = id;
|
||||
_template = template;
|
||||
_startTime = System.currentTimeMillis();
|
||||
_startTime = Chronos.currentTimeMillis();
|
||||
_spawns = new ArrayList<>(template.getSpawns().size());
|
||||
|
||||
// Clone and add the spawn templates
|
||||
@@ -755,7 +756,7 @@ public class Instance implements IIdentifiable, INamable
|
||||
}
|
||||
|
||||
// Set new cleanup task
|
||||
_endTime = System.currentTimeMillis() + millis;
|
||||
_endTime = Chronos.currentTimeMillis() + millis;
|
||||
if (minutes < 1) // Destroy instance
|
||||
{
|
||||
destroy();
|
||||
@@ -858,7 +859,7 @@ public class Instance implements IIdentifiable, INamable
|
||||
*/
|
||||
public long getElapsedTime()
|
||||
{
|
||||
return System.currentTimeMillis() - _startTime;
|
||||
return Chronos.currentTimeMillis() - _startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -867,7 +868,7 @@ public class Instance implements IIdentifiable, INamable
|
||||
*/
|
||||
public long getRemainingTime()
|
||||
{
|
||||
return (_endTime == -1) ? -1 : (_endTime - System.currentTimeMillis());
|
||||
return (_endTime == -1) ? -1 : (_endTime - Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.enums.GroupType;
|
||||
import org.l2jmobius.gameserver.enums.InstanceReenterType;
|
||||
@@ -547,7 +548,7 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
||||
{
|
||||
if (data.getTime() > 0)
|
||||
{
|
||||
time = System.currentTimeMillis() + data.getTime();
|
||||
time = Chronos.currentTimeMillis() + data.getTime();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -557,7 +558,7 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
|
||||
// If calendar time is lower than current, add one more day
|
||||
if (calendar.getTimeInMillis() <= System.currentTimeMillis())
|
||||
if (calendar.getTimeInMillis() <= Chronos.currentTimeMillis())
|
||||
{
|
||||
calendar.add(Calendar.DAY_OF_MONTH, 1);
|
||||
}
|
||||
@@ -574,7 +575,7 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
||||
|
||||
// Set exact day. If modified date is before current, add one more week.
|
||||
calendar.set(Calendar.DAY_OF_WEEK, day);
|
||||
if (calendar.getTimeInMillis() <= System.currentTimeMillis())
|
||||
if (calendar.getTimeInMillis() <= Chronos.currentTimeMillis())
|
||||
{
|
||||
calendar.add(Calendar.WEEK_OF_MONTH, 1);
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.instancezone.conditions;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -39,6 +40,6 @@ public class ConditionReenter extends Condition
|
||||
protected boolean test(PlayerInstance player, Npc npc)
|
||||
{
|
||||
final int instanceId = getParameters().getInt("instanceId", getInstanceTemplate().getId());
|
||||
return System.currentTimeMillis() > InstanceManager.getInstance().getInstanceTime(player, instanceId);
|
||||
return Chronos.currentTimeMillis() > InstanceManager.getInstance().getInstanceTime(player, instanceId);
|
||||
}
|
||||
}
|
@@ -28,6 +28,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.ItemInfo;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -181,12 +182,12 @@ public class ItemAuction
|
||||
|
||||
public long getStartingTimeRemaining()
|
||||
{
|
||||
return Math.max(_endingTime - System.currentTimeMillis(), 0);
|
||||
return Math.max(_endingTime - Chronos.currentTimeMillis(), 0);
|
||||
}
|
||||
|
||||
public long getFinishingTimeRemaining()
|
||||
{
|
||||
return Math.max(_endingTime - System.currentTimeMillis(), 0);
|
||||
return Math.max(_endingTime - Chronos.currentTimeMillis(), 0);
|
||||
}
|
||||
|
||||
public void storeMe()
|
||||
@@ -339,7 +340,7 @@ public class ItemAuction
|
||||
_highestBid = bid;
|
||||
}
|
||||
|
||||
if ((_endingTime - System.currentTimeMillis()) <= (1000 * 60 * 10)) // 10 minutes
|
||||
if ((_endingTime - Chronos.currentTimeMillis()) <= (1000 * 60 * 10)) // 10 minutes
|
||||
{
|
||||
switch (_auctionEndingExtendState)
|
||||
{
|
||||
@@ -426,7 +427,7 @@ public class ItemAuction
|
||||
}
|
||||
case FINISHED:
|
||||
{
|
||||
if (_startingTime < (System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(Config.ALT_ITEM_AUCTION_EXPIRED_AFTER, TimeUnit.DAYS)))
|
||||
if (_startingTime < (Chronos.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(Config.ALT_ITEM_AUCTION_EXPIRED_AFTER, TimeUnit.DAYS)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -41,6 +41,7 @@ import org.w3c.dom.Node;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
@@ -243,7 +244,7 @@ public class ItemAuctionInstance
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
nextAuction = createAuction(System.currentTimeMillis() + START_TIME_SPACE);
|
||||
nextAuction = createAuction(Chronos.currentTimeMillis() + START_TIME_SPACE);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
@@ -252,10 +253,10 @@ public class ItemAuctionInstance
|
||||
{
|
||||
case CREATED:
|
||||
{
|
||||
if (auctions[0].getStartingTime() < (System.currentTimeMillis() + START_TIME_SPACE))
|
||||
if (auctions[0].getStartingTime() < (Chronos.currentTimeMillis() + START_TIME_SPACE))
|
||||
{
|
||||
currentAuction = auctions[0];
|
||||
nextAuction = createAuction(System.currentTimeMillis() + START_TIME_SPACE);
|
||||
nextAuction = createAuction(Chronos.currentTimeMillis() + START_TIME_SPACE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -266,13 +267,13 @@ public class ItemAuctionInstance
|
||||
case STARTED:
|
||||
{
|
||||
currentAuction = auctions[0];
|
||||
nextAuction = createAuction(Math.max(currentAuction.getEndingTime() + FINISH_TIME_SPACE, System.currentTimeMillis() + START_TIME_SPACE));
|
||||
nextAuction = createAuction(Math.max(currentAuction.getEndingTime() + FINISH_TIME_SPACE, Chronos.currentTimeMillis() + START_TIME_SPACE));
|
||||
break;
|
||||
}
|
||||
case FINISHED:
|
||||
{
|
||||
currentAuction = auctions[0];
|
||||
nextAuction = createAuction(System.currentTimeMillis() + START_TIME_SPACE);
|
||||
nextAuction = createAuction(Chronos.currentTimeMillis() + START_TIME_SPACE);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -287,7 +288,7 @@ public class ItemAuctionInstance
|
||||
{
|
||||
Arrays.sort(auctions, Comparator.comparingLong(ItemAuction::getStartingTime).reversed());
|
||||
// just to make sure we won't skip any auction because of little different times
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
for (ItemAuction auction : auctions)
|
||||
{
|
||||
if (auction.getAuctionState() == ItemAuctionState.STARTED)
|
||||
@@ -311,7 +312,7 @@ public class ItemAuctionInstance
|
||||
}
|
||||
if (nextAuction == null)
|
||||
{
|
||||
nextAuction = createAuction(System.currentTimeMillis() + START_TIME_SPACE);
|
||||
nextAuction = createAuction(Chronos.currentTimeMillis() + START_TIME_SPACE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -326,17 +327,17 @@ public class ItemAuctionInstance
|
||||
{
|
||||
if (currentAuction.getAuctionState() == ItemAuctionState.STARTED)
|
||||
{
|
||||
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getEndingTime() - System.currentTimeMillis(), 0)));
|
||||
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getEndingTime() - Chronos.currentTimeMillis(), 0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getStartingTime() - System.currentTimeMillis(), 0)));
|
||||
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getStartingTime() - Chronos.currentTimeMillis(), 0)));
|
||||
}
|
||||
LOGGER.info(getClass().getSimpleName() + ": Schedule current auction " + currentAuction.getAuctionId() + " for instance " + _instanceId);
|
||||
}
|
||||
else
|
||||
{
|
||||
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(nextAuction), Math.max(nextAuction.getStartingTime() - System.currentTimeMillis(), 0)));
|
||||
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(nextAuction), Math.max(nextAuction.getStartingTime() - Chronos.currentTimeMillis(), 0)));
|
||||
LOGGER.info(getClass().getSimpleName() + ": Schedule next auction " + nextAuction.getAuctionId() + " on " + DATE_FORMAT.format(new Date(nextAuction.getStartingTime())) + " for instance " + _instanceId);
|
||||
}
|
||||
}
|
||||
@@ -422,7 +423,7 @@ public class ItemAuctionInstance
|
||||
if (_auction.getScheduledAuctionEndingExtendState() == ItemAuctionExtendState.INITIAL)
|
||||
{
|
||||
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_5_MIN);
|
||||
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
|
||||
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - Chronos.currentTimeMillis(), 0)));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -432,7 +433,7 @@ public class ItemAuctionInstance
|
||||
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_3_MIN)
|
||||
{
|
||||
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_3_MIN);
|
||||
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
|
||||
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - Chronos.currentTimeMillis(), 0)));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -442,7 +443,7 @@ public class ItemAuctionInstance
|
||||
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B)
|
||||
{
|
||||
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B);
|
||||
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
|
||||
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - Chronos.currentTimeMillis(), 0)));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -452,7 +453,7 @@ public class ItemAuctionInstance
|
||||
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A)
|
||||
{
|
||||
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A);
|
||||
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
|
||||
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - Chronos.currentTimeMillis(), 0)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -577,7 +578,7 @@ public class ItemAuctionInstance
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((auctionState == ItemAuctionState.FINISHED) && (startingTime < (System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(Config.ALT_ITEM_AUCTION_EXPIRED_AFTER, TimeUnit.DAYS))))
|
||||
if ((auctionState == ItemAuctionState.FINISHED) && (startingTime < (Chronos.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(Config.ALT_ITEM_AUCTION_EXPIRED_AFTER, TimeUnit.DAYS))))
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": Clearing expired auction: " + auctionId);
|
||||
try (PreparedStatement ps = con.prepareStatement(DELETE_AUCTION_INFO_BY_AUCTION_ID))
|
||||
|
@@ -35,6 +35,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.xml.AgathionData;
|
||||
import org.l2jmobius.gameserver.data.xml.AppearanceItemData;
|
||||
@@ -203,7 +204,7 @@ public class ItemInstance extends WorldObject
|
||||
_type2 = 0;
|
||||
_dropTime = 0;
|
||||
_mana = _item.getDuration();
|
||||
_time = _item.getTime() == -1 ? -1 : System.currentTimeMillis() + (_item.getTime() * 60 * 1000);
|
||||
_time = _item.getTime() == -1 ? -1 : Chronos.currentTimeMillis() + (_item.getTime() * 60 * 1000);
|
||||
scheduleLifeTimeTask();
|
||||
scheduleVisualLifeTime();
|
||||
}
|
||||
@@ -226,7 +227,7 @@ public class ItemInstance extends WorldObject
|
||||
super.setName(_item.getName());
|
||||
_loc = ItemLocation.VOID;
|
||||
_mana = _item.getDuration();
|
||||
_time = _item.getTime() == -1 ? -1 : System.currentTimeMillis() + (_item.getTime() * 60 * 1000);
|
||||
_time = _item.getTime() == -1 ? -1 : Chronos.currentTimeMillis() + (_item.getTime() * 60 * 1000);
|
||||
scheduleLifeTimeTask();
|
||||
scheduleVisualLifeTime();
|
||||
}
|
||||
@@ -1574,7 +1575,7 @@ public class ItemInstance extends WorldObject
|
||||
setSpawned(true);
|
||||
setXYZ(x, y, z);
|
||||
|
||||
setDropTime(System.currentTimeMillis());
|
||||
setDropTime(Chronos.currentTimeMillis());
|
||||
setDropperObjectId(dropper != null ? dropper.getObjectId() : 0); // Set the dropper Id for the knownlist packets in sendInfo
|
||||
|
||||
// Add the ItemInstance dropped in the world as a visible object
|
||||
@@ -1853,7 +1854,7 @@ public class ItemInstance extends WorldObject
|
||||
|
||||
public long getRemainingTime()
|
||||
{
|
||||
return _time - System.currentTimeMillis();
|
||||
return _time - Chronos.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void endOfLife()
|
||||
@@ -2508,7 +2509,7 @@ public class ItemInstance extends WorldObject
|
||||
if (getVisualLifeTime() > 0)
|
||||
{
|
||||
final long endTime = getVisualLifeTime();
|
||||
if ((endTime - System.currentTimeMillis()) > 0)
|
||||
if ((endTime - Chronos.currentTimeMillis()) > 0)
|
||||
{
|
||||
ItemAppearanceTaskManager.getInstance().add(this, endTime);
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
@@ -81,7 +82,7 @@ public abstract class AbstractOlympiadGame
|
||||
|
||||
protected boolean makeCompetitionStart()
|
||||
{
|
||||
_startTime = System.currentTimeMillis();
|
||||
_startTime = Chronos.currentTimeMillis();
|
||||
return !_aborted;
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
@@ -765,7 +766,7 @@ public class Hero
|
||||
|
||||
// Prepare new data
|
||||
final StatSet diaryEntry = new StatSet();
|
||||
final String date = (new SimpleDateFormat("yyyy-MM-dd HH")).format(new Date(System.currentTimeMillis()));
|
||||
final String date = (new SimpleDateFormat("yyyy-MM-dd HH")).format(new Date(Chronos.currentTimeMillis()));
|
||||
diaryEntry.set("date", date);
|
||||
diaryEntry.set("action", template.getName() + " was defeated");
|
||||
|
||||
@@ -786,7 +787,7 @@ public class Hero
|
||||
|
||||
// Prepare new data
|
||||
final StatSet diaryEntry = new StatSet();
|
||||
final String date = (new SimpleDateFormat("yyyy-MM-dd HH")).format(new Date(System.currentTimeMillis()));
|
||||
final String date = (new SimpleDateFormat("yyyy-MM-dd HH")).format(new Date(Chronos.currentTimeMillis()));
|
||||
diaryEntry.set("date", date);
|
||||
diaryEntry.set("action", castle.getName() + " Castle was successfuly taken");
|
||||
|
||||
@@ -800,7 +801,7 @@ public class Hero
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, charId);
|
||||
ps.setLong(2, System.currentTimeMillis());
|
||||
ps.setLong(2, Chronos.currentTimeMillis());
|
||||
ps.setInt(3, action);
|
||||
ps.setInt(4, param);
|
||||
ps.execute();
|
||||
|
@@ -27,6 +27,7 @@ import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@@ -544,7 +545,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
String winner = "draw";
|
||||
|
||||
// Calculate Fight time
|
||||
final long _fightTime = (System.currentTimeMillis() - _startTime);
|
||||
final long _fightTime = (Chronos.currentTimeMillis() - _startTime);
|
||||
|
||||
double playerOneHp = 0;
|
||||
if ((_playerOne.getPlayer() != null) && !_playerOne.getPlayer().isDead())
|
||||
|
@@ -27,6 +27,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||
import org.l2jmobius.gameserver.handler.PunishmentHandler;
|
||||
import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
@@ -133,7 +134,7 @@ public class PunishmentTask implements Runnable
|
||||
*/
|
||||
public boolean isExpired()
|
||||
{
|
||||
return (_expirationTime > 0) && (System.currentTimeMillis() > _expirationTime);
|
||||
return (_expirationTime > 0) && (Chronos.currentTimeMillis() > _expirationTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,7 +150,7 @@ public class PunishmentTask implements Runnable
|
||||
onStart();
|
||||
if (_expirationTime > 0) // Has expiration?
|
||||
{
|
||||
_task = ThreadPool.schedule(this, (_expirationTime - System.currentTimeMillis()));
|
||||
_task = ThreadPool.schedule(this, (_expirationTime - Chronos.currentTimeMillis()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +227,7 @@ public class PunishmentTask implements Runnable
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
|
||||
{
|
||||
st.setLong(1, System.currentTimeMillis());
|
||||
st.setLong(1, Chronos.currentTimeMillis());
|
||||
st.setLong(2, _id);
|
||||
st.execute();
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.data.EventDroplist;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
@@ -100,7 +101,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
else if (_eventPeriod.getStartDate().after(new Date()))
|
||||
{
|
||||
final long delay = _eventPeriod.getStartDate().getTime() - System.currentTimeMillis();
|
||||
final long delay = _eventPeriod.getStartDate().getTime() - Chronos.currentTimeMillis();
|
||||
ThreadPool.schedule(new ScheduleStart(), delay);
|
||||
LOGGER.info("Event " + _eventName + " will be started at " + _eventPeriod.getStartDate());
|
||||
}
|
||||
@@ -323,7 +324,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
// Add spawns.
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - System.currentTimeMillis();
|
||||
final Long millisToEventEnd = _eventPeriod.getEndDate().getTime() - Chronos.currentTimeMillis();
|
||||
for (NpcSpawn spawn : _spawnList)
|
||||
{
|
||||
addSpawn(spawn.npcId, spawn.loc.getX(), spawn.loc.getY(), spawn.loc.getZ(), spawn.loc.getHeading(), false, millisToEventEnd, false);
|
||||
|
@@ -22,6 +22,7 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.enums.QuestSound;
|
||||
import org.l2jmobius.gameserver.enums.QuestType;
|
||||
import org.l2jmobius.gameserver.instancemanager.QuestManager;
|
||||
@@ -785,7 +786,7 @@ public class QuestState
|
||||
public boolean isNowAvailable()
|
||||
{
|
||||
final String val = get("restartTime");
|
||||
return (val != null) && (Long.parseLong(val) <= System.currentTimeMillis());
|
||||
return (val != null) && (Long.parseLong(val) <= Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void setSimulated(boolean simulated)
|
||||
|
@@ -28,6 +28,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillTreeData;
|
||||
import org.l2jmobius.gameserver.enums.SocialClass;
|
||||
@@ -138,7 +139,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
|
||||
final int level = rs.getInt("level");
|
||||
final long expiration = rs.getLong("expiration");
|
||||
final ResidenceFunction func = new ResidenceFunction(id, level, expiration, this);
|
||||
if ((expiration <= System.currentTimeMillis()) && !func.reactivate())
|
||||
if ((expiration <= Chronos.currentTimeMillis()) && !func.reactivate())
|
||||
{
|
||||
removeFunction(func);
|
||||
continue;
|
||||
|
@@ -31,6 +31,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.enums.ClanHallGrade;
|
||||
import org.l2jmobius.gameserver.enums.ClanHallType;
|
||||
@@ -265,7 +266,7 @@ public class ClanHall extends AbstractResidence
|
||||
|
||||
final int failDays = getCostFailDay();
|
||||
final long time = failDays > 0 ? (failDays > 8 ? Instant.now().toEpochMilli() : Instant.ofEpochMilli(_paidUntil).plus(Duration.ofDays(failDays + 1)).toEpochMilli()) : _paidUntil;
|
||||
_checkPaymentTask = ThreadPool.schedule(new CheckPaymentTask(), time - System.currentTimeMillis());
|
||||
_checkPaymentTask = ThreadPool.schedule(new CheckPaymentTask(), time - Chronos.currentTimeMillis());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -310,7 +311,7 @@ public class ClanHall extends AbstractResidence
|
||||
*/
|
||||
public long getNextPayment()
|
||||
{
|
||||
return (_checkPaymentTask != null) ? System.currentTimeMillis() + _checkPaymentTask.getDelay(TimeUnit.MILLISECONDS) : 0;
|
||||
return (_checkPaymentTask != null) ? Chronos.currentTimeMillis() + _checkPaymentTask.getDelay(TimeUnit.MILLISECONDS) : 0;
|
||||
}
|
||||
|
||||
public Location getOwnerLocation()
|
||||
@@ -382,7 +383,7 @@ public class ClanHall extends AbstractResidence
|
||||
{
|
||||
_owner.getWarehouse().destroyItem("Clan Hall Lease", Inventory.ADENA_ID, _lease, null, null);
|
||||
setPaidUntil(Instant.ofEpochMilli(_paidUntil).plus(Duration.ofDays(7)).toEpochMilli());
|
||||
_checkPaymentTask = ThreadPool.schedule(new CheckPaymentTask(), _paidUntil - System.currentTimeMillis());
|
||||
_checkPaymentTask = ThreadPool.schedule(new CheckPaymentTask(), _paidUntil - Chronos.currentTimeMillis());
|
||||
updateDB();
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.data.xml.ClanHallData;
|
||||
import org.l2jmobius.gameserver.instancemanager.ClanHallAuctionManager;
|
||||
@@ -85,7 +86,7 @@ public class ClanHallAuction
|
||||
|
||||
public void addBid(Clan clan, long bid)
|
||||
{
|
||||
addBid(clan, bid, System.currentTimeMillis());
|
||||
addBid(clan, bid, Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void addBid(Clan clan, long bid, long bidTime)
|
||||
|
@@ -20,6 +20,7 @@ import java.time.Instant;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.data.xml.ResidenceFunctionsData;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
@@ -63,9 +64,9 @@ public class ResidenceFunction
|
||||
private void init()
|
||||
{
|
||||
final ResidenceFunctionTemplate template = getTemplate();
|
||||
if ((template != null) && (_expiration > System.currentTimeMillis()))
|
||||
if ((template != null) && (_expiration > Chronos.currentTimeMillis()))
|
||||
{
|
||||
_task = ThreadPool.schedule(this::onFunctionExpiration, _expiration - System.currentTimeMillis());
|
||||
_task = ThreadPool.schedule(this::onFunctionExpiration, _expiration - Chronos.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +171,7 @@ public class ResidenceFunction
|
||||
|
||||
if (wh.destroyItem("FunctionFee", item, template.getCost().getCount(), null, this) != null)
|
||||
{
|
||||
_expiration = System.currentTimeMillis() + (template.getDuration().getSeconds() * 1000);
|
||||
_expiration = Chronos.currentTimeMillis() + (template.getDuration().getSeconds() * 1000);
|
||||
init();
|
||||
}
|
||||
return true;
|
||||
|
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.shuttle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
|
||||
/**
|
||||
@@ -29,7 +30,7 @@ public class ShuttleStop
|
||||
private final int _id;
|
||||
private boolean _isOpen = true;
|
||||
private final List<Location> _dimensions = new ArrayList<>(3);
|
||||
private long _lastDoorStatusChanges = System.currentTimeMillis();
|
||||
private long _lastDoorStatusChanges = Chronos.currentTimeMillis();
|
||||
|
||||
public ShuttleStop(int id)
|
||||
{
|
||||
@@ -64,7 +65,7 @@ public class ShuttleStop
|
||||
}
|
||||
|
||||
_isOpen = true;
|
||||
_lastDoorStatusChanges = System.currentTimeMillis();
|
||||
_lastDoorStatusChanges = Chronos.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void closeDoor()
|
||||
@@ -75,11 +76,11 @@ public class ShuttleStop
|
||||
}
|
||||
|
||||
_isOpen = false;
|
||||
_lastDoorStatusChanges = System.currentTimeMillis();
|
||||
_lastDoorStatusChanges = Chronos.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean hasDoorChanged()
|
||||
{
|
||||
return (System.currentTimeMillis() - _lastDoorStatusChanges) <= 1000;
|
||||
return (Chronos.currentTimeMillis() - _lastDoorStatusChanges) <= 1000;
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.data.xml.CastleData;
|
||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||
@@ -161,7 +162,7 @@ public class Castle extends AbstractResidence
|
||||
{
|
||||
return;
|
||||
}
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
if (_endDate > currentTime)
|
||||
{
|
||||
ThreadPool.schedule(new FunctionTask(cwh), _endDate - currentTime);
|
||||
@@ -196,7 +197,7 @@ public class Castle extends AbstractResidence
|
||||
fee = _tempFee;
|
||||
}
|
||||
|
||||
setEndTime(System.currentTimeMillis() + _rate);
|
||||
setEndTime(Chronos.currentTimeMillis() + _rate);
|
||||
dbSave();
|
||||
if (_cwh)
|
||||
{
|
||||
|
@@ -35,6 +35,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.FortUpdater;
|
||||
import org.l2jmobius.gameserver.FortUpdater.UpdaterType;
|
||||
import org.l2jmobius.gameserver.data.SpawnTable;
|
||||
@@ -163,7 +164,7 @@ public class Fort extends AbstractResidence
|
||||
{
|
||||
return;
|
||||
}
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
if (_endDate > currentTime)
|
||||
{
|
||||
ThreadPool.schedule(new FunctionTask(cwh), _endDate - currentTime);
|
||||
@@ -193,7 +194,7 @@ public class Fort extends AbstractResidence
|
||||
if ((_fortOwner.getWarehouse().getAdena() >= _fee) || !_cwh)
|
||||
{
|
||||
final int fee = _endDate == -1 ? _tempFee : _fee;
|
||||
setEndTime(System.currentTimeMillis() + _rate);
|
||||
setEndTime(Chronos.currentTimeMillis() + _rate);
|
||||
dbSave();
|
||||
if (_cwh)
|
||||
{
|
||||
@@ -580,7 +581,7 @@ public class Fort extends AbstractResidence
|
||||
clan.setFortId(getResidenceId());
|
||||
setOwnerClan(clan);
|
||||
final int runCount = getOwnedTime() / (Config.FS_UPDATE_FRQ * 60);
|
||||
long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis();
|
||||
long initial = Chronos.currentTimeMillis() - _lastOwnedTime.getTimeInMillis();
|
||||
while (initial > (Config.FS_UPDATE_FRQ * 60000))
|
||||
{
|
||||
initial -= Config.FS_UPDATE_FRQ * 60000;
|
||||
@@ -786,7 +787,7 @@ public class Fort extends AbstractResidence
|
||||
if (clan != null)
|
||||
{
|
||||
clanId = clan.getId();
|
||||
_lastOwnedTime.setTimeInMillis(System.currentTimeMillis());
|
||||
_lastOwnedTime.setTimeInMillis(Chronos.currentTimeMillis());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -920,12 +921,12 @@ public class Fort extends AbstractResidence
|
||||
|
||||
public int getOwnedTime()
|
||||
{
|
||||
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) ((System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000);
|
||||
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) ((Chronos.currentTimeMillis() - _lastOwnedTime.getTimeInMillis()) / 1000);
|
||||
}
|
||||
|
||||
public int getTimeTillRebelArmy()
|
||||
{
|
||||
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000)) - System.currentTimeMillis()) / 1000);
|
||||
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000)) - Chronos.currentTimeMillis()) / 1000);
|
||||
}
|
||||
|
||||
public long getTimeTillNextFortUpdate()
|
||||
|
@@ -34,6 +34,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.data.xml.SiegeScheduleData;
|
||||
import org.l2jmobius.gameserver.enums.SiegeClanType;
|
||||
@@ -1434,9 +1435,9 @@ public class Siege implements Siegable
|
||||
}
|
||||
|
||||
final Calendar calendar = _castle.getSiegeDate();
|
||||
if (calendar.getTimeInMillis() < System.currentTimeMillis())
|
||||
if (calendar.getTimeInMillis() < Chronos.currentTimeMillis())
|
||||
{
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
calendar.setTimeInMillis(Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
calendar.set(Calendar.DAY_OF_WEEK, holder.getDay());
|
||||
|
@@ -32,10 +32,10 @@ import org.l2jmobius.gameserver.model.residences.AbstractResidence;
|
||||
import org.l2jmobius.gameserver.model.residences.ResidenceFunction;
|
||||
import org.l2jmobius.gameserver.model.residences.ResidenceFunctionType;
|
||||
import org.l2jmobius.gameserver.model.siege.Castle;
|
||||
import org.l2jmobius.gameserver.model.siege.Fort;
|
||||
import org.l2jmobius.gameserver.model.siege.Siege;
|
||||
import org.l2jmobius.gameserver.model.siege.Castle.CastleFunction;
|
||||
import org.l2jmobius.gameserver.model.siege.Fort;
|
||||
import org.l2jmobius.gameserver.model.siege.Fort.FortFunction;
|
||||
import org.l2jmobius.gameserver.model.siege.Siege;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
|
@@ -30,8 +30,8 @@ import org.l2jmobius.gameserver.model.residences.AbstractResidence;
|
||||
import org.l2jmobius.gameserver.model.residences.ResidenceFunction;
|
||||
import org.l2jmobius.gameserver.model.residences.ResidenceFunctionType;
|
||||
import org.l2jmobius.gameserver.model.siege.Castle;
|
||||
import org.l2jmobius.gameserver.model.siege.Fort;
|
||||
import org.l2jmobius.gameserver.model.siege.Castle.CastleFunction;
|
||||
import org.l2jmobius.gameserver.model.siege.Fort;
|
||||
import org.l2jmobius.gameserver.model.siege.Fort.FortFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
|
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.zone.type;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameServer;
|
||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@@ -99,7 +100,7 @@ public class NoRestartZone extends ZoneType
|
||||
return;
|
||||
}
|
||||
|
||||
if (((System.currentTimeMillis() - player.getLastAccess()) > _restartTime) && ((System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis()) > _restartAllowedTime))
|
||||
if (((Chronos.currentTimeMillis() - player.getLastAccess()) > _restartTime) && ((Chronos.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis()) > _restartAllowedTime))
|
||||
{
|
||||
player.teleToLocation(TeleportWhereType.TOWN);
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.network.ChannelInboundHandler;
|
||||
import org.l2jmobius.commons.network.ICrypt;
|
||||
import org.l2jmobius.commons.network.IIncomingPacket;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.LoginServerThread.SessionKey;
|
||||
import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
@@ -341,7 +342,7 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
|
||||
{
|
||||
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
|
||||
ps2.setLong(1, Chronos.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
|
||||
ps2.setInt(2, objectId);
|
||||
ps2.execute();
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
@@ -81,7 +82,7 @@ public class AllyDismiss implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
leaderClan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED * 86400000), Clan.PENALTY_TYPE_DISMISS_CLAN); // 24*60*60*1000 = 86400000
|
||||
leaderClan.updateClanInDB();
|
||||
|
||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
@@ -62,7 +63,7 @@ public class AllyLeave implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long currentTime = Chronos.currentTimeMillis();
|
||||
clan.setAllyId(0);
|
||||
clan.setAllyName(null);
|
||||
clan.changeAllyCrest(0, true);
|
||||
|
@@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
@@ -526,7 +527,7 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getClanJoinExpiryTime() > System.currentTimeMillis())
|
||||
if (player.getClanJoinExpiryTime() > Chronos.currentTimeMillis())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_HAVE_RECENTLY_BEEN_DISMISSED_FROM_A_CLAN_YOU_ARE_NOT_ALLOWED_TO_JOIN_ANOTHER_CLAN_FOR_24_HOURS);
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ import java.util.Arrays;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||
import org.l2jmobius.gameserver.enums.AdminTeleportType;
|
||||
@@ -74,7 +75,7 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Config.PLAYER_MOVEMENT_BLOCK_TIME > 0) && !player.isGM() && (player.getNotMoveUntil() > System.currentTimeMillis()))
|
||||
if ((Config.PLAYER_MOVEMENT_BLOCK_TIME > 0) && !player.isGM() && (player.getNotMoveUntil() > Chronos.currentTimeMillis()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOU_CANNOT_MOVE_WHILE_SPEAKING_TO_AN_NPC_ONE_MOMENT_PLEASE);
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user