Removed unnecessary Long literals.

This commit is contained in:
MobiusDev
2018-06-21 09:59:45 +00:00
parent e7504cea28
commit fd6b72dab6
294 changed files with 643 additions and 643 deletions
@@ -127,7 +127,7 @@ public final class DenOfEvil extends AbstractNpcAI
zone.addSkill(skillId, skillLevel + 1); zone.addSkill(skillId, skillLevel + 1);
if (skillLevel == 3) // 3+1=4 if (skillLevel == 3) // 3+1=4
{ {
ThreadPool.schedule(new KashaDestruction(zone), 2 * 60 * 1000l); ThreadPool.schedule(new KashaDestruction(zone), 2 * 60 * 1000);
zone.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.DEFEAT_KASHA_S_EYES_TO_LIFT_THE_GREAT_CURSE)); zone.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.DEFEAT_KASHA_S_EYES_TO_LIFT_THE_GREAT_CURSE));
} }
else if (skillLevel == 2) else if (skillLevel == 2)
@@ -128,12 +128,12 @@ public final class Parade extends AbstractNpcAI
public Parade() public Parade()
{ {
// Starts at 8:00 and repeats every 6 hours. // Starts at 8:00 and repeats every 6 hours.
final long diff = timeLeftMilli(8, 0, 0), cycle = 3600000L; final long diff = timeLeftMilli(8, 0, 0), cycle = 3600000;
ThreadPool.scheduleAtFixedRate(new Start(), diff, cycle); ThreadPool.scheduleAtFixedRate(new Start(), diff, cycle);
// Test - Starts 3 minutes after server startup and repeats every 20 minutes. // Test - Starts 3 minutes after server startup and repeats every 20 minutes.
// final long diff = timeLeftMilli(8, 0, 0), cycle = 600000L; // final long diff = timeLeftMilli(8, 0, 0), cycle = 600000;
// ThreadPoolManager.scheduleAtFixedRate(new Start(), 180000L, cycle); // ThreadPoolManager.scheduleAtFixedRate(new Start(), 180000, cycle);
LOGGER.info("Fantasy Isle: Parade starting at " + new SimpleDateFormat("yyyy/MM/dd HH:mm").format(System.currentTimeMillis() + diff) + " and is scheduled each next " + (cycle / 3600000) + " hours."); LOGGER.info("Fantasy Isle: Parade starting at " + new SimpleDateFormat("yyyy/MM/dd HH:mm").format(System.currentTimeMillis() + diff) + " and is scheduled each next " + (cycle / 3600000) + " hours.");
} }
@@ -164,7 +164,7 @@ public final class Parade extends AbstractNpcAI
dd += 86400; dd += 86400;
} }
return (dd * 1000L) / 6L; return (dd * 1000) / 6;
} }
class Start implements Runnable class Start implements Runnable
@@ -114,7 +114,7 @@ public final class TrainingCamp extends AbstractNpcAI
// @Sdw: Here we are supposed to send ExUserInfoEquipSlot with a fake equip of a SLS, feels ugly to me, not doing it. // @Sdw: Here we are supposed to send ExUserInfoEquipSlot with a fake equip of a SLS, feels ugly to me, not doing it.
player.setTraingCampInfo(new TrainingHolder(player.getObjectId(), player.getClassIndex(), player.getLevel(), System.currentTimeMillis(), -1)); player.setTraingCampInfo(new TrainingHolder(player.getObjectId(), player.getClassIndex(), player.getLevel(), System.currentTimeMillis(), -1));
final long timeRemaining = Config.TRAINING_CAMP_MAX_DURATION - trainingCampDuration; final long timeRemaining = Config.TRAINING_CAMP_MAX_DURATION - trainingCampDuration;
player.sendPacket(new ExTrainingZone_Admission(player.getLevel(), 0L, timeRemaining)); player.sendPacket(new ExTrainingZone_Admission(player.getLevel(), 0, timeRemaining));
startQuestTimer("finish", TimeUnit.SECONDS.toMillis(timeRemaining), npc, player); startQuestTimer("finish", TimeUnit.SECONDS.toMillis(timeRemaining), npc, player);
} }
else else
@@ -213,7 +213,7 @@ public class AdminCursedWeapons implements IAdminCommandHandler
{ {
activeChar.addItem("AdminCursedWeaponAdd", id, 1, activeChar, true); activeChar.addItem("AdminCursedWeaponAdd", id, 1, activeChar, true);
} }
cw.setEndTime(System.currentTimeMillis() + (cw.getDuration() * 60000L)); cw.setEndTime(System.currentTimeMillis() + (cw.getDuration() * 60000));
cw.reActivate(); cw.reActivate();
} }
} }
@@ -201,8 +201,8 @@ public class ItemSkillsTemplate implements IItemHandler
{ {
if (!isAvailable) if (!isAvailable)
{ {
final int hours = (int) (remainingTime / 3600000L); final int hours = (int) (remainingTime / 3600000);
final int minutes = (int) (remainingTime % 3600000L) / 60000; final int minutes = (int) (remainingTime % 3600000) / 60000;
final int seconds = (int) ((remainingTime / 1000) % 60); final int seconds = (int) ((remainingTime / 1000) % 60);
SystemMessage sm = null; SystemMessage sm = null;
if (hours > 0) if (hours > 0)
@@ -409,7 +409,7 @@ public final class ChamberOfDelusion extends AbstractInstance
protected void scheduleRoomChange(Instance world, boolean bossRoom) protected void scheduleRoomChange(Instance world, boolean bossRoom)
{ {
// Schedule next room change only if remaining time is enough // Schedule next room change only if remaining time is enough
final long nextInterval = (bossRoom) ? 60000L : (ROOM_CHANGE_INTERVAL + getRandom(ROOM_CHANGE_RANDOM_TIME)) * 1000L; final long nextInterval = (bossRoom) ? 60000 : (ROOM_CHANGE_INTERVAL + getRandom(ROOM_CHANGE_RANDOM_TIME)) * 1000;
if (world.getRemainingTime() > nextInterval) if (world.getRemainingTime() > nextInterval)
{ {
final ScheduledFuture<?> roomChangeTask = ThreadPool.schedule(() -> final ScheduledFuture<?> roomChangeTask = ThreadPool.schedule(() ->
@@ -521,7 +521,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
for (int i = 0; i < npcInfo[4]; i++) for (int i = 0; i < npcInfo[4]; i++)
{ {
final L2Npc mob = addSpawn(npcInfo[5], npc.getX() + getRandom(-150, 150), npc.getY() + getRandom(-150, 150), npc.getZ(), npc.getHeading(), true, 60000L, false); final L2Npc mob = addSpawn(npcInfo[5], npc.getX() + getRandom(-150, 150), npc.getY() + getRandom(-150, 150), npc.getZ(), npc.getHeading(), true, 60000, false);
mob.setRunning(); mob.setRunning();
((L2Attackable) mob).addDamageHate(attacker, 0, 500); ((L2Attackable) mob).addDamageHate(attacker, 0, 500);
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker); mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
@@ -607,7 +607,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
addSpawn(SACRIFICE_OF_THE_SACRIFICED, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000L, false); addSpawn(SACRIFICE_OF_THE_SACRIFICED, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000, false);
} }
} }
break; break;
@@ -618,7 +618,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
addSpawn(HARIT_LIZARDMAN_ZEALOT, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000L, false); addSpawn(HARIT_LIZARDMAN_ZEALOT, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000, false);
} }
} }
break; break;
@@ -628,7 +628,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
if (qs.isCond(4) && (getRandom(100) < 50) && !hasQuestItems(player, THIRD_FRAGMENT_OF_ABYSS_JEWEL)) if (qs.isCond(4) && (getRandom(100) < 50) && !hasQuestItems(player, THIRD_FRAGMENT_OF_ABYSS_JEWEL))
{ {
addSpawn(ABYSSAL_JEWEL_3, npc.getX() + getRandom(-50, 50), npc.getY() + getRandom(-50, 50), npc.getZ(), npc.getHeading(), true, 60000L, false); addSpawn(ABYSSAL_JEWEL_3, npc.getX() + getRandom(-50, 50), npc.getY() + getRandom(-50, 50), npc.getZ(), npc.getHeading(), true, 60000, false);
} }
break; break;
} }
@@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
public class WarehouseCacheManager public class WarehouseCacheManager
{ {
protected final Map<L2PcInstance, Long> _cachedWh = new ConcurrentHashMap<>(); protected final Map<L2PcInstance, Long> _cachedWh = new ConcurrentHashMap<>();
protected final long _cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000L; protected final long _cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000;
protected WarehouseCacheManager() protected WarehouseCacheManager()
{ {
@@ -169,7 +169,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", npc.getCurrentHp()); info.set("currentHP", npc.getCurrentHp());
info.set("currentMP", npc.getCurrentMp()); info.set("currentMP", npc.getCurrentMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
_storedInfo.put(npcId, info); _storedInfo.put(npcId, info);
_npcs.put(npcId, npc); _npcs.put(npcId, npc);
@@ -219,7 +219,7 @@ public class DBSpawnManager
info.set("currentHP", npc.getCurrentHp()); info.set("currentHP", npc.getCurrentHp());
info.set("currentMP", npc.getCurrentMp()); info.set("currentMP", npc.getCurrentMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
} }
_storedInfo.put(npc.getId(), info); _storedInfo.put(npc.getId(), info);
} }
@@ -248,7 +248,7 @@ public class DBSpawnManager
SpawnTable.getInstance().addNewSpawn(spawn, false); SpawnTable.getInstance().addNewSpawn(spawn, false);
if ((respawnTime == 0L) || (time > respawnTime)) if ((respawnTime == 0) || (time > respawnTime))
{ {
final L2Npc npc = spawn.doSpawn(); final L2Npc npc = spawn.doSpawn();
if (npc != null) if (npc != null)
@@ -262,7 +262,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", currentHP); info.set("currentHP", currentHP);
info.set("currentMP", currentMP); info.set("currentMP", currentMP);
info.set("respawnTime", 0L); info.set("respawnTime", 0);
_storedInfo.put(npcId, info); _storedInfo.put(npcId, info);
} }
@@ -324,7 +324,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", npc.getMaxHp()); info.set("currentHP", npc.getMaxHp());
info.set("currentMP", npc.getMaxMp()); info.set("currentMP", npc.getMaxMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
_npcs.put(npcId, npc); _npcs.put(npcId, npc);
_storedInfo.put(npcId, info); _storedInfo.put(npcId, info);
@@ -541,7 +541,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", npc.getCurrentHp()); info.set("currentHP", npc.getCurrentHp());
info.set("currentMP", npc.getCurrentMp()); info.set("currentMP", npc.getCurrentMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
npc.setDBStatus(DBStatusType.ALIVE); npc.setDBStatus(DBStatusType.ALIVE);
@@ -446,7 +446,7 @@ public final class WalkingManager implements IGameXmlReader
npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText()); npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText());
} }
ThreadPool.schedule(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000L)); ThreadPool.schedule(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000));
} }
} }
} }
@@ -35,8 +35,8 @@ public class CharSelectInfoPackage
private int _race = 0; private int _race = 0;
private int _classId = 0; private int _classId = 0;
private int _baseClassId = 0; private int _baseClassId = 0;
private long _deleteTimer = 0L; private long _deleteTimer = 0;
private long _lastAccess = 0L; private long _lastAccess = 0;
private int _face = 0; private int _face = 0;
private int _hairStyle = 0; private int _hairStyle = 0;
private int _hairColor = 0; private int _hairColor = 0;
@@ -63,7 +63,7 @@ public class CreatureContainer
{ {
if ((_task == null) || _task.isDone()) if ((_task == null) || _task.isDone())
{ {
_task = ThreadPool.scheduleAtFixedRate(this::update, 1000L, 1000L); _task = ThreadPool.scheduleAtFixedRate(this::update, 1000, 1000);
} }
} }
@@ -374,7 +374,7 @@ public class CursedWeapon implements INamable
} }
else else
{ {
_removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000L, _durationLost * 12000L); _removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000, _durationLost * 12000);
} }
} }
@@ -387,8 +387,8 @@ public class CursedWeapon implements INamable
dropIt(attackable, player); dropIt(attackable, player);
// Start the Life Task // Start the Life Task
_endTime = System.currentTimeMillis() + (_duration * 60000L); _endTime = System.currentTimeMillis() + (_duration * 60000);
_removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000L, _durationLost * 12000L); _removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000, _durationLost * 12000);
return true; return true;
} }
@@ -534,7 +534,7 @@ public class CursedWeapon implements INamable
} }
} }
// Reduce time-to-live // Reduce time-to-live
_endTime -= _durationLost * 60000L; _endTime -= _durationLost * 60000;
saveData(); saveData();
} }
@@ -496,7 +496,7 @@ public class L2Clan implements IIdentifiable, INamable
if (player.isClanLeader()) if (player.isClanLeader())
{ {
SiegeManager.getInstance().removeSiegeSkills(player); SiegeManager.getInstance().removeSiegeSkills(player);
player.setClanCreateExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 player.setClanCreateExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
} }
// remove Clan skills from Player // remove Clan skills from Player
removeSkillEffects(player); removeSkillEffects(player);
@@ -527,7 +527,7 @@ public class L2Clan implements IIdentifiable, INamable
} }
else else
{ {
removeMemberInDatabase(exMember, clanJoinExpiryTime, getLeaderId() == objectId ? System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000L) : 0); removeMemberInDatabase(exMember, clanJoinExpiryTime, getLeaderId() == objectId ? System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000) : 0);
} }
// Notify to scripts // Notify to scripts
@@ -1088,7 +1088,7 @@ public class L2Clan implements IIdentifiable, INamable
setAllyPenaltyExpiryTime(0, 0); setAllyPenaltyExpiryTime(0, 0);
} }
setCharPenaltyExpiryTime(clanData.getLong("char_penalty_expiry_time")); setCharPenaltyExpiryTime(clanData.getLong("char_penalty_expiry_time"));
if ((getCharPenaltyExpiryTime() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)) < System.currentTimeMillis()) // 24*60*60*1000 = 86400000 if ((getCharPenaltyExpiryTime() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)) < System.currentTimeMillis()) // 24*60*60*1000 = 86400000
{ {
setCharPenaltyExpiryTime(0); setCharPenaltyExpiryTime(0);
} }
@@ -2471,7 +2471,7 @@ public class L2Clan implements IIdentifiable, INamable
setAllyId(0); setAllyId(0);
setAllyName(null); setAllyName(null);
changeAllyCrest(0, false); changeAllyCrest(0, false);
setAllyPenaltyExpiryTime(currentTime + (Config.ALT_CREATE_ALLY_DAYS_WHEN_DISSOLVED * 86400000L), PENALTY_TYPE_DISSOLVE_ALLY); // 24*60*60*1000 = 86400000 setAllyPenaltyExpiryTime(currentTime + (Config.ALT_CREATE_ALLY_DAYS_WHEN_DISSOLVED * 86400000), PENALTY_TYPE_DISSOLVE_ALLY); // 24*60*60*1000 = 86400000
updateClanInDB(); updateClanInDB();
} }
@@ -71,7 +71,7 @@ public enum PcCondOverride
public static long getAllExceptionsMask() public static long getAllExceptionsMask()
{ {
long result = 0L; long result = 0;
for (PcCondOverride ex : values()) for (PcCondOverride ex : values())
{ {
result |= ex.getMask(); result |= ex.getMask();
@@ -228,7 +228,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
private Team _team = Team.NONE; private Team _team = Team.NONE;
protected long _exceptions = 0L; protected long _exceptions = 0;
private boolean _lethalable = true; private boolean _lethalable = true;
@@ -10023,7 +10023,7 @@ public final class L2PcInstance extends L2Playable
{ {
if (_taskRentPet == null) if (_taskRentPet == null)
{ {
_taskRentPet = ThreadPool.scheduleAtFixedRate(new RentPetTask(this), seconds * 1000L, seconds * 1000L); _taskRentPet = ThreadPool.scheduleAtFixedRate(new RentPetTask(this), seconds * 1000, seconds * 1000);
} }
} }
@@ -13974,7 +13974,7 @@ public final class L2PcInstance extends L2Playable
stopOnlineTimeUpdateTask(); stopOnlineTimeUpdateTask();
} }
_onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000L, 60 * 1000L); _onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000, 60 * 1000);
} }
private void updateOnlineTime() private void updateOnlineTime()
@@ -14052,7 +14052,7 @@ public final class L2PcInstance extends L2Playable
public long getTraingCampDuration() public long getTraingCampDuration()
{ {
return getAccountVariables().getLong(TRAINING_CAMP_DURATION, 0L); return getAccountVariables().getLong(TRAINING_CAMP_DURATION, 0);
} }
public void setTraingCampDuration(long duration) public void setTraingCampDuration(long duration)
@@ -350,7 +350,7 @@ public class L2VillageMasterInstance extends L2NpcInstance
return; return;
} }
clan.setDissolvingExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_DISSOLVE_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.setDissolvingExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_DISSOLVE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
// The clan leader should take the XP penalty of a full death. // The clan leader should take the XP penalty of a full death.
@@ -51,7 +51,7 @@ public class FlyMoveStartTask implements Runnable
if (!_player.hasRequest(SayuneRequest.class)) if (!_player.hasRequest(SayuneRequest.class))
{ {
_player.sendPacket(ExNotifyFlyMoveStart.STATIC_PACKET); _player.sendPacket(ExNotifyFlyMoveStart.STATIC_PACKET);
ThreadPool.schedule(this, 1000L); ThreadPool.schedule(this, 1000);
} }
} }
} }
@@ -581,14 +581,14 @@ public final class Fort extends AbstractResidence
setOwnerClan(clan); setOwnerClan(clan);
final int runCount = getOwnedTime() / (Config.FS_UPDATE_FRQ * 60); final int runCount = getOwnedTime() / (Config.FS_UPDATE_FRQ * 60);
long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis(); long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis();
while (initial > (Config.FS_UPDATE_FRQ * 60000L)) while (initial > (Config.FS_UPDATE_FRQ * 60000))
{ {
initial -= Config.FS_UPDATE_FRQ * 60000L; initial -= Config.FS_UPDATE_FRQ * 60000;
} }
initial = (Config.FS_UPDATE_FRQ * 60000L) - initial; initial = (Config.FS_UPDATE_FRQ * 60000) - initial;
if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600))) if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600)))
{ {
_FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.PERIODIC_UPDATE), initial, Config.FS_UPDATE_FRQ * 60000L); // Schedule owner tasks to start running _FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.PERIODIC_UPDATE), initial, Config.FS_UPDATE_FRQ * 60000); // Schedule owner tasks to start running
if (Config.FS_MAX_OWN_TIME > 0) if (Config.FS_MAX_OWN_TIME > 0)
{ {
_FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owener _FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owener
@@ -822,10 +822,10 @@ public final class Fort extends AbstractResidence
{ {
_FortUpdater[1].cancel(false); _FortUpdater[1].cancel(false);
} }
_FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.PERIODIC_UPDATE), Config.FS_UPDATE_FRQ * 60000L, Config.FS_UPDATE_FRQ * 60000L); // Schedule owner tasks to start running _FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.PERIODIC_UPDATE), Config.FS_UPDATE_FRQ * 60000, Config.FS_UPDATE_FRQ * 60000); // Schedule owner tasks to start running
if (Config.FS_MAX_OWN_TIME > 0) if (Config.FS_MAX_OWN_TIME > 0)
{ {
_FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owener _FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owner
} }
} }
else else
@@ -925,7 +925,7 @@ public final class Fort extends AbstractResidence
public final int getTimeTillRebelArmy() public final int getTimeTillRebelArmy()
{ {
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000)) - System.currentTimeMillis()) / 1000);
} }
public final long getTimeTillNextFortUpdate() public final long getTimeTillNextFortUpdate()
@@ -274,7 +274,7 @@ public class FortSiege implements Siegable
unspawnSiegeGuard(); // Remove all spawned siege guard from this fort unspawnSiegeGuard(); // Remove all spawned siege guard from this fort
getFort().resetDoors(); // Respawn door to fort getFort().resetDoors(); // Respawn door to fort
ThreadPool.schedule(new ScheduleSuspiciousMerchantSpawn(), FortSiegeManager.getInstance().getSuspiciousMerchantRespawnDelay() * 60 * 1000L); // Prepare 3hr task for suspicious merchant respawn ThreadPool.schedule(new ScheduleSuspiciousMerchantSpawn(), FortSiegeManager.getInstance().getSuspiciousMerchantRespawnDelay() * 60 * 1000); // Prepare 3hr task for suspicious merchant respawn
setSiegeDateTime(true); // store suspicious merchant spawn in DB setSiegeDateTime(true); // store suspicious merchant spawn in DB
if (_siegeEnd != null) if (_siegeEnd != null)
@@ -336,7 +336,7 @@ public class FortSiege implements Siegable
getFort().getZone().updateZoneStatusForCharactersInside(); getFort().getZone().updateZoneStatusForCharactersInside();
// Schedule a task to prepare auto siege end // Schedule a task to prepare auto siege end
_siegeEnd = ThreadPool.schedule(new ScheduleEndSiegeTask(), FortSiegeManager.getInstance().getSiegeLength() * 60 * 1000L); // Prepare auto end task _siegeEnd = ThreadPool.schedule(new ScheduleEndSiegeTask(), FortSiegeManager.getInstance().getSiegeLength() * 60 * 1000); // Prepare auto end task
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_FORTRESS_BATTLE_S1_HAS_BEGUN); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_FORTRESS_BATTLE_S1_HAS_BEGUN);
sm.addCastleId(getFort().getResidenceId()); sm.addCastleId(getFort().getResidenceId());
@@ -680,7 +680,7 @@ public class FortSiege implements Siegable
else if (_siegeRestore == null) else if (_siegeRestore == null)
{ {
getFort().getSiege().announceToPlayer(SystemMessage.getSystemMessage(SystemMessageId.THE_BARRACKS_HAVE_BEEN_SEIZED)); getFort().getSiege().announceToPlayer(SystemMessage.getSystemMessage(SystemMessageId.THE_BARRACKS_HAVE_BEEN_SEIZED));
_siegeRestore = ThreadPool.schedule(new ScheduleSiegeRestore(), FortSiegeManager.getInstance().getCountDownLength() * 60 * 1000L); _siegeRestore = ThreadPool.schedule(new ScheduleSiegeRestore(), FortSiegeManager.getInstance().getCountDownLength() * 60 * 1000);
} }
else else
{ {
@@ -181,12 +181,12 @@ public final class ItemAuction
public final long getStartingTimeRemaining() public final long getStartingTimeRemaining()
{ {
return Math.max(getEndingTime() - System.currentTimeMillis(), 0L); return Math.max(getEndingTime() - System.currentTimeMillis(), 0);
} }
public final long getFinishingTimeRemaining() public final long getFinishingTimeRemaining()
{ {
return Math.max(getEndingTime() - System.currentTimeMillis(), 0L); return Math.max(getEndingTime() - System.currentTimeMillis(), 0);
} }
public final void storeMe() public final void storeMe()
@@ -325,17 +325,17 @@ public final class ItemAuctionInstance
{ {
if (currentAuction.getAuctionState() == ItemAuctionState.STARTED) if (currentAuction.getAuctionState() == ItemAuctionState.STARTED)
{ {
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getEndingTime() - System.currentTimeMillis(), 0)));
} }
else else
{ {
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getStartingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getStartingTime() - System.currentTimeMillis(), 0)));
} }
LOGGER.info(getClass().getSimpleName() + ": Schedule current auction " + currentAuction.getAuctionId() + " for instance " + _instanceId); LOGGER.info(getClass().getSimpleName() + ": Schedule current auction " + currentAuction.getAuctionId() + " for instance " + _instanceId);
} }
else else
{ {
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(nextAuction), Math.max(nextAuction.getStartingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(nextAuction), Math.max(nextAuction.getStartingTime() - System.currentTimeMillis(), 0)));
LOGGER.info(getClass().getSimpleName() + ": Schedule next auction " + nextAuction.getAuctionId() + " on " + DATE_FORMAT.format(new Date(nextAuction.getStartingTime())) + " for instance " + _instanceId); LOGGER.info(getClass().getSimpleName() + ": Schedule next auction " + nextAuction.getAuctionId() + " on " + DATE_FORMAT.format(new Date(nextAuction.getStartingTime())) + " for instance " + _instanceId);
} }
} }
@@ -421,7 +421,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() == ItemAuctionExtendState.INITIAL) if (_auction.getScheduledAuctionEndingExtendState() == ItemAuctionExtendState.INITIAL)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_5_MIN); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_5_MIN);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
break; break;
@@ -431,7 +431,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_3_MIN) if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_3_MIN)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_3_MIN); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_3_MIN);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
break; break;
@@ -441,7 +441,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B) if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
break; break;
@@ -451,7 +451,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A) if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
} }
@@ -545,7 +545,7 @@ public class Olympiad extends ListenersContainer
{ {
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis()) // if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
return (_olympiadEnd - Calendar.getInstance().getTimeInMillis()); return (_olympiadEnd - Calendar.getInstance().getTimeInMillis());
// return 10L; // return 10;
} }
public void manualSelectHeroes() public void manualSelectHeroes()
@@ -564,7 +564,7 @@ public class Olympiad extends ListenersContainer
{ {
return (_validationEnd - Calendar.getInstance().getTimeInMillis()); return (_validationEnd - Calendar.getInstance().getTimeInMillis());
} }
return 10L; return 10;
} }
public boolean isOlympiadEnd() public boolean isOlympiadEnd()
@@ -662,7 +662,7 @@ public class Olympiad extends ListenersContainer
{ {
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis())) if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
{ {
return 10L; return 10;
} }
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis()) if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
@@ -720,7 +720,7 @@ public class Olympiad extends ListenersContainer
{ {
// if (_compEnd > Calendar.getInstance().getTimeInMillis()) // if (_compEnd > Calendar.getInstance().getTimeInMillis())
return (_compEnd - Calendar.getInstance().getTimeInMillis()); return (_compEnd - Calendar.getInstance().getTimeInMillis());
// return 10L; // return 10;
} }
private long getMillisToWeekChange() private long getMillisToWeekChange()
@@ -729,7 +729,7 @@ public class Olympiad extends ListenersContainer
{ {
return (_nextWeeklyChange - Calendar.getInstance().getTimeInMillis()); return (_nextWeeklyChange - Calendar.getInstance().getTimeInMillis());
} }
return 10L; return 10;
} }
private void scheduleWeeklyChange() private void scheduleWeeklyChange()
@@ -288,7 +288,7 @@ public final class OlympiadGameTask implements Runnable
case BATTLE_IN_PROGRESS: case BATTLE_IN_PROGRESS:
{ {
_countDown += 1000; _countDown += 1000;
final int remaining = (int) ((Config.ALT_OLY_BATTLE - _countDown) / 1000l); final int remaining = (int) ((Config.ALT_OLY_BATTLE - _countDown) / 1000);
for (int announceTime : BATTLE_END_TIME_SECOND) for (int announceTime : BATTLE_END_TIME_SECOND)
{ {
if (announceTime == remaining) if (announceTime == remaining)
@@ -322,7 +322,7 @@ public final class BuffInfo
// Creates a task that will stop all the effects. // Creates a task that will stop all the effects.
if (_abnormalTime > 0) if (_abnormalTime > 0)
{ {
_scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000L); _scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000);
} }
for (AbstractEffect effect : _effects) for (AbstractEffect effect : _effects)
@@ -449,7 +449,7 @@ public final class BuffInfo
{ {
_scheduledFutureTimeTask.cancel(true); _scheduledFutureTimeTask.cancel(true);
} }
_scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000L); _scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000);
} }
} }
@@ -332,7 +332,7 @@ public final class L2GameClient extends ChannelInboundHandler<L2GameClient>
try (Connection con = DatabaseFactory.getInstance().getConnection(); try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?")) PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
{ {
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
ps2.setInt(2, objectId); ps2.setInt(2, objectId);
ps2.execute(); ps2.execute();
} }
@@ -82,13 +82,13 @@ public final class AllyDismiss implements IClientIncomingPacket
} }
final long currentTime = System.currentTimeMillis(); final long currentTime = System.currentTimeMillis();
leaderClan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED * 86400000L), L2Clan.PENALTY_TYPE_DISMISS_CLAN); // 24*60*60*1000 = 86400000 leaderClan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED * 86400000), L2Clan.PENALTY_TYPE_DISMISS_CLAN); // 24*60*60*1000 = 86400000
leaderClan.updateClanInDB(); leaderClan.updateClanInDB();
clan.setAllyId(0); clan.setAllyId(0);
clan.setAllyName(null); clan.setAllyName(null);
clan.changeAllyCrest(0, true); clan.changeAllyCrest(0, true);
clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_DISMISSED * 86400000L), L2Clan.PENALTY_TYPE_CLAN_DISMISSED); // 24*60*60*1000 = 86400000 clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_DISMISSED * 86400000), L2Clan.PENALTY_TYPE_CLAN_DISMISSED); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
player.sendPacket(SystemMessageId.YOU_HAVE_SUCCEEDED_IN_EXPELLING_THE_CLAN); player.sendPacket(SystemMessageId.YOU_HAVE_SUCCEEDED_IN_EXPELLING_THE_CLAN);
@@ -66,7 +66,7 @@ public final class AllyLeave implements IClientIncomingPacket
clan.setAllyId(0); clan.setAllyId(0);
clan.setAllyName(null); clan.setAllyName(null);
clan.changeAllyCrest(0, true); clan.changeAllyCrest(0, true);
clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_LEAVED * 86400000L), L2Clan.PENALTY_TYPE_CLAN_LEAVED); // 24*60*60*1000 = 86400000 clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_LEAVED * 86400000), L2Clan.PENALTY_TYPE_CLAN_LEAVED); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
player.sendPacket(SystemMessageId.YOU_HAVE_WITHDRAWN_FROM_THE_ALLIANCE); player.sendPacket(SystemMessageId.YOU_HAVE_WITHDRAWN_FROM_THE_ALLIANCE);
@@ -82,8 +82,8 @@ public final class RequestOustPledgeMember implements IClientIncomingPacket
} }
// this also updates the database // this also updates the database
clan.removeClanMember(member.getObjectId(), System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.removeClanMember(member.getObjectId(), System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)); // 24*60*60*1000 = 86400000
clan.setCharPenaltyExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.setCharPenaltyExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_S1_HAS_BEEN_EXPELLED); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_S1_HAS_BEEN_EXPELLED);
@@ -64,7 +64,7 @@ public final class RequestWithdrawalPledge implements IClientIncomingPacket
final L2Clan clan = activeChar.getClan(); final L2Clan clan = activeChar.getClan();
clan.removeClanMember(activeChar.getObjectId(), System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.removeClanMember(activeChar.getObjectId(), System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)); // 24*60*60*1000 = 86400000
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_WITHDRAWN_FROM_THE_CLAN); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_WITHDRAWN_FROM_THE_CLAN);
sm.addString(activeChar.getName()); sm.addString(activeChar.getName());
@@ -291,8 +291,8 @@ public final class UseItem implements IClientIncomingPacket
private void reuseData(L2PcInstance activeChar, L2ItemInstance item, long remainingTime) private void reuseData(L2PcInstance activeChar, L2ItemInstance item, long remainingTime)
{ {
final int hours = (int) (remainingTime / 3600000L); final int hours = (int) (remainingTime / 3600000);
final int minutes = (int) (remainingTime % 3600000L) / 60000; final int minutes = (int) (remainingTime % 3600000) / 60000;
final int seconds = (int) ((remainingTime / 1000) % 60); final int seconds = (int) ((remainingTime / 1000) % 60);
final SystemMessage sm; final SystemMessage sm;
if (hours > 0) if (hours > 0)
@@ -103,7 +103,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
packet.writeD(0x02); // if 1, korean client packet.writeD(0x02); // if 1, korean client
packet.writeC(0x00); // if 1 suggest premium account packet.writeC(0x00); // if 1 suggest premium account
long lastAccess = 0L; long lastAccess = 0;
if (_activeId == -1) if (_activeId == -1)
{ {
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
@@ -28,7 +28,7 @@ public class ExPutShapeShiftingTargetItemResult implements IClientOutgoingPacket
public static int RESULT_FAILED = 0x00; public static int RESULT_FAILED = 0x00;
public static int RESULT_SUCCESS = 0x01; public static int RESULT_SUCCESS = 0x01;
public static ExPutShapeShiftingTargetItemResult FAILED = new ExPutShapeShiftingTargetItemResult(RESULT_FAILED, 0L); public static ExPutShapeShiftingTargetItemResult FAILED = new ExPutShapeShiftingTargetItemResult(RESULT_FAILED, 0);
private final int _resultId; private final int _resultId;
private final long _price; private final long _price;
@@ -265,7 +265,7 @@ public final class TaskManager
} }
case TYPE_GLOBAL_TASK: case TYPE_GLOBAL_TASK:
{ {
interval = Long.valueOf(task.getParams()[0]) * 86400000L; interval = Long.valueOf(task.getParams()[0]) * 86400000;
final String[] hour = task.getParams()[1].split(":"); final String[] hour = task.getParams()[1].split(":");
if (hour.length != 3) if (hour.length != 3)
@@ -127,7 +127,7 @@ public final class DenOfEvil extends AbstractNpcAI
zone.addSkill(skillId, skillLevel + 1); zone.addSkill(skillId, skillLevel + 1);
if (skillLevel == 3) // 3+1=4 if (skillLevel == 3) // 3+1=4
{ {
ThreadPool.schedule(new KashaDestruction(zone), 2 * 60 * 1000l); ThreadPool.schedule(new KashaDestruction(zone), 2 * 60 * 1000);
zone.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.DEFEAT_KASHA_S_EYES_TO_LIFT_THE_GREAT_CURSE)); zone.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.DEFEAT_KASHA_S_EYES_TO_LIFT_THE_GREAT_CURSE));
} }
else if (skillLevel == 2) else if (skillLevel == 2)
@@ -128,12 +128,12 @@ public final class Parade extends AbstractNpcAI
public Parade() public Parade()
{ {
// Starts at 8:00 and repeats every 6 hours. // Starts at 8:00 and repeats every 6 hours.
final long diff = timeLeftMilli(8, 0, 0), cycle = 3600000L; final long diff = timeLeftMilli(8, 0, 0), cycle = 3600000;
ThreadPool.scheduleAtFixedRate(new Start(), diff, cycle); ThreadPool.scheduleAtFixedRate(new Start(), diff, cycle);
// Test - Starts 3 minutes after server startup and repeats every 20 minutes. // Test - Starts 3 minutes after server startup and repeats every 20 minutes.
// final long diff = timeLeftMilli(8, 0, 0), cycle = 600000L; // final long diff = timeLeftMilli(8, 0, 0), cycle = 600000;
// ThreadPoolManager.scheduleAtFixedRate(new Start(), 180000L, cycle); // ThreadPoolManager.scheduleAtFixedRate(new Start(), 180000, cycle);
LOGGER.info("Fantasy Isle: Parade starting at " + new SimpleDateFormat("yyyy/MM/dd HH:mm").format(System.currentTimeMillis() + diff) + " and is scheduled each next " + (cycle / 3600000) + " hours."); LOGGER.info("Fantasy Isle: Parade starting at " + new SimpleDateFormat("yyyy/MM/dd HH:mm").format(System.currentTimeMillis() + diff) + " and is scheduled each next " + (cycle / 3600000) + " hours.");
} }
@@ -164,7 +164,7 @@ public final class Parade extends AbstractNpcAI
dd += 86400; dd += 86400;
} }
return (dd * 1000L) / 6L; return (dd * 1000) / 6;
} }
class Start implements Runnable class Start implements Runnable
@@ -114,7 +114,7 @@ public final class TrainingCamp extends AbstractNpcAI
// @Sdw: Here we are supposed to send ExUserInfoEquipSlot with a fake equip of a SLS, feels ugly to me, not doing it. // @Sdw: Here we are supposed to send ExUserInfoEquipSlot with a fake equip of a SLS, feels ugly to me, not doing it.
player.setTraingCampInfo(new TrainingHolder(player.getObjectId(), player.getClassIndex(), player.getLevel(), System.currentTimeMillis(), -1)); player.setTraingCampInfo(new TrainingHolder(player.getObjectId(), player.getClassIndex(), player.getLevel(), System.currentTimeMillis(), -1));
final long timeRemaining = Config.TRAINING_CAMP_MAX_DURATION - trainingCampDuration; final long timeRemaining = Config.TRAINING_CAMP_MAX_DURATION - trainingCampDuration;
player.sendPacket(new ExTrainingZone_Admission(player.getLevel(), 0L, timeRemaining)); player.sendPacket(new ExTrainingZone_Admission(player.getLevel(), 0, timeRemaining));
startQuestTimer("finish", TimeUnit.SECONDS.toMillis(timeRemaining), npc, player); startQuestTimer("finish", TimeUnit.SECONDS.toMillis(timeRemaining), npc, player);
} }
else else
@@ -213,7 +213,7 @@ public class AdminCursedWeapons implements IAdminCommandHandler
{ {
activeChar.addItem("AdminCursedWeaponAdd", id, 1, activeChar, true); activeChar.addItem("AdminCursedWeaponAdd", id, 1, activeChar, true);
} }
cw.setEndTime(System.currentTimeMillis() + (cw.getDuration() * 60000L)); cw.setEndTime(System.currentTimeMillis() + (cw.getDuration() * 60000));
cw.reActivate(); cw.reActivate();
} }
} }
@@ -201,8 +201,8 @@ public class ItemSkillsTemplate implements IItemHandler
{ {
if (!isAvailable) if (!isAvailable)
{ {
final int hours = (int) (remainingTime / 3600000L); final int hours = (int) (remainingTime / 3600000);
final int minutes = (int) (remainingTime % 3600000L) / 60000; final int minutes = (int) (remainingTime % 3600000) / 60000;
final int seconds = (int) ((remainingTime / 1000) % 60); final int seconds = (int) ((remainingTime / 1000) % 60);
SystemMessage sm = null; SystemMessage sm = null;
if (hours > 0) if (hours > 0)
@@ -409,7 +409,7 @@ public final class ChamberOfDelusion extends AbstractInstance
protected void scheduleRoomChange(Instance world, boolean bossRoom) protected void scheduleRoomChange(Instance world, boolean bossRoom)
{ {
// Schedule next room change only if remaining time is enough // Schedule next room change only if remaining time is enough
final long nextInterval = (bossRoom) ? 60000L : (ROOM_CHANGE_INTERVAL + getRandom(ROOM_CHANGE_RANDOM_TIME)) * 1000L; final long nextInterval = (bossRoom) ? 60000 : (ROOM_CHANGE_INTERVAL + getRandom(ROOM_CHANGE_RANDOM_TIME)) * 1000;
if (world.getRemainingTime() > nextInterval) if (world.getRemainingTime() > nextInterval)
{ {
final ScheduledFuture<?> roomChangeTask = ThreadPool.schedule(() -> final ScheduledFuture<?> roomChangeTask = ThreadPool.schedule(() ->
@@ -521,7 +521,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
for (int i = 0; i < npcInfo[4]; i++) for (int i = 0; i < npcInfo[4]; i++)
{ {
final L2Npc mob = addSpawn(npcInfo[5], npc.getX() + getRandom(-150, 150), npc.getY() + getRandom(-150, 150), npc.getZ(), npc.getHeading(), true, 60000L, false); final L2Npc mob = addSpawn(npcInfo[5], npc.getX() + getRandom(-150, 150), npc.getY() + getRandom(-150, 150), npc.getZ(), npc.getHeading(), true, 60000, false);
mob.setRunning(); mob.setRunning();
((L2Attackable) mob).addDamageHate(attacker, 0, 500); ((L2Attackable) mob).addDamageHate(attacker, 0, 500);
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker); mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
@@ -607,7 +607,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
addSpawn(SACRIFICE_OF_THE_SACRIFICED, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000L, false); addSpawn(SACRIFICE_OF_THE_SACRIFICED, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000, false);
} }
} }
break; break;
@@ -618,7 +618,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
addSpawn(HARIT_LIZARDMAN_ZEALOT, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000L, false); addSpawn(HARIT_LIZARDMAN_ZEALOT, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000, false);
} }
} }
break; break;
@@ -628,7 +628,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
if (qs.isCond(4) && (getRandom(100) < 50) && !hasQuestItems(player, THIRD_FRAGMENT_OF_ABYSS_JEWEL)) if (qs.isCond(4) && (getRandom(100) < 50) && !hasQuestItems(player, THIRD_FRAGMENT_OF_ABYSS_JEWEL))
{ {
addSpawn(ABYSSAL_JEWEL_3, npc.getX() + getRandom(-50, 50), npc.getY() + getRandom(-50, 50), npc.getZ(), npc.getHeading(), true, 60000L, false); addSpawn(ABYSSAL_JEWEL_3, npc.getX() + getRandom(-50, 50), npc.getY() + getRandom(-50, 50), npc.getZ(), npc.getHeading(), true, 60000, false);
} }
break; break;
} }
@@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
public class WarehouseCacheManager public class WarehouseCacheManager
{ {
protected final Map<L2PcInstance, Long> _cachedWh = new ConcurrentHashMap<>(); protected final Map<L2PcInstance, Long> _cachedWh = new ConcurrentHashMap<>();
protected final long _cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000L; protected final long _cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000;
protected WarehouseCacheManager() protected WarehouseCacheManager()
{ {
@@ -169,7 +169,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", npc.getCurrentHp()); info.set("currentHP", npc.getCurrentHp());
info.set("currentMP", npc.getCurrentMp()); info.set("currentMP", npc.getCurrentMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
_storedInfo.put(npcId, info); _storedInfo.put(npcId, info);
_npcs.put(npcId, npc); _npcs.put(npcId, npc);
@@ -219,7 +219,7 @@ public class DBSpawnManager
info.set("currentHP", npc.getCurrentHp()); info.set("currentHP", npc.getCurrentHp());
info.set("currentMP", npc.getCurrentMp()); info.set("currentMP", npc.getCurrentMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
} }
_storedInfo.put(npc.getId(), info); _storedInfo.put(npc.getId(), info);
} }
@@ -248,7 +248,7 @@ public class DBSpawnManager
SpawnTable.getInstance().addNewSpawn(spawn, false); SpawnTable.getInstance().addNewSpawn(spawn, false);
if ((respawnTime == 0L) || (time > respawnTime)) if ((respawnTime == 0) || (time > respawnTime))
{ {
final L2Npc npc = spawn.doSpawn(); final L2Npc npc = spawn.doSpawn();
if (npc != null) if (npc != null)
@@ -262,7 +262,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", currentHP); info.set("currentHP", currentHP);
info.set("currentMP", currentMP); info.set("currentMP", currentMP);
info.set("respawnTime", 0L); info.set("respawnTime", 0);
_storedInfo.put(npcId, info); _storedInfo.put(npcId, info);
} }
@@ -324,7 +324,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", npc.getMaxHp()); info.set("currentHP", npc.getMaxHp());
info.set("currentMP", npc.getMaxMp()); info.set("currentMP", npc.getMaxMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
_npcs.put(npcId, npc); _npcs.put(npcId, npc);
_storedInfo.put(npcId, info); _storedInfo.put(npcId, info);
@@ -541,7 +541,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", npc.getCurrentHp()); info.set("currentHP", npc.getCurrentHp());
info.set("currentMP", npc.getCurrentMp()); info.set("currentMP", npc.getCurrentMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
npc.setDBStatus(DBStatusType.ALIVE); npc.setDBStatus(DBStatusType.ALIVE);
@@ -446,7 +446,7 @@ public final class WalkingManager implements IGameXmlReader
npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText()); npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText());
} }
ThreadPool.schedule(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000L)); ThreadPool.schedule(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000));
} }
} }
} }
@@ -35,8 +35,8 @@ public class CharSelectInfoPackage
private int _race = 0; private int _race = 0;
private int _classId = 0; private int _classId = 0;
private int _baseClassId = 0; private int _baseClassId = 0;
private long _deleteTimer = 0L; private long _deleteTimer = 0;
private long _lastAccess = 0L; private long _lastAccess = 0;
private int _face = 0; private int _face = 0;
private int _hairStyle = 0; private int _hairStyle = 0;
private int _hairColor = 0; private int _hairColor = 0;
@@ -63,7 +63,7 @@ public class CreatureContainer
{ {
if ((_task == null) || _task.isDone()) if ((_task == null) || _task.isDone())
{ {
_task = ThreadPool.scheduleAtFixedRate(this::update, 1000L, 1000L); _task = ThreadPool.scheduleAtFixedRate(this::update, 1000, 1000);
} }
} }
@@ -374,7 +374,7 @@ public class CursedWeapon implements INamable
} }
else else
{ {
_removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000L, _durationLost * 12000L); _removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000, _durationLost * 12000);
} }
} }
@@ -387,8 +387,8 @@ public class CursedWeapon implements INamable
dropIt(attackable, player); dropIt(attackable, player);
// Start the Life Task // Start the Life Task
_endTime = System.currentTimeMillis() + (_duration * 60000L); _endTime = System.currentTimeMillis() + (_duration * 60000);
_removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000L, _durationLost * 12000L); _removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000, _durationLost * 12000);
return true; return true;
} }
@@ -534,7 +534,7 @@ public class CursedWeapon implements INamable
} }
} }
// Reduce time-to-live // Reduce time-to-live
_endTime -= _durationLost * 60000L; _endTime -= _durationLost * 60000;
saveData(); saveData();
} }
@@ -497,7 +497,7 @@ public class L2Clan implements IIdentifiable, INamable
if (player.isClanLeader()) if (player.isClanLeader())
{ {
SiegeManager.getInstance().removeSiegeSkills(player); SiegeManager.getInstance().removeSiegeSkills(player);
player.setClanCreateExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 player.setClanCreateExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
} }
// remove Clan skills from Player // remove Clan skills from Player
removeSkillEffects(player); removeSkillEffects(player);
@@ -528,7 +528,7 @@ public class L2Clan implements IIdentifiable, INamable
} }
else else
{ {
removeMemberInDatabase(exMember, clanJoinExpiryTime, getLeaderId() == objectId ? System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000L) : 0); removeMemberInDatabase(exMember, clanJoinExpiryTime, getLeaderId() == objectId ? System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000) : 0);
} }
// Notify to scripts // Notify to scripts
@@ -1089,7 +1089,7 @@ public class L2Clan implements IIdentifiable, INamable
setAllyPenaltyExpiryTime(0, 0); setAllyPenaltyExpiryTime(0, 0);
} }
setCharPenaltyExpiryTime(clanData.getLong("char_penalty_expiry_time")); setCharPenaltyExpiryTime(clanData.getLong("char_penalty_expiry_time"));
if ((getCharPenaltyExpiryTime() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)) < System.currentTimeMillis()) // 24*60*60*1000 = 86400000 if ((getCharPenaltyExpiryTime() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)) < System.currentTimeMillis()) // 24*60*60*1000 = 86400000
{ {
setCharPenaltyExpiryTime(0); setCharPenaltyExpiryTime(0);
} }
@@ -2472,7 +2472,7 @@ public class L2Clan implements IIdentifiable, INamable
setAllyId(0); setAllyId(0);
setAllyName(null); setAllyName(null);
changeAllyCrest(0, false); changeAllyCrest(0, false);
setAllyPenaltyExpiryTime(currentTime + (Config.ALT_CREATE_ALLY_DAYS_WHEN_DISSOLVED * 86400000L), PENALTY_TYPE_DISSOLVE_ALLY); // 24*60*60*1000 = 86400000 setAllyPenaltyExpiryTime(currentTime + (Config.ALT_CREATE_ALLY_DAYS_WHEN_DISSOLVED * 86400000), PENALTY_TYPE_DISSOLVE_ALLY); // 24*60*60*1000 = 86400000
updateClanInDB(); updateClanInDB();
} }
@@ -71,7 +71,7 @@ public enum PcCondOverride
public static long getAllExceptionsMask() public static long getAllExceptionsMask()
{ {
long result = 0L; long result = 0;
for (PcCondOverride ex : values()) for (PcCondOverride ex : values())
{ {
result |= ex.getMask(); result |= ex.getMask();
@@ -228,7 +228,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
private Team _team = Team.NONE; private Team _team = Team.NONE;
protected long _exceptions = 0L; protected long _exceptions = 0;
private boolean _lethalable = true; private boolean _lethalable = true;
@@ -10030,7 +10030,7 @@ public final class L2PcInstance extends L2Playable
{ {
if (_taskRentPet == null) if (_taskRentPet == null)
{ {
_taskRentPet = ThreadPool.scheduleAtFixedRate(new RentPetTask(this), seconds * 1000L, seconds * 1000L); _taskRentPet = ThreadPool.scheduleAtFixedRate(new RentPetTask(this), seconds * 1000, seconds * 1000);
} }
} }
@@ -13981,7 +13981,7 @@ public final class L2PcInstance extends L2Playable
stopOnlineTimeUpdateTask(); stopOnlineTimeUpdateTask();
} }
_onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000L, 60 * 1000L); _onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000, 60 * 1000);
} }
private void updateOnlineTime() private void updateOnlineTime()
@@ -14059,7 +14059,7 @@ public final class L2PcInstance extends L2Playable
public long getTraingCampDuration() public long getTraingCampDuration()
{ {
return getAccountVariables().getLong(TRAINING_CAMP_DURATION, 0L); return getAccountVariables().getLong(TRAINING_CAMP_DURATION, 0);
} }
public void setTraingCampDuration(long duration) public void setTraingCampDuration(long duration)
@@ -350,7 +350,7 @@ public class L2VillageMasterInstance extends L2NpcInstance
return; return;
} }
clan.setDissolvingExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_DISSOLVE_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.setDissolvingExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_DISSOLVE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
// The clan leader should take the XP penalty of a full death. // The clan leader should take the XP penalty of a full death.
@@ -51,7 +51,7 @@ public class FlyMoveStartTask implements Runnable
if (!_player.hasRequest(SayuneRequest.class)) if (!_player.hasRequest(SayuneRequest.class))
{ {
_player.sendPacket(ExNotifyFlyMoveStart.STATIC_PACKET); _player.sendPacket(ExNotifyFlyMoveStart.STATIC_PACKET);
ThreadPool.schedule(this, 1000L); ThreadPool.schedule(this, 1000);
} }
} }
} }
@@ -581,14 +581,14 @@ public final class Fort extends AbstractResidence
setOwnerClan(clan); setOwnerClan(clan);
final int runCount = getOwnedTime() / (Config.FS_UPDATE_FRQ * 60); final int runCount = getOwnedTime() / (Config.FS_UPDATE_FRQ * 60);
long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis(); long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis();
while (initial > (Config.FS_UPDATE_FRQ * 60000L)) while (initial > (Config.FS_UPDATE_FRQ * 60000))
{ {
initial -= Config.FS_UPDATE_FRQ * 60000L; initial -= Config.FS_UPDATE_FRQ * 60000;
} }
initial = (Config.FS_UPDATE_FRQ * 60000L) - initial; initial = (Config.FS_UPDATE_FRQ * 60000) - initial;
if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600))) if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600)))
{ {
_FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.PERIODIC_UPDATE), initial, Config.FS_UPDATE_FRQ * 60000L); // Schedule owner tasks to start running _FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.PERIODIC_UPDATE), initial, Config.FS_UPDATE_FRQ * 60000); // Schedule owner tasks to start running
if (Config.FS_MAX_OWN_TIME > 0) if (Config.FS_MAX_OWN_TIME > 0)
{ {
_FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owener _FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owener
@@ -822,10 +822,10 @@ public final class Fort extends AbstractResidence
{ {
_FortUpdater[1].cancel(false); _FortUpdater[1].cancel(false);
} }
_FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.PERIODIC_UPDATE), Config.FS_UPDATE_FRQ * 60000L, Config.FS_UPDATE_FRQ * 60000L); // Schedule owner tasks to start running _FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.PERIODIC_UPDATE), Config.FS_UPDATE_FRQ * 60000, Config.FS_UPDATE_FRQ * 60000); // Schedule owner tasks to start running
if (Config.FS_MAX_OWN_TIME > 0) if (Config.FS_MAX_OWN_TIME > 0)
{ {
_FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owener _FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owner
} }
} }
else else
@@ -925,7 +925,7 @@ public final class Fort extends AbstractResidence
public final int getTimeTillRebelArmy() public final int getTimeTillRebelArmy()
{ {
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000)) - System.currentTimeMillis()) / 1000);
} }
public final long getTimeTillNextFortUpdate() public final long getTimeTillNextFortUpdate()
@@ -274,7 +274,7 @@ public class FortSiege implements Siegable
unspawnSiegeGuard(); // Remove all spawned siege guard from this fort unspawnSiegeGuard(); // Remove all spawned siege guard from this fort
getFort().resetDoors(); // Respawn door to fort getFort().resetDoors(); // Respawn door to fort
ThreadPool.schedule(new ScheduleSuspiciousMerchantSpawn(), FortSiegeManager.getInstance().getSuspiciousMerchantRespawnDelay() * 60 * 1000L); // Prepare 3hr task for suspicious merchant respawn ThreadPool.schedule(new ScheduleSuspiciousMerchantSpawn(), FortSiegeManager.getInstance().getSuspiciousMerchantRespawnDelay() * 60 * 1000); // Prepare 3hr task for suspicious merchant respawn
setSiegeDateTime(true); // store suspicious merchant spawn in DB setSiegeDateTime(true); // store suspicious merchant spawn in DB
if (_siegeEnd != null) if (_siegeEnd != null)
@@ -336,7 +336,7 @@ public class FortSiege implements Siegable
getFort().getZone().updateZoneStatusForCharactersInside(); getFort().getZone().updateZoneStatusForCharactersInside();
// Schedule a task to prepare auto siege end // Schedule a task to prepare auto siege end
_siegeEnd = ThreadPool.schedule(new ScheduleEndSiegeTask(), FortSiegeManager.getInstance().getSiegeLength() * 60 * 1000L); // Prepare auto end task _siegeEnd = ThreadPool.schedule(new ScheduleEndSiegeTask(), FortSiegeManager.getInstance().getSiegeLength() * 60 * 1000); // Prepare auto end task
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_FORTRESS_BATTLE_S1_HAS_BEGUN); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_FORTRESS_BATTLE_S1_HAS_BEGUN);
sm.addCastleId(getFort().getResidenceId()); sm.addCastleId(getFort().getResidenceId());
@@ -680,7 +680,7 @@ public class FortSiege implements Siegable
else if (_siegeRestore == null) else if (_siegeRestore == null)
{ {
getFort().getSiege().announceToPlayer(SystemMessage.getSystemMessage(SystemMessageId.THE_BARRACKS_HAVE_BEEN_SEIZED)); getFort().getSiege().announceToPlayer(SystemMessage.getSystemMessage(SystemMessageId.THE_BARRACKS_HAVE_BEEN_SEIZED));
_siegeRestore = ThreadPool.schedule(new ScheduleSiegeRestore(), FortSiegeManager.getInstance().getCountDownLength() * 60 * 1000L); _siegeRestore = ThreadPool.schedule(new ScheduleSiegeRestore(), FortSiegeManager.getInstance().getCountDownLength() * 60 * 1000);
} }
else else
{ {
@@ -181,12 +181,12 @@ public final class ItemAuction
public final long getStartingTimeRemaining() public final long getStartingTimeRemaining()
{ {
return Math.max(getEndingTime() - System.currentTimeMillis(), 0L); return Math.max(getEndingTime() - System.currentTimeMillis(), 0);
} }
public final long getFinishingTimeRemaining() public final long getFinishingTimeRemaining()
{ {
return Math.max(getEndingTime() - System.currentTimeMillis(), 0L); return Math.max(getEndingTime() - System.currentTimeMillis(), 0);
} }
public final void storeMe() public final void storeMe()
@@ -325,17 +325,17 @@ public final class ItemAuctionInstance
{ {
if (currentAuction.getAuctionState() == ItemAuctionState.STARTED) if (currentAuction.getAuctionState() == ItemAuctionState.STARTED)
{ {
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getEndingTime() - System.currentTimeMillis(), 0)));
} }
else else
{ {
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getStartingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getStartingTime() - System.currentTimeMillis(), 0)));
} }
LOGGER.info(getClass().getSimpleName() + ": Schedule current auction " + currentAuction.getAuctionId() + " for instance " + _instanceId); LOGGER.info(getClass().getSimpleName() + ": Schedule current auction " + currentAuction.getAuctionId() + " for instance " + _instanceId);
} }
else else
{ {
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(nextAuction), Math.max(nextAuction.getStartingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(nextAuction), Math.max(nextAuction.getStartingTime() - System.currentTimeMillis(), 0)));
LOGGER.info(getClass().getSimpleName() + ": Schedule next auction " + nextAuction.getAuctionId() + " on " + DATE_FORMAT.format(new Date(nextAuction.getStartingTime())) + " for instance " + _instanceId); LOGGER.info(getClass().getSimpleName() + ": Schedule next auction " + nextAuction.getAuctionId() + " on " + DATE_FORMAT.format(new Date(nextAuction.getStartingTime())) + " for instance " + _instanceId);
} }
} }
@@ -421,7 +421,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() == ItemAuctionExtendState.INITIAL) if (_auction.getScheduledAuctionEndingExtendState() == ItemAuctionExtendState.INITIAL)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_5_MIN); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_5_MIN);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
break; break;
@@ -431,7 +431,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_3_MIN) if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_3_MIN)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_3_MIN); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_3_MIN);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
break; break;
@@ -441,7 +441,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B) if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
break; break;
@@ -451,7 +451,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A) if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
} }
@@ -545,7 +545,7 @@ public class Olympiad extends ListenersContainer
{ {
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis()) // if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
return (_olympiadEnd - Calendar.getInstance().getTimeInMillis()); return (_olympiadEnd - Calendar.getInstance().getTimeInMillis());
// return 10L; // return 10;
} }
public void manualSelectHeroes() public void manualSelectHeroes()
@@ -564,7 +564,7 @@ public class Olympiad extends ListenersContainer
{ {
return (_validationEnd - Calendar.getInstance().getTimeInMillis()); return (_validationEnd - Calendar.getInstance().getTimeInMillis());
} }
return 10L; return 10;
} }
public boolean isOlympiadEnd() public boolean isOlympiadEnd()
@@ -662,7 +662,7 @@ public class Olympiad extends ListenersContainer
{ {
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis())) if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
{ {
return 10L; return 10;
} }
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis()) if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
@@ -720,7 +720,7 @@ public class Olympiad extends ListenersContainer
{ {
// if (_compEnd > Calendar.getInstance().getTimeInMillis()) // if (_compEnd > Calendar.getInstance().getTimeInMillis())
return (_compEnd - Calendar.getInstance().getTimeInMillis()); return (_compEnd - Calendar.getInstance().getTimeInMillis());
// return 10L; // return 10;
} }
private long getMillisToWeekChange() private long getMillisToWeekChange()
@@ -729,7 +729,7 @@ public class Olympiad extends ListenersContainer
{ {
return (_nextWeeklyChange - Calendar.getInstance().getTimeInMillis()); return (_nextWeeklyChange - Calendar.getInstance().getTimeInMillis());
} }
return 10L; return 10;
} }
private void scheduleWeeklyChange() private void scheduleWeeklyChange()
@@ -288,7 +288,7 @@ public final class OlympiadGameTask implements Runnable
case BATTLE_IN_PROGRESS: case BATTLE_IN_PROGRESS:
{ {
_countDown += 1000; _countDown += 1000;
final int remaining = (int) ((Config.ALT_OLY_BATTLE - _countDown) / 1000l); final int remaining = (int) ((Config.ALT_OLY_BATTLE - _countDown) / 1000);
for (int announceTime : BATTLE_END_TIME_SECOND) for (int announceTime : BATTLE_END_TIME_SECOND)
{ {
if (announceTime == remaining) if (announceTime == remaining)
@@ -322,7 +322,7 @@ public final class BuffInfo
// Creates a task that will stop all the effects. // Creates a task that will stop all the effects.
if (_abnormalTime > 0) if (_abnormalTime > 0)
{ {
_scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000L); _scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000);
} }
for (AbstractEffect effect : _effects) for (AbstractEffect effect : _effects)
@@ -449,7 +449,7 @@ public final class BuffInfo
{ {
_scheduledFutureTimeTask.cancel(true); _scheduledFutureTimeTask.cancel(true);
} }
_scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000L); _scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000);
} }
} }
@@ -332,7 +332,7 @@ public final class L2GameClient extends ChannelInboundHandler<L2GameClient>
try (Connection con = DatabaseFactory.getInstance().getConnection(); try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?")) PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
{ {
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
ps2.setInt(2, objectId); ps2.setInt(2, objectId);
ps2.execute(); ps2.execute();
} }
@@ -82,13 +82,13 @@ public final class AllyDismiss implements IClientIncomingPacket
} }
final long currentTime = System.currentTimeMillis(); final long currentTime = System.currentTimeMillis();
leaderClan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED * 86400000L), L2Clan.PENALTY_TYPE_DISMISS_CLAN); // 24*60*60*1000 = 86400000 leaderClan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED * 86400000), L2Clan.PENALTY_TYPE_DISMISS_CLAN); // 24*60*60*1000 = 86400000
leaderClan.updateClanInDB(); leaderClan.updateClanInDB();
clan.setAllyId(0); clan.setAllyId(0);
clan.setAllyName(null); clan.setAllyName(null);
clan.changeAllyCrest(0, true); clan.changeAllyCrest(0, true);
clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_DISMISSED * 86400000L), L2Clan.PENALTY_TYPE_CLAN_DISMISSED); // 24*60*60*1000 = 86400000 clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_DISMISSED * 86400000), L2Clan.PENALTY_TYPE_CLAN_DISMISSED); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
player.sendPacket(SystemMessageId.YOU_HAVE_SUCCEEDED_IN_EXPELLING_THE_CLAN); player.sendPacket(SystemMessageId.YOU_HAVE_SUCCEEDED_IN_EXPELLING_THE_CLAN);
@@ -66,7 +66,7 @@ public final class AllyLeave implements IClientIncomingPacket
clan.setAllyId(0); clan.setAllyId(0);
clan.setAllyName(null); clan.setAllyName(null);
clan.changeAllyCrest(0, true); clan.changeAllyCrest(0, true);
clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_LEAVED * 86400000L), L2Clan.PENALTY_TYPE_CLAN_LEAVED); // 24*60*60*1000 = 86400000 clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_LEAVED * 86400000), L2Clan.PENALTY_TYPE_CLAN_LEAVED); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
player.sendPacket(SystemMessageId.YOU_HAVE_WITHDRAWN_FROM_THE_ALLIANCE); player.sendPacket(SystemMessageId.YOU_HAVE_WITHDRAWN_FROM_THE_ALLIANCE);
@@ -82,8 +82,8 @@ public final class RequestOustPledgeMember implements IClientIncomingPacket
} }
// this also updates the database // this also updates the database
clan.removeClanMember(member.getObjectId(), System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.removeClanMember(member.getObjectId(), System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)); // 24*60*60*1000 = 86400000
clan.setCharPenaltyExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.setCharPenaltyExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_S1_HAS_BEEN_EXPELLED); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_S1_HAS_BEEN_EXPELLED);
@@ -64,7 +64,7 @@ public final class RequestWithdrawalPledge implements IClientIncomingPacket
final L2Clan clan = activeChar.getClan(); final L2Clan clan = activeChar.getClan();
clan.removeClanMember(activeChar.getObjectId(), System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.removeClanMember(activeChar.getObjectId(), System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)); // 24*60*60*1000 = 86400000
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_WITHDRAWN_FROM_THE_CLAN); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_WITHDRAWN_FROM_THE_CLAN);
sm.addString(activeChar.getName()); sm.addString(activeChar.getName());
@@ -291,8 +291,8 @@ public final class UseItem implements IClientIncomingPacket
private void reuseData(L2PcInstance activeChar, L2ItemInstance item, long remainingTime) private void reuseData(L2PcInstance activeChar, L2ItemInstance item, long remainingTime)
{ {
final int hours = (int) (remainingTime / 3600000L); final int hours = (int) (remainingTime / 3600000);
final int minutes = (int) (remainingTime % 3600000L) / 60000; final int minutes = (int) (remainingTime % 3600000) / 60000;
final int seconds = (int) ((remainingTime / 1000) % 60); final int seconds = (int) ((remainingTime / 1000) % 60);
final SystemMessage sm; final SystemMessage sm;
if (hours > 0) if (hours > 0)
@@ -102,7 +102,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
packet.writeD(0x02); // if 1, korean client packet.writeD(0x02); // if 1, korean client
packet.writeC(0x00); // if 1 suggest premium account packet.writeC(0x00); // if 1 suggest premium account
long lastAccess = 0L; long lastAccess = 0;
if (_activeId == -1) if (_activeId == -1)
{ {
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
@@ -28,7 +28,7 @@ public class ExPutShapeShiftingTargetItemResult implements IClientOutgoingPacket
public static int RESULT_FAILED = 0x00; public static int RESULT_FAILED = 0x00;
public static int RESULT_SUCCESS = 0x01; public static int RESULT_SUCCESS = 0x01;
public static ExPutShapeShiftingTargetItemResult FAILED = new ExPutShapeShiftingTargetItemResult(RESULT_FAILED, 0L); public static ExPutShapeShiftingTargetItemResult FAILED = new ExPutShapeShiftingTargetItemResult(RESULT_FAILED, 0);
private final int _resultId; private final int _resultId;
private final long _price; private final long _price;
@@ -265,7 +265,7 @@ public final class TaskManager
} }
case TYPE_GLOBAL_TASK: case TYPE_GLOBAL_TASK:
{ {
interval = Long.valueOf(task.getParams()[0]) * 86400000L; interval = Long.valueOf(task.getParams()[0]) * 86400000;
final String[] hour = task.getParams()[1].split(":"); final String[] hour = task.getParams()[1].split(":");
if (hour.length != 3) if (hour.length != 3)
@@ -127,7 +127,7 @@ public final class DenOfEvil extends AbstractNpcAI
zone.addSkill(skillId, skillLevel + 1); zone.addSkill(skillId, skillLevel + 1);
if (skillLevel == 3) // 3+1=4 if (skillLevel == 3) // 3+1=4
{ {
ThreadPool.schedule(new KashaDestruction(zone), 2 * 60 * 1000l); ThreadPool.schedule(new KashaDestruction(zone), 2 * 60 * 1000);
zone.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.DEFEAT_KASHA_S_EYES_TO_LIFT_THE_GREAT_CURSE)); zone.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.DEFEAT_KASHA_S_EYES_TO_LIFT_THE_GREAT_CURSE));
} }
else if (skillLevel == 2) else if (skillLevel == 2)
@@ -128,12 +128,12 @@ public final class Parade extends AbstractNpcAI
public Parade() public Parade()
{ {
// Starts at 8:00 and repeats every 6 hours. // Starts at 8:00 and repeats every 6 hours.
final long diff = timeLeftMilli(8, 0, 0), cycle = 3600000L; final long diff = timeLeftMilli(8, 0, 0), cycle = 3600000;
ThreadPool.scheduleAtFixedRate(new Start(), diff, cycle); ThreadPool.scheduleAtFixedRate(new Start(), diff, cycle);
// Test - Starts 3 minutes after server startup and repeats every 20 minutes. // Test - Starts 3 minutes after server startup and repeats every 20 minutes.
// final long diff = timeLeftMilli(8, 0, 0), cycle = 600000L; // final long diff = timeLeftMilli(8, 0, 0), cycle = 600000;
// ThreadPoolManager.scheduleAtFixedRate(new Start(), 180000L, cycle); // ThreadPoolManager.scheduleAtFixedRate(new Start(), 180000, cycle);
LOGGER.info("Fantasy Isle: Parade starting at " + new SimpleDateFormat("yyyy/MM/dd HH:mm").format(System.currentTimeMillis() + diff) + " and is scheduled each next " + (cycle / 3600000) + " hours."); LOGGER.info("Fantasy Isle: Parade starting at " + new SimpleDateFormat("yyyy/MM/dd HH:mm").format(System.currentTimeMillis() + diff) + " and is scheduled each next " + (cycle / 3600000) + " hours.");
} }
@@ -164,7 +164,7 @@ public final class Parade extends AbstractNpcAI
dd += 86400; dd += 86400;
} }
return (dd * 1000L) / 6L; return (dd * 1000) / 6;
} }
class Start implements Runnable class Start implements Runnable
@@ -114,7 +114,7 @@ public final class TrainingCamp extends AbstractNpcAI
// @Sdw: Here we are supposed to send ExUserInfoEquipSlot with a fake equip of a SLS, feels ugly to me, not doing it. // @Sdw: Here we are supposed to send ExUserInfoEquipSlot with a fake equip of a SLS, feels ugly to me, not doing it.
player.setTraingCampInfo(new TrainingHolder(player.getObjectId(), player.getClassIndex(), player.getLevel(), System.currentTimeMillis(), -1)); player.setTraingCampInfo(new TrainingHolder(player.getObjectId(), player.getClassIndex(), player.getLevel(), System.currentTimeMillis(), -1));
final long timeRemaining = Config.TRAINING_CAMP_MAX_DURATION - trainingCampDuration; final long timeRemaining = Config.TRAINING_CAMP_MAX_DURATION - trainingCampDuration;
player.sendPacket(new ExTrainingZone_Admission(player.getLevel(), 0L, timeRemaining)); player.sendPacket(new ExTrainingZone_Admission(player.getLevel(), 0, timeRemaining));
startQuestTimer("finish", TimeUnit.SECONDS.toMillis(timeRemaining), npc, player); startQuestTimer("finish", TimeUnit.SECONDS.toMillis(timeRemaining), npc, player);
} }
else else
@@ -213,7 +213,7 @@ public class AdminCursedWeapons implements IAdminCommandHandler
{ {
activeChar.addItem("AdminCursedWeaponAdd", id, 1, activeChar, true); activeChar.addItem("AdminCursedWeaponAdd", id, 1, activeChar, true);
} }
cw.setEndTime(System.currentTimeMillis() + (cw.getDuration() * 60000L)); cw.setEndTime(System.currentTimeMillis() + (cw.getDuration() * 60000));
cw.reActivate(); cw.reActivate();
} }
} }
@@ -201,8 +201,8 @@ public class ItemSkillsTemplate implements IItemHandler
{ {
if (!isAvailable) if (!isAvailable)
{ {
final int hours = (int) (remainingTime / 3600000L); final int hours = (int) (remainingTime / 3600000);
final int minutes = (int) (remainingTime % 3600000L) / 60000; final int minutes = (int) (remainingTime % 3600000) / 60000;
final int seconds = (int) ((remainingTime / 1000) % 60); final int seconds = (int) ((remainingTime / 1000) % 60);
SystemMessage sm = null; SystemMessage sm = null;
if (hours > 0) if (hours > 0)
@@ -409,7 +409,7 @@ public final class ChamberOfDelusion extends AbstractInstance
protected void scheduleRoomChange(Instance world, boolean bossRoom) protected void scheduleRoomChange(Instance world, boolean bossRoom)
{ {
// Schedule next room change only if remaining time is enough // Schedule next room change only if remaining time is enough
final long nextInterval = (bossRoom) ? 60000L : (ROOM_CHANGE_INTERVAL + getRandom(ROOM_CHANGE_RANDOM_TIME)) * 1000L; final long nextInterval = (bossRoom) ? 60000 : (ROOM_CHANGE_INTERVAL + getRandom(ROOM_CHANGE_RANDOM_TIME)) * 1000;
if (world.getRemainingTime() > nextInterval) if (world.getRemainingTime() > nextInterval)
{ {
final ScheduledFuture<?> roomChangeTask = ThreadPool.schedule(() -> final ScheduledFuture<?> roomChangeTask = ThreadPool.schedule(() ->
@@ -521,7 +521,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
for (int i = 0; i < npcInfo[4]; i++) for (int i = 0; i < npcInfo[4]; i++)
{ {
final L2Npc mob = addSpawn(npcInfo[5], npc.getX() + getRandom(-150, 150), npc.getY() + getRandom(-150, 150), npc.getZ(), npc.getHeading(), true, 60000L, false); final L2Npc mob = addSpawn(npcInfo[5], npc.getX() + getRandom(-150, 150), npc.getY() + getRandom(-150, 150), npc.getZ(), npc.getHeading(), true, 60000, false);
mob.setRunning(); mob.setRunning();
((L2Attackable) mob).addDamageHate(attacker, 0, 500); ((L2Attackable) mob).addDamageHate(attacker, 0, 500);
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker); mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
@@ -607,7 +607,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
addSpawn(SACRIFICE_OF_THE_SACRIFICED, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000L, false); addSpawn(SACRIFICE_OF_THE_SACRIFICED, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000, false);
} }
} }
break; break;
@@ -618,7 +618,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
addSpawn(HARIT_LIZARDMAN_ZEALOT, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000L, false); addSpawn(HARIT_LIZARDMAN_ZEALOT, npc.getX() + getRandom(-100, 100), npc.getY() + getRandom(-100, 100), npc.getZ(), npc.getHeading(), true, 60000, false);
} }
} }
break; break;
@@ -628,7 +628,7 @@ public class Q00337_AudienceWithTheLandDragon extends Quest
{ {
if (qs.isCond(4) && (getRandom(100) < 50) && !hasQuestItems(player, THIRD_FRAGMENT_OF_ABYSS_JEWEL)) if (qs.isCond(4) && (getRandom(100) < 50) && !hasQuestItems(player, THIRD_FRAGMENT_OF_ABYSS_JEWEL))
{ {
addSpawn(ABYSSAL_JEWEL_3, npc.getX() + getRandom(-50, 50), npc.getY() + getRandom(-50, 50), npc.getZ(), npc.getHeading(), true, 60000L, false); addSpawn(ABYSSAL_JEWEL_3, npc.getX() + getRandom(-50, 50), npc.getY() + getRandom(-50, 50), npc.getZ(), npc.getHeading(), true, 60000, false);
} }
break; break;
} }
@@ -29,7 +29,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
public class WarehouseCacheManager public class WarehouseCacheManager
{ {
protected final Map<L2PcInstance, Long> _cachedWh = new ConcurrentHashMap<>(); protected final Map<L2PcInstance, Long> _cachedWh = new ConcurrentHashMap<>();
protected final long _cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000L; protected final long _cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000;
protected WarehouseCacheManager() protected WarehouseCacheManager()
{ {
@@ -169,7 +169,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", npc.getCurrentHp()); info.set("currentHP", npc.getCurrentHp());
info.set("currentMP", npc.getCurrentMp()); info.set("currentMP", npc.getCurrentMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
_storedInfo.put(npcId, info); _storedInfo.put(npcId, info);
_npcs.put(npcId, npc); _npcs.put(npcId, npc);
@@ -219,7 +219,7 @@ public class DBSpawnManager
info.set("currentHP", npc.getCurrentHp()); info.set("currentHP", npc.getCurrentHp());
info.set("currentMP", npc.getCurrentMp()); info.set("currentMP", npc.getCurrentMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
} }
_storedInfo.put(npc.getId(), info); _storedInfo.put(npc.getId(), info);
} }
@@ -248,7 +248,7 @@ public class DBSpawnManager
SpawnTable.getInstance().addNewSpawn(spawn, false); SpawnTable.getInstance().addNewSpawn(spawn, false);
if ((respawnTime == 0L) || (time > respawnTime)) if ((respawnTime == 0) || (time > respawnTime))
{ {
final L2Npc npc = spawn.doSpawn(); final L2Npc npc = spawn.doSpawn();
if (npc != null) if (npc != null)
@@ -262,7 +262,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", currentHP); info.set("currentHP", currentHP);
info.set("currentMP", currentMP); info.set("currentMP", currentMP);
info.set("respawnTime", 0L); info.set("respawnTime", 0);
_storedInfo.put(npcId, info); _storedInfo.put(npcId, info);
} }
@@ -324,7 +324,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", npc.getMaxHp()); info.set("currentHP", npc.getMaxHp());
info.set("currentMP", npc.getMaxMp()); info.set("currentMP", npc.getMaxMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
_npcs.put(npcId, npc); _npcs.put(npcId, npc);
_storedInfo.put(npcId, info); _storedInfo.put(npcId, info);
@@ -541,7 +541,7 @@ public class DBSpawnManager
final StatsSet info = new StatsSet(); final StatsSet info = new StatsSet();
info.set("currentHP", npc.getCurrentHp()); info.set("currentHP", npc.getCurrentHp());
info.set("currentMP", npc.getCurrentMp()); info.set("currentMP", npc.getCurrentMp());
info.set("respawnTime", 0L); info.set("respawnTime", 0);
npc.setDBStatus(DBStatusType.ALIVE); npc.setDBStatus(DBStatusType.ALIVE);
@@ -446,7 +446,7 @@ public final class WalkingManager implements IGameXmlReader
npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText()); npc.broadcastSay(ChatType.NPC_GENERAL, node.getChatText());
} }
ThreadPool.schedule(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000L)); ThreadPool.schedule(new ArrivedTask(npc, walk), 100 + (node.getDelay() * 1000));
} }
} }
} }
@@ -35,8 +35,8 @@ public class CharSelectInfoPackage
private int _race = 0; private int _race = 0;
private int _classId = 0; private int _classId = 0;
private int _baseClassId = 0; private int _baseClassId = 0;
private long _deleteTimer = 0L; private long _deleteTimer = 0;
private long _lastAccess = 0L; private long _lastAccess = 0;
private int _face = 0; private int _face = 0;
private int _hairStyle = 0; private int _hairStyle = 0;
private int _hairColor = 0; private int _hairColor = 0;
@@ -63,7 +63,7 @@ public class CreatureContainer
{ {
if ((_task == null) || _task.isDone()) if ((_task == null) || _task.isDone())
{ {
_task = ThreadPool.scheduleAtFixedRate(this::update, 1000L, 1000L); _task = ThreadPool.scheduleAtFixedRate(this::update, 1000, 1000);
} }
} }
@@ -374,7 +374,7 @@ public class CursedWeapon implements INamable
} }
else else
{ {
_removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000L, _durationLost * 12000L); _removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000, _durationLost * 12000);
} }
} }
@@ -387,8 +387,8 @@ public class CursedWeapon implements INamable
dropIt(attackable, player); dropIt(attackable, player);
// Start the Life Task // Start the Life Task
_endTime = System.currentTimeMillis() + (_duration * 60000L); _endTime = System.currentTimeMillis() + (_duration * 60000);
_removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000L, _durationLost * 12000L); _removeTask = ThreadPool.scheduleAtFixedRate(new RemoveTask(), _durationLost * 12000, _durationLost * 12000);
return true; return true;
} }
@@ -534,7 +534,7 @@ public class CursedWeapon implements INamable
} }
} }
// Reduce time-to-live // Reduce time-to-live
_endTime -= _durationLost * 60000L; _endTime -= _durationLost * 60000;
saveData(); saveData();
} }
@@ -497,7 +497,7 @@ public class L2Clan implements IIdentifiable, INamable
if (player.isClanLeader()) if (player.isClanLeader())
{ {
SiegeManager.getInstance().removeSiegeSkills(player); SiegeManager.getInstance().removeSiegeSkills(player);
player.setClanCreateExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 player.setClanCreateExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
} }
// remove Clan skills from Player // remove Clan skills from Player
removeSkillEffects(player); removeSkillEffects(player);
@@ -528,7 +528,7 @@ public class L2Clan implements IIdentifiable, INamable
} }
else else
{ {
removeMemberInDatabase(exMember, clanJoinExpiryTime, getLeaderId() == objectId ? System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000L) : 0); removeMemberInDatabase(exMember, clanJoinExpiryTime, getLeaderId() == objectId ? System.currentTimeMillis() + (Config.ALT_CLAN_CREATE_DAYS * 86400000) : 0);
} }
// Notify to scripts // Notify to scripts
@@ -1089,7 +1089,7 @@ public class L2Clan implements IIdentifiable, INamable
setAllyPenaltyExpiryTime(0, 0); setAllyPenaltyExpiryTime(0, 0);
} }
setCharPenaltyExpiryTime(clanData.getLong("char_penalty_expiry_time")); setCharPenaltyExpiryTime(clanData.getLong("char_penalty_expiry_time"));
if ((getCharPenaltyExpiryTime() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)) < System.currentTimeMillis()) // 24*60*60*1000 = 86400000 if ((getCharPenaltyExpiryTime() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)) < System.currentTimeMillis()) // 24*60*60*1000 = 86400000
{ {
setCharPenaltyExpiryTime(0); setCharPenaltyExpiryTime(0);
} }
@@ -2472,7 +2472,7 @@ public class L2Clan implements IIdentifiable, INamable
setAllyId(0); setAllyId(0);
setAllyName(null); setAllyName(null);
changeAllyCrest(0, false); changeAllyCrest(0, false);
setAllyPenaltyExpiryTime(currentTime + (Config.ALT_CREATE_ALLY_DAYS_WHEN_DISSOLVED * 86400000L), PENALTY_TYPE_DISSOLVE_ALLY); // 24*60*60*1000 = 86400000 setAllyPenaltyExpiryTime(currentTime + (Config.ALT_CREATE_ALLY_DAYS_WHEN_DISSOLVED * 86400000), PENALTY_TYPE_DISSOLVE_ALLY); // 24*60*60*1000 = 86400000
updateClanInDB(); updateClanInDB();
} }
@@ -71,7 +71,7 @@ public enum PcCondOverride
public static long getAllExceptionsMask() public static long getAllExceptionsMask()
{ {
long result = 0L; long result = 0;
for (PcCondOverride ex : values()) for (PcCondOverride ex : values())
{ {
result |= ex.getMask(); result |= ex.getMask();
@@ -228,7 +228,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
private Team _team = Team.NONE; private Team _team = Team.NONE;
protected long _exceptions = 0L; protected long _exceptions = 0;
private boolean _lethalable = true; private boolean _lethalable = true;
@@ -10040,7 +10040,7 @@ public final class L2PcInstance extends L2Playable
{ {
if (_taskRentPet == null) if (_taskRentPet == null)
{ {
_taskRentPet = ThreadPool.scheduleAtFixedRate(new RentPetTask(this), seconds * 1000L, seconds * 1000L); _taskRentPet = ThreadPool.scheduleAtFixedRate(new RentPetTask(this), seconds * 1000, seconds * 1000);
} }
} }
@@ -13992,7 +13992,7 @@ public final class L2PcInstance extends L2Playable
stopOnlineTimeUpdateTask(); stopOnlineTimeUpdateTask();
} }
_onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000L, 60 * 1000L); _onlineTimeUpdateTask = ThreadPool.scheduleAtFixedRate(this::updateOnlineTime, 60 * 1000, 60 * 1000);
} }
private void updateOnlineTime() private void updateOnlineTime()
@@ -14117,7 +14117,7 @@ public final class L2PcInstance extends L2Playable
public long getTraingCampDuration() public long getTraingCampDuration()
{ {
return getAccountVariables().getLong(TRAINING_CAMP_DURATION, 0L); return getAccountVariables().getLong(TRAINING_CAMP_DURATION, 0);
} }
public void setTraingCampDuration(long duration) public void setTraingCampDuration(long duration)
@@ -350,7 +350,7 @@ public class L2VillageMasterInstance extends L2NpcInstance
return; return;
} }
clan.setDissolvingExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_DISSOLVE_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.setDissolvingExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_DISSOLVE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
// The clan leader should take the XP penalty of a full death. // The clan leader should take the XP penalty of a full death.
@@ -51,7 +51,7 @@ public class FlyMoveStartTask implements Runnable
if (!_player.hasRequest(SayuneRequest.class)) if (!_player.hasRequest(SayuneRequest.class))
{ {
_player.sendPacket(ExNotifyFlyMoveStart.STATIC_PACKET); _player.sendPacket(ExNotifyFlyMoveStart.STATIC_PACKET);
ThreadPool.schedule(this, 1000L); ThreadPool.schedule(this, 1000);
} }
} }
} }
@@ -581,14 +581,14 @@ public final class Fort extends AbstractResidence
setOwnerClan(clan); setOwnerClan(clan);
final int runCount = getOwnedTime() / (Config.FS_UPDATE_FRQ * 60); final int runCount = getOwnedTime() / (Config.FS_UPDATE_FRQ * 60);
long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis(); long initial = System.currentTimeMillis() - _lastOwnedTime.getTimeInMillis();
while (initial > (Config.FS_UPDATE_FRQ * 60000L)) while (initial > (Config.FS_UPDATE_FRQ * 60000))
{ {
initial -= Config.FS_UPDATE_FRQ * 60000L; initial -= Config.FS_UPDATE_FRQ * 60000;
} }
initial = (Config.FS_UPDATE_FRQ * 60000L) - initial; initial = (Config.FS_UPDATE_FRQ * 60000) - initial;
if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600))) if ((Config.FS_MAX_OWN_TIME <= 0) || (getOwnedTime() < (Config.FS_MAX_OWN_TIME * 3600)))
{ {
_FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.PERIODIC_UPDATE), initial, Config.FS_UPDATE_FRQ * 60000L); // Schedule owner tasks to start running _FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.PERIODIC_UPDATE), initial, Config.FS_UPDATE_FRQ * 60000); // Schedule owner tasks to start running
if (Config.FS_MAX_OWN_TIME > 0) if (Config.FS_MAX_OWN_TIME > 0)
{ {
_FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owener _FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, runCount, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owener
@@ -822,10 +822,10 @@ public final class Fort extends AbstractResidence
{ {
_FortUpdater[1].cancel(false); _FortUpdater[1].cancel(false);
} }
_FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.PERIODIC_UPDATE), Config.FS_UPDATE_FRQ * 60000L, Config.FS_UPDATE_FRQ * 60000L); // Schedule owner tasks to start running _FortUpdater[0] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.PERIODIC_UPDATE), Config.FS_UPDATE_FRQ * 60000, Config.FS_UPDATE_FRQ * 60000); // Schedule owner tasks to start running
if (Config.FS_MAX_OWN_TIME > 0) if (Config.FS_MAX_OWN_TIME > 0)
{ {
_FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owener _FortUpdater[1] = ThreadPool.scheduleAtFixedRate(new FortUpdater(this, clan, 0, UpdaterType.MAX_OWN_TIME), 3600000, 3600000); // Schedule owner tasks to remove owner
} }
} }
else else
@@ -925,7 +925,7 @@ public final class Fort extends AbstractResidence
public final int getTimeTillRebelArmy() public final int getTimeTillRebelArmy()
{ {
return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000L)) - System.currentTimeMillis()) / 1000L); return _lastOwnedTime.getTimeInMillis() == 0 ? 0 : (int) (((_lastOwnedTime.getTimeInMillis() + (Config.FS_MAX_OWN_TIME * 3600000)) - System.currentTimeMillis()) / 1000);
} }
public final long getTimeTillNextFortUpdate() public final long getTimeTillNextFortUpdate()
@@ -274,7 +274,7 @@ public class FortSiege implements Siegable
unspawnSiegeGuard(); // Remove all spawned siege guard from this fort unspawnSiegeGuard(); // Remove all spawned siege guard from this fort
getFort().resetDoors(); // Respawn door to fort getFort().resetDoors(); // Respawn door to fort
ThreadPool.schedule(new ScheduleSuspiciousMerchantSpawn(), FortSiegeManager.getInstance().getSuspiciousMerchantRespawnDelay() * 60 * 1000L); // Prepare 3hr task for suspicious merchant respawn ThreadPool.schedule(new ScheduleSuspiciousMerchantSpawn(), FortSiegeManager.getInstance().getSuspiciousMerchantRespawnDelay() * 60 * 1000); // Prepare 3hr task for suspicious merchant respawn
setSiegeDateTime(true); // store suspicious merchant spawn in DB setSiegeDateTime(true); // store suspicious merchant spawn in DB
if (_siegeEnd != null) if (_siegeEnd != null)
@@ -336,7 +336,7 @@ public class FortSiege implements Siegable
getFort().getZone().updateZoneStatusForCharactersInside(); getFort().getZone().updateZoneStatusForCharactersInside();
// Schedule a task to prepare auto siege end // Schedule a task to prepare auto siege end
_siegeEnd = ThreadPool.schedule(new ScheduleEndSiegeTask(), FortSiegeManager.getInstance().getSiegeLength() * 60 * 1000L); // Prepare auto end task _siegeEnd = ThreadPool.schedule(new ScheduleEndSiegeTask(), FortSiegeManager.getInstance().getSiegeLength() * 60 * 1000); // Prepare auto end task
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_FORTRESS_BATTLE_S1_HAS_BEGUN); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_FORTRESS_BATTLE_S1_HAS_BEGUN);
sm.addCastleId(getFort().getResidenceId()); sm.addCastleId(getFort().getResidenceId());
@@ -680,7 +680,7 @@ public class FortSiege implements Siegable
else if (_siegeRestore == null) else if (_siegeRestore == null)
{ {
getFort().getSiege().announceToPlayer(SystemMessage.getSystemMessage(SystemMessageId.THE_BARRACKS_HAVE_BEEN_SEIZED)); getFort().getSiege().announceToPlayer(SystemMessage.getSystemMessage(SystemMessageId.THE_BARRACKS_HAVE_BEEN_SEIZED));
_siegeRestore = ThreadPool.schedule(new ScheduleSiegeRestore(), FortSiegeManager.getInstance().getCountDownLength() * 60 * 1000L); _siegeRestore = ThreadPool.schedule(new ScheduleSiegeRestore(), FortSiegeManager.getInstance().getCountDownLength() * 60 * 1000);
} }
else else
{ {
@@ -181,12 +181,12 @@ public final class ItemAuction
public final long getStartingTimeRemaining() public final long getStartingTimeRemaining()
{ {
return Math.max(getEndingTime() - System.currentTimeMillis(), 0L); return Math.max(getEndingTime() - System.currentTimeMillis(), 0);
} }
public final long getFinishingTimeRemaining() public final long getFinishingTimeRemaining()
{ {
return Math.max(getEndingTime() - System.currentTimeMillis(), 0L); return Math.max(getEndingTime() - System.currentTimeMillis(), 0);
} }
public final void storeMe() public final void storeMe()
@@ -325,17 +325,17 @@ public final class ItemAuctionInstance
{ {
if (currentAuction.getAuctionState() == ItemAuctionState.STARTED) if (currentAuction.getAuctionState() == ItemAuctionState.STARTED)
{ {
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getEndingTime() - System.currentTimeMillis(), 0)));
} }
else else
{ {
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getStartingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(currentAuction), Math.max(currentAuction.getStartingTime() - System.currentTimeMillis(), 0)));
} }
LOGGER.info(getClass().getSimpleName() + ": Schedule current auction " + currentAuction.getAuctionId() + " for instance " + _instanceId); LOGGER.info(getClass().getSimpleName() + ": Schedule current auction " + currentAuction.getAuctionId() + " for instance " + _instanceId);
} }
else else
{ {
setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(nextAuction), Math.max(nextAuction.getStartingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(new ScheduleAuctionTask(nextAuction), Math.max(nextAuction.getStartingTime() - System.currentTimeMillis(), 0)));
LOGGER.info(getClass().getSimpleName() + ": Schedule next auction " + nextAuction.getAuctionId() + " on " + DATE_FORMAT.format(new Date(nextAuction.getStartingTime())) + " for instance " + _instanceId); LOGGER.info(getClass().getSimpleName() + ": Schedule next auction " + nextAuction.getAuctionId() + " on " + DATE_FORMAT.format(new Date(nextAuction.getStartingTime())) + " for instance " + _instanceId);
} }
} }
@@ -421,7 +421,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() == ItemAuctionExtendState.INITIAL) if (_auction.getScheduledAuctionEndingExtendState() == ItemAuctionExtendState.INITIAL)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_5_MIN); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_5_MIN);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
break; break;
@@ -431,7 +431,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_3_MIN) if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_3_MIN)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_3_MIN); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_3_MIN);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
break; break;
@@ -441,7 +441,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B) if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_B);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
break; break;
@@ -451,7 +451,7 @@ public final class ItemAuctionInstance
if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A) if (_auction.getScheduledAuctionEndingExtendState() != ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A)
{ {
_auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A); _auction.setScheduledAuctionEndingExtendState(ItemAuctionExtendState.EXTEND_BY_CONFIG_PHASE_A);
setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0L))); setStateTask(ThreadPool.schedule(this, Math.max(_auction.getEndingTime() - System.currentTimeMillis(), 0)));
return; return;
} }
} }
@@ -545,7 +545,7 @@ public class Olympiad extends ListenersContainer
{ {
// if (_olympiadEnd > Calendar.getInstance().getTimeInMillis()) // if (_olympiadEnd > Calendar.getInstance().getTimeInMillis())
return (_olympiadEnd - Calendar.getInstance().getTimeInMillis()); return (_olympiadEnd - Calendar.getInstance().getTimeInMillis());
// return 10L; // return 10;
} }
public void manualSelectHeroes() public void manualSelectHeroes()
@@ -564,7 +564,7 @@ public class Olympiad extends ListenersContainer
{ {
return (_validationEnd - Calendar.getInstance().getTimeInMillis()); return (_validationEnd - Calendar.getInstance().getTimeInMillis());
} }
return 10L; return 10;
} }
public boolean isOlympiadEnd() public boolean isOlympiadEnd()
@@ -662,7 +662,7 @@ public class Olympiad extends ListenersContainer
{ {
if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis())) if ((_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) && (_compEnd > Calendar.getInstance().getTimeInMillis()))
{ {
return 10L; return 10;
} }
if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis()) if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
@@ -720,7 +720,7 @@ public class Olympiad extends ListenersContainer
{ {
// if (_compEnd > Calendar.getInstance().getTimeInMillis()) // if (_compEnd > Calendar.getInstance().getTimeInMillis())
return (_compEnd - Calendar.getInstance().getTimeInMillis()); return (_compEnd - Calendar.getInstance().getTimeInMillis());
// return 10L; // return 10;
} }
private long getMillisToWeekChange() private long getMillisToWeekChange()
@@ -729,7 +729,7 @@ public class Olympiad extends ListenersContainer
{ {
return (_nextWeeklyChange - Calendar.getInstance().getTimeInMillis()); return (_nextWeeklyChange - Calendar.getInstance().getTimeInMillis());
} }
return 10L; return 10;
} }
private void scheduleWeeklyChange() private void scheduleWeeklyChange()
@@ -288,7 +288,7 @@ public final class OlympiadGameTask implements Runnable
case BATTLE_IN_PROGRESS: case BATTLE_IN_PROGRESS:
{ {
_countDown += 1000; _countDown += 1000;
final int remaining = (int) ((Config.ALT_OLY_BATTLE - _countDown) / 1000l); final int remaining = (int) ((Config.ALT_OLY_BATTLE - _countDown) / 1000);
for (int announceTime : BATTLE_END_TIME_SECOND) for (int announceTime : BATTLE_END_TIME_SECOND)
{ {
if (announceTime == remaining) if (announceTime == remaining)
@@ -322,7 +322,7 @@ public final class BuffInfo
// Creates a task that will stop all the effects. // Creates a task that will stop all the effects.
if (_abnormalTime > 0) if (_abnormalTime > 0)
{ {
_scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000L); _scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000);
} }
for (AbstractEffect effect : _effects) for (AbstractEffect effect : _effects)
@@ -449,7 +449,7 @@ public final class BuffInfo
{ {
_scheduledFutureTimeTask.cancel(true); _scheduledFutureTimeTask.cancel(true);
} }
_scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000L); _scheduledFutureTimeTask = ThreadPool.scheduleAtFixedRate(new BuffTimeTask(this), 0, 1000);
} }
} }
@@ -332,7 +332,7 @@ public final class L2GameClient extends ChannelInboundHandler<L2GameClient>
try (Connection con = DatabaseFactory.getInstance().getConnection(); try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?")) PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
{ {
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
ps2.setInt(2, objectId); ps2.setInt(2, objectId);
ps2.execute(); ps2.execute();
} }
@@ -82,13 +82,13 @@ public final class AllyDismiss implements IClientIncomingPacket
} }
final long currentTime = System.currentTimeMillis(); final long currentTime = System.currentTimeMillis();
leaderClan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED * 86400000L), L2Clan.PENALTY_TYPE_DISMISS_CLAN); // 24*60*60*1000 = 86400000 leaderClan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ACCEPT_CLAN_DAYS_WHEN_DISMISSED * 86400000), L2Clan.PENALTY_TYPE_DISMISS_CLAN); // 24*60*60*1000 = 86400000
leaderClan.updateClanInDB(); leaderClan.updateClanInDB();
clan.setAllyId(0); clan.setAllyId(0);
clan.setAllyName(null); clan.setAllyName(null);
clan.changeAllyCrest(0, true); clan.changeAllyCrest(0, true);
clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_DISMISSED * 86400000L), L2Clan.PENALTY_TYPE_CLAN_DISMISSED); // 24*60*60*1000 = 86400000 clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_DISMISSED * 86400000), L2Clan.PENALTY_TYPE_CLAN_DISMISSED); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
player.sendPacket(SystemMessageId.YOU_HAVE_SUCCEEDED_IN_EXPELLING_THE_CLAN); player.sendPacket(SystemMessageId.YOU_HAVE_SUCCEEDED_IN_EXPELLING_THE_CLAN);
@@ -66,7 +66,7 @@ public final class AllyLeave implements IClientIncomingPacket
clan.setAllyId(0); clan.setAllyId(0);
clan.setAllyName(null); clan.setAllyName(null);
clan.changeAllyCrest(0, true); clan.changeAllyCrest(0, true);
clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_LEAVED * 86400000L), L2Clan.PENALTY_TYPE_CLAN_LEAVED); // 24*60*60*1000 = 86400000 clan.setAllyPenaltyExpiryTime(currentTime + (Config.ALT_ALLY_JOIN_DAYS_WHEN_LEAVED * 86400000), L2Clan.PENALTY_TYPE_CLAN_LEAVED); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
player.sendPacket(SystemMessageId.YOU_HAVE_WITHDRAWN_FROM_THE_ALLIANCE); player.sendPacket(SystemMessageId.YOU_HAVE_WITHDRAWN_FROM_THE_ALLIANCE);
@@ -82,8 +82,8 @@ public final class RequestOustPledgeMember implements IClientIncomingPacket
} }
// this also updates the database // this also updates the database
clan.removeClanMember(member.getObjectId(), System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.removeClanMember(member.getObjectId(), System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)); // 24*60*60*1000 = 86400000
clan.setCharPenaltyExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000L)); // 24*60*60*1000 = 86400000 clan.setCharPenaltyExpiryTime(System.currentTimeMillis() + (Config.ALT_CLAN_JOIN_DAYS * 86400000)); // 24*60*60*1000 = 86400000
clan.updateClanInDB(); clan.updateClanInDB();
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_S1_HAS_BEEN_EXPELLED); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_S1_HAS_BEEN_EXPELLED);

Some files were not shown because too many files have changed in this diff Show More