GameTimeController class is a task manager.
This commit is contained in:
@@ -19,13 +19,13 @@ package ai.others.Spawns;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.ListenerRegisterType;
|
||||
import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.spawns.SpawnTemplate;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class DayNightSpawns extends AbstractNpcAI
|
||||
{
|
||||
if (_templates.add(template))
|
||||
{
|
||||
manageSpawns(template, GameTimeController.getInstance().isNight());
|
||||
manageSpawns(template, GameTimeTaskManager.getInstance().isNight());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,6 @@ package ai.others.Spawns;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.instancemanager.DBSpawnManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -30,6 +29,7 @@ import org.l2jmobius.gameserver.model.events.impl.OnDayNightChange;
|
||||
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
|
||||
import org.l2jmobius.gameserver.model.spawns.SpawnGroup;
|
||||
import org.l2jmobius.gameserver.model.spawns.SpawnTemplate;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
@@ -97,7 +97,7 @@ public class EilhalderVonHellmann extends AbstractNpcAI
|
||||
}
|
||||
}
|
||||
|
||||
handleBoss(GameTimeController.getInstance().isNight());
|
||||
handleBoss(GameTimeTaskManager.getInstance().isNight());
|
||||
}
|
||||
|
||||
@RegisterEvent(EventType.ON_DAY_NIGHT_CHANGE)
|
||||
|
@@ -26,13 +26,13 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameServer;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author St3eT
|
||||
@@ -58,8 +58,8 @@ public class AdminServerInfo implements IAdminCommandHandler
|
||||
html.replace("%os_name%", System.getProperty("os.name"));
|
||||
html.replace("%os_ver%", System.getProperty("os.version"));
|
||||
html.replace("%slots%", getPlayersCount("ALL") + "/" + Config.MAXIMUM_ONLINE_USERS);
|
||||
html.replace("%gameTime%", GameTimeController.getInstance().getGameHour() + ":" + GameTimeController.getInstance().getGameMinute());
|
||||
html.replace("%dayNight%", GameTimeController.getInstance().isNight() ? "Night" : "Day");
|
||||
html.replace("%gameTime%", GameTimeTaskManager.getInstance().getGameHour() + ":" + GameTimeTaskManager.getInstance().getGameMinute());
|
||||
html.replace("%dayNight%", GameTimeTaskManager.getInstance().isNight() ? "Night" : "Day");
|
||||
html.replace("%geodata%", Config.PATHFINDING ? "Enabled" : "Disabled");
|
||||
html.replace("%serverTime%", SDF.format(new Date(Chronos.currentTimeMillis())));
|
||||
html.replace("%serverUpTime%", getServerUpTime());
|
||||
|
@@ -19,12 +19,12 @@ package handlers.admincommandhandlers;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.Shutdown;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.BuilderUtil;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@@ -99,7 +99,7 @@ public class AdminShutdown implements IAdminCommandHandler
|
||||
private void sendHtmlForm(PlayerInstance activeChar)
|
||||
{
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage(0, 1);
|
||||
final int t = GameTimeController.getInstance().getGameTime();
|
||||
final int t = GameTimeTaskManager.getInstance().getGameTime();
|
||||
final int h = t / 60;
|
||||
final int m = t % 60;
|
||||
final SimpleDateFormat format = new SimpleDateFormat("h:mm a");
|
||||
|
@@ -16,12 +16,12 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -36,12 +36,12 @@ public class HitAtNight extends AbstractStatEffect
|
||||
@Override
|
||||
public void onStart(Creature effector, Creature effected, Skill skill, ItemInstance item)
|
||||
{
|
||||
GameTimeController.getInstance().addShadowSenseCharacter(effected);
|
||||
GameTimeTaskManager.getInstance().addShadowSenseCharacter(effected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExit(Creature effector, Creature effected, Skill skill)
|
||||
{
|
||||
GameTimeController.getInstance().removeShadowSenseCharacter(effected);
|
||||
GameTimeTaskManager.getInstance().removeShadowSenseCharacter(effected);
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.GameServer;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
@@ -49,6 +48,7 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.AdminForgePacket;
|
||||
import org.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
@@ -354,7 +354,7 @@ public class Debug implements ITelnetCommand
|
||||
|
||||
private static String gameTime()
|
||||
{
|
||||
final int t = GameTimeController.getInstance().getGameTime();
|
||||
final int t = GameTimeTaskManager.getInstance().getGameTime();
|
||||
final int h = t / 60;
|
||||
final int m = t % 60;
|
||||
final SimpleDateFormat format = new SimpleDateFormat("H:mm");
|
||||
|
@@ -21,11 +21,11 @@ import java.util.Date;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.handler.IUserCommandHandler;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* Time user command.
|
||||
@@ -47,7 +47,7 @@ public class Time implements IUserCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
final int t = GameTimeController.getInstance().getGameTime();
|
||||
final int t = GameTimeTaskManager.getInstance().getGameTime();
|
||||
final String h = Integer.toString(((t / 60) % 24));
|
||||
String m;
|
||||
if ((t % 60) < 10)
|
||||
@@ -60,7 +60,7 @@ public class Time implements IUserCommandHandler
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
if (GameTimeController.getInstance().isNight())
|
||||
if (GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
sm = new SystemMessage(SystemMessageId.THE_CURRENT_TIME_IS_S1_S2_2);
|
||||
sm.addString(h);
|
||||
|
@@ -155,6 +155,7 @@ import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
import org.l2jmobius.gameserver.scripting.ScriptEngineManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.ItemsAutoDestroyTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.TaskManager;
|
||||
import org.l2jmobius.gameserver.ui.Gui;
|
||||
@@ -225,8 +226,8 @@ public class GameServer
|
||||
TelnetServer.getInstance();
|
||||
|
||||
printSection("World");
|
||||
// start game time control early
|
||||
GameTimeController.init();
|
||||
// Start game time task manager early.
|
||||
GameTimeTaskManager.getInstance();
|
||||
World.getInstance();
|
||||
MapRegionManager.getInstance();
|
||||
ZoneManager.getInstance();
|
||||
|
@@ -51,6 +51,7 @@ import org.l2jmobius.gameserver.network.serverpackets.RecipeShopItemInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SetupGauge;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.StatusUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
public class RecipeController
|
||||
@@ -338,7 +339,7 @@ public class RecipeController
|
||||
// if still not empty, schedule another pass
|
||||
if (!_items.isEmpty())
|
||||
{
|
||||
_delay = (int) (Config.ALT_GAME_CREATION_SPEED * _player.getStat().getReuseTime(_skill) * GameTimeController.TICKS_PER_SECOND * GameTimeController.MILLIS_IN_TICK);
|
||||
_delay = (int) (Config.ALT_GAME_CREATION_SPEED * _player.getStat().getReuseTime(_skill) * GameTimeTaskManager.TICKS_PER_SECOND * GameTimeTaskManager.MILLIS_IN_TICK);
|
||||
|
||||
// FIXME: please fix this packet to show crafting animation (somebody)
|
||||
final MagicSkillUse msk = new MagicSkillUse(_player, _skillId, _skillLevel, _delay, 0);
|
||||
|
@@ -49,6 +49,7 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.loginserverpackets.game.ServerStatus;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
@@ -145,7 +146,7 @@ public class Shutdown extends Thread
|
||||
// ensure all services are stopped
|
||||
try
|
||||
{
|
||||
GameTimeController.getInstance().stopTimer();
|
||||
GameTimeTaskManager.getInstance().stopTimer();
|
||||
LOGGER.info("Game Time Controller: Timer stopped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
||||
}
|
||||
catch (Throwable t)
|
||||
|
@@ -20,7 +20,6 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
|
||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
|
||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.WorldRegion;
|
||||
@@ -39,6 +38,7 @@ import org.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.StopMove;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.CreatureFollowTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* Mother class of all objects AI in the world.<br>
|
||||
@@ -443,13 +443,13 @@ public abstract class AbstractAI implements Ctrl
|
||||
{
|
||||
if (_clientMovingToPawnOffset == offset)
|
||||
{
|
||||
if (GameTimeController.getInstance().getGameTicks() < _moveToPawnTimeout)
|
||||
if (GameTimeTaskManager.getInstance().getGameTicks() < _moveToPawnTimeout)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
// minimum time to calculate new route is 2 seconds
|
||||
else if (_actor.isOnGeodataPath() && (GameTimeController.getInstance().getGameTicks() < (_moveToPawnTimeout + 10)))
|
||||
else if (_actor.isOnGeodataPath() && (GameTimeTaskManager.getInstance().getGameTicks() < (_moveToPawnTimeout + 10)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -459,8 +459,8 @@ public abstract class AbstractAI implements Ctrl
|
||||
_clientMoving = true;
|
||||
_clientMovingToPawnOffset = offset;
|
||||
_target = pawn;
|
||||
_moveToPawnTimeout = GameTimeController.getInstance().getGameTicks();
|
||||
_moveToPawnTimeout += 1000 / GameTimeController.MILLIS_IN_TICK;
|
||||
_moveToPawnTimeout = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_moveToPawnTimeout += 1000 / GameTimeTaskManager.MILLIS_IN_TICK;
|
||||
|
||||
if (pawn == null)
|
||||
{
|
||||
|
@@ -28,7 +28,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.enums.AISkillScope;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
|
||||
@@ -57,6 +56,7 @@ import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.model.skills.SkillCaster;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackableThinkTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -263,7 +263,7 @@ public class AttackableAI extends CreatureAI
|
||||
protected void onIntentionAttack(Creature target)
|
||||
{
|
||||
// Calculate the attack timeout
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
|
||||
super.onIntentionAttack(target);
|
||||
@@ -666,7 +666,7 @@ public class AttackableAI extends CreatureAI
|
||||
return;
|
||||
}
|
||||
|
||||
if (_attackTimeout < GameTimeController.getInstance().getGameTicks())
|
||||
if (_attackTimeout < GameTimeTaskManager.getInstance().getGameTicks())
|
||||
{
|
||||
// Set the AI Intention to AI_INTENTION_ACTIVE
|
||||
setIntention(AI_INTENTION_ACTIVE);
|
||||
@@ -1313,7 +1313,7 @@ public class AttackableAI extends CreatureAI
|
||||
final Attackable me = getActiveChar();
|
||||
final WorldObject target = getTarget();
|
||||
// Calculate the attack timeout
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Set the _globalAggro to 0 to permit attack even just after spawn
|
||||
if (_globalAggro < 0)
|
||||
|
@@ -21,7 +21,6 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
|
||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@@ -29,6 +28,7 @@ import org.l2jmobius.gameserver.model.actor.instance.DoppelgangerInstance;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.model.skills.SkillCaster;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
public class DoppelgangerAI extends CreatureAI
|
||||
{
|
||||
@@ -220,7 +220,7 @@ public class DoppelgangerAI extends CreatureAI
|
||||
{
|
||||
if (_clientMovingToPawnOffset == offset)
|
||||
{
|
||||
if (GameTimeController.getInstance().getGameTicks() < _moveToPawnTimeout)
|
||||
if (GameTimeTaskManager.getInstance().getGameTicks() < _moveToPawnTimeout)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public class DoppelgangerAI extends CreatureAI
|
||||
else if (_actor.isOnGeodataPath())
|
||||
{
|
||||
// minimum time to calculate new route is 2 seconds
|
||||
if (GameTimeController.getInstance().getGameTicks() < (_moveToPawnTimeout + 10))
|
||||
if (GameTimeTaskManager.getInstance().getGameTicks() < (_moveToPawnTimeout + 10))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -240,8 +240,8 @@ public class DoppelgangerAI extends CreatureAI
|
||||
_clientMoving = true;
|
||||
_clientMovingToPawnOffset = offset;
|
||||
setTarget(pawn);
|
||||
_moveToPawnTimeout = GameTimeController.getInstance().getGameTicks();
|
||||
_moveToPawnTimeout += 1000 / GameTimeController.MILLIS_IN_TICK;
|
||||
_moveToPawnTimeout = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_moveToPawnTimeout += 1000 / GameTimeTaskManager.MILLIS_IN_TICK;
|
||||
if (pawn == null)
|
||||
{
|
||||
return;
|
||||
|
@@ -24,9 +24,9 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.enums.Position;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* This class load, holds and calculates the hit condition bonuses.
|
||||
@@ -127,7 +127,7 @@ public class HitConditionBonusData implements IXmlReader
|
||||
}
|
||||
|
||||
// Get weather bonus
|
||||
if (GameTimeController.getInstance().isNight())
|
||||
if (GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
mod += darkBonus;
|
||||
// else if () No rain support yet.
|
||||
|
@@ -32,7 +32,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
import org.l2jmobius.gameserver.enums.StatusUpdateType;
|
||||
@@ -65,6 +64,7 @@ import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDelete;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.StatusUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -149,7 +149,7 @@ public class Party extends AbstractPlayerGroup
|
||||
public void setPendingInvitation(boolean value)
|
||||
{
|
||||
_pendingInvitation = value;
|
||||
_pendingInviteTimeout = GameTimeController.getInstance().getGameTicks() + (PlayerInstance.REQUEST_TIMEOUT * GameTimeController.TICKS_PER_SECOND);
|
||||
_pendingInviteTimeout = GameTimeTaskManager.getInstance().getGameTicks() + (PlayerInstance.REQUEST_TIMEOUT * GameTimeTaskManager.TICKS_PER_SECOND);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,7 +159,7 @@ public class Party extends AbstractPlayerGroup
|
||||
*/
|
||||
public boolean isInvitationRequestExpired()
|
||||
{
|
||||
return (_pendingInviteTimeout <= GameTimeController.getInstance().getGameTicks());
|
||||
return (_pendingInviteTimeout <= GameTimeTaskManager.getInstance().getGameTicks());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -44,7 +44,6 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.EmptyQueue;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.AttackableAI;
|
||||
import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
@@ -157,6 +156,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.TeleportToLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -3050,7 +3050,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
m._yAccurate = getY();
|
||||
}
|
||||
|
||||
final int gameTicks = GameTimeController.getInstance().getGameTicks();
|
||||
final int gameTicks = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Check if the position has already been calculated
|
||||
if (m._moveTimestamp == gameTicks)
|
||||
@@ -3125,7 +3125,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
double distFraction = Double.MAX_VALUE;
|
||||
if (delta > 1)
|
||||
{
|
||||
final double distPassed = (_stat.getMoveSpeed() * (gameTicks - m._moveTimestamp)) / GameTimeController.TICKS_PER_SECOND;
|
||||
final double distPassed = (_stat.getMoveSpeed() * (gameTicks - m._moveTimestamp)) / GameTimeTaskManager.TICKS_PER_SECOND;
|
||||
distFraction = distPassed / delta;
|
||||
}
|
||||
|
||||
@@ -3541,7 +3541,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
// Calculate the number of ticks between the current position and the destination
|
||||
// One tick added for rounding reasons
|
||||
final int ticksToMove = 1 + (int) ((GameTimeController.TICKS_PER_SECOND * distance) / speed);
|
||||
final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed);
|
||||
m._target = target;
|
||||
m._xDestination = x;
|
||||
m._yDestination = y;
|
||||
@@ -3555,17 +3555,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
setHeading(Util.calculateHeadingFrom(cos, sin));
|
||||
}
|
||||
|
||||
m._moveStartTime = GameTimeController.getInstance().getGameTicks();
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Set the Creature _move object to MoveData object
|
||||
_move = m;
|
||||
|
||||
// Add the Creature to movingObjects of the GameTimeController
|
||||
// The GameTimeController manage objects movement
|
||||
GameTimeController.getInstance().registerMovingObject(this);
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Create a task to notify the AI that Creature arrives at a check point of the movement
|
||||
if ((ticksToMove * GameTimeController.MILLIS_IN_TICK) > 3000)
|
||||
if ((ticksToMove * GameTimeTaskManager.MILLIS_IN_TICK) > 3000)
|
||||
{
|
||||
ThreadPool.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000);
|
||||
}
|
||||
@@ -3632,19 +3632,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
// Calculate the number of ticks between the current position and the destination
|
||||
// One tick added for rounding reasons
|
||||
final int ticksToMove = 1 + (int) ((GameTimeController.TICKS_PER_SECOND * distance) / speed);
|
||||
final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed);
|
||||
m._heading = 0; // initial value for coordinate sync
|
||||
m._moveStartTime = GameTimeController.getInstance().getGameTicks();
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Set the Creature _move object to MoveData object
|
||||
_move = m;
|
||||
|
||||
// Add the Creature to movingObjects of the GameTimeController
|
||||
// The GameTimeController manage objects movement
|
||||
GameTimeController.getInstance().registerMovingObject(this);
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Create a task to notify the AI that Creature arrives at a check point of the movement
|
||||
if ((ticksToMove * GameTimeController.MILLIS_IN_TICK) > 3000)
|
||||
if ((ticksToMove * GameTimeTaskManager.MILLIS_IN_TICK) > 3000)
|
||||
{
|
||||
ThreadPool.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000);
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
@@ -41,6 +40,7 @@ import org.l2jmobius.gameserver.model.zone.ZoneRegion;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -156,9 +156,9 @@ public abstract class Vehicle extends Creature
|
||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
||||
}
|
||||
|
||||
m._moveStartTime = GameTimeController.getInstance().getGameTicks();
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeController.getInstance().registerMovingObject(this);
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,6 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.RecipeController;
|
||||
import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
@@ -349,6 +348,7 @@ import org.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommi
|
||||
import org.l2jmobius.gameserver.network.serverpackets.friend.FriendStatus;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.vip.ReceiveVipInfo;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.ItemsAutoDestroyTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.PlayerAutoSaveTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.PvpFlagTaskManager;
|
||||
@@ -3889,12 +3889,12 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void setRecentFakeDeath(boolean protect)
|
||||
{
|
||||
_recentFakeDeathEndTime = protect ? GameTimeController.getInstance().getGameTicks() + (Config.PLAYER_FAKEDEATH_UP_PROTECTION * GameTimeController.TICKS_PER_SECOND) : 0;
|
||||
_recentFakeDeathEndTime = protect ? GameTimeTaskManager.getInstance().getGameTicks() + (Config.PLAYER_FAKEDEATH_UP_PROTECTION * GameTimeTaskManager.TICKS_PER_SECOND) : 0;
|
||||
}
|
||||
|
||||
public boolean isRecentFakeDeath()
|
||||
{
|
||||
return _recentFakeDeathEndTime > GameTimeController.getInstance().getGameTicks();
|
||||
return _recentFakeDeathEndTime > GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
public boolean isFakeDeath()
|
||||
@@ -5476,7 +5476,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean isProcessingRequest()
|
||||
{
|
||||
return (getActiveRequester() != null) || (_requestExpireTime > GameTimeController.getInstance().getGameTicks());
|
||||
return (getActiveRequester() != null) || (_requestExpireTime > GameTimeTaskManager.getInstance().getGameTicks());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5484,7 +5484,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean isProcessingTransaction()
|
||||
{
|
||||
return (getActiveRequester() != null) || (_activeTradeList != null) || (_requestExpireTime > GameTimeController.getInstance().getGameTicks());
|
||||
return (getActiveRequester() != null) || (_activeTradeList != null) || (_requestExpireTime > GameTimeTaskManager.getInstance().getGameTicks());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5492,7 +5492,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void blockRequest()
|
||||
{
|
||||
_requestExpireTime = GameTimeController.getInstance().getGameTicks() + (REQUEST_TIMEOUT * GameTimeController.TICKS_PER_SECOND);
|
||||
_requestExpireTime = GameTimeTaskManager.getInstance().getGameTicks() + (REQUEST_TIMEOUT * GameTimeTaskManager.TICKS_PER_SECOND);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5501,7 +5501,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void onTransactionRequest(PlayerInstance partner)
|
||||
{
|
||||
_requestExpireTime = GameTimeController.getInstance().getGameTicks() + (REQUEST_TIMEOUT * GameTimeController.TICKS_PER_SECOND);
|
||||
_requestExpireTime = GameTimeTaskManager.getInstance().getGameTicks() + (REQUEST_TIMEOUT * GameTimeTaskManager.TICKS_PER_SECOND);
|
||||
partner.setActiveRequester(this);
|
||||
}
|
||||
|
||||
@@ -5511,7 +5511,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean isRequestExpired()
|
||||
{
|
||||
return _requestExpireTime <= GameTimeController.getInstance().getGameTicks();
|
||||
return _requestExpireTime <= GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* The Class ConditionGameTime.
|
||||
@@ -60,7 +60,7 @@ public class ConditionGameTime extends Condition
|
||||
{
|
||||
case NIGHT:
|
||||
{
|
||||
return GameTimeController.getInstance().isNight() == _required;
|
||||
return GameTimeTaskManager.getInstance().isNight() == _required;
|
||||
}
|
||||
}
|
||||
return !_required;
|
||||
|
@@ -35,7 +35,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.xml.DoorData;
|
||||
@@ -159,6 +158,7 @@ import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SpecialCamera;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.scripting.ManagedScript;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.MinionList;
|
||||
|
||||
/**
|
||||
@@ -3156,11 +3156,11 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of ticks from the {@link org.l2jmobius.gameserver.GameTimeController}.
|
||||
* @return the number of ticks from the {@link org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager}.
|
||||
*/
|
||||
public static int getGameTicks()
|
||||
{
|
||||
return GameTimeController.getInstance().getGameTicks();
|
||||
return GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -24,7 +24,6 @@ import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.EffectList;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@@ -36,6 +35,7 @@ import org.l2jmobius.gameserver.model.options.Options;
|
||||
import org.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* Buff Info.<br>
|
||||
@@ -85,7 +85,7 @@ public class BuffInfo
|
||||
_effected = effected;
|
||||
_skill = skill;
|
||||
_abnormalTime = Formulas.calcEffectAbnormalTime(effector, effected, skill);
|
||||
_periodStartTicks = GameTimeController.getInstance().getGameTicks();
|
||||
_periodStartTicks = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_hideStartMessage = hideStartMessage;
|
||||
_item = item;
|
||||
_option = option;
|
||||
@@ -198,7 +198,7 @@ public class BuffInfo
|
||||
*/
|
||||
public int getTime()
|
||||
{
|
||||
return _abnormalTime - ((GameTimeController.getInstance().getGameTicks() - _periodStartTicks) / GameTimeController.TICKS_PER_SECOND);
|
||||
return _abnormalTime - ((GameTimeTaskManager.getInstance().getGameTicks() - _periodStartTicks) / GameTimeTaskManager.TICKS_PER_SECOND);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -433,7 +433,7 @@ public class BuffInfo
|
||||
{
|
||||
if (_abnormalTime > 0)
|
||||
{
|
||||
_periodStartTicks = GameTimeController.getInstance().getGameTicks();
|
||||
_periodStartTicks = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_abnormalTime = abnormalTime;
|
||||
_effected.removeBuffInfoTime(this);
|
||||
_effected.addBuffInfoTime(this);
|
||||
|
@@ -18,11 +18,11 @@ package org.l2jmobius.gameserver.model.stats.finalizers;
|
||||
|
||||
import java.util.OptionalDouble;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
@@ -71,7 +71,7 @@ public class PAccuracyFinalizer implements IStatFunction
|
||||
}
|
||||
|
||||
// Shadow sense
|
||||
if (GameTimeController.getInstance().isNight())
|
||||
if (GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
baseValue += creature.getStat().getAdd(Stat.HIT_AT_NIGHT, 0);
|
||||
}
|
||||
|
@@ -17,9 +17,9 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
public class CharSelected implements IClientOutgoingPacket
|
||||
{
|
||||
@@ -61,7 +61,7 @@ public class CharSelected implements IClientOutgoingPacket
|
||||
packet.writeD(_player.getLevel());
|
||||
packet.writeD(_player.getReputation());
|
||||
packet.writeD(_player.getPkKills());
|
||||
packet.writeD(GameTimeController.getInstance().getGameTime() % (24 * 60)); // "reset" on 24th hour
|
||||
packet.writeD(GameTimeTaskManager.getInstance().getGameTime() % (24 * 60)); // "reset" on 24th hour
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(_player.getClassId().getId());
|
||||
|
||||
|
@@ -17,8 +17,8 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
public class ClientSetTime implements IClientOutgoingPacket
|
||||
{
|
||||
@@ -33,7 +33,7 @@ public class ClientSetTime implements IClientOutgoingPacket
|
||||
{
|
||||
OutgoingPackets.CLIENT_SET_TIME.writeId(packet);
|
||||
|
||||
packet.writeD(GameTimeController.getInstance().getGameTime()); // time in client minutes
|
||||
packet.writeD(GameTimeTaskManager.getInstance().getGameTime()); // time in client minutes
|
||||
packet.writeD(6); // constant to match the server time( this determines the speed of the client clock)
|
||||
return true;
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver;
|
||||
package org.l2jmobius.gameserver.taskmanager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -33,12 +33,12 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.util.UnboundArrayList;
|
||||
|
||||
/**
|
||||
* Game Time controller class.
|
||||
* Game Time task manager class.
|
||||
* @author Forsaiken
|
||||
*/
|
||||
public class GameTimeController extends Thread
|
||||
public class GameTimeTaskManager extends Thread
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(GameTimeController.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(GameTimeTaskManager.class.getName());
|
||||
|
||||
public static final int TICKS_PER_SECOND = 10; // not able to change this without checking through code
|
||||
public static final int MILLIS_IN_TICK = 1000 / TICKS_PER_SECOND;
|
||||
@@ -48,15 +48,13 @@ public class GameTimeController extends Thread
|
||||
public static final int TICKS_PER_IG_DAY = SECONDS_PER_IG_DAY * TICKS_PER_SECOND;
|
||||
private static final int SHADOW_SENSE_ID = 294;
|
||||
|
||||
private static GameTimeController _instance;
|
||||
|
||||
private static final UnboundArrayList<Creature> _movingObjects = new UnboundArrayList<>();
|
||||
private static final Set<Creature> _shadowSenseCharacters = ConcurrentHashMap.newKeySet();
|
||||
private final long _referenceTime;
|
||||
|
||||
private GameTimeController()
|
||||
private GameTimeTaskManager()
|
||||
{
|
||||
super("GameTimeController");
|
||||
super("GameTimeTaskManager");
|
||||
super.setDaemon(true);
|
||||
super.setPriority(MAX_PRIORITY);
|
||||
|
||||
@@ -70,11 +68,6 @@ public class GameTimeController extends Thread
|
||||
super.start();
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
_instance = new GameTimeController();
|
||||
}
|
||||
|
||||
public int getGameTime()
|
||||
{
|
||||
return (getGameTicks() % TICKS_PER_IG_DAY) / MILLIS_IN_TICK;
|
||||
@@ -243,8 +236,13 @@ public class GameTimeController extends Thread
|
||||
}
|
||||
}
|
||||
|
||||
public static GameTimeController getInstance()
|
||||
public static final GameTimeTaskManager getInstance()
|
||||
{
|
||||
return _instance;
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final GameTimeTaskManager INSTANCE = new GameTimeTaskManager();
|
||||
}
|
||||
}
|
@@ -22,7 +22,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
@@ -31,6 +30,7 @@ import org.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import org.l2jmobius.gameserver.network.ConnectionState;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* Flood protector implementation.
|
||||
@@ -53,7 +53,7 @@ public class FloodProtectorAction
|
||||
/**
|
||||
* Next game tick when new request is allowed.
|
||||
*/
|
||||
private volatile int _nextGameTick = GameTimeController.getInstance().getGameTicks();
|
||||
private volatile int _nextGameTick = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
/**
|
||||
* Request counter.
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class FloodProtectorAction
|
||||
*/
|
||||
public boolean tryPerformAction(String command)
|
||||
{
|
||||
final int curTick = GameTimeController.getInstance().getGameTicks();
|
||||
final int curTick = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
if ((_client.getPlayer() != null) && _client.getPlayer().canOverrideCond(PlayerCondOverride.FLOOD_CONDITIONS))
|
||||
{
|
||||
return true;
|
||||
@@ -96,7 +96,7 @@ public class FloodProtectorAction
|
||||
{
|
||||
if (_config.LOG_FLOODING && !_logged && LOGGER.isLoggable(Level.WARNING))
|
||||
{
|
||||
log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeController.MILLIS_IN_TICK), " ms after previous command");
|
||||
log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeTaskManager.MILLIS_IN_TICK), " ms after previous command");
|
||||
_logged = true;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class FloodProtectorAction
|
||||
|
||||
if ((_count.get() > 0) && _config.LOG_FLOODING && LOGGER.isLoggable(Level.WARNING))
|
||||
{
|
||||
log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms");
|
||||
log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeTaskManager.MILLIS_IN_TICK), " ms");
|
||||
}
|
||||
|
||||
_nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL;
|
||||
|
Reference in New Issue
Block a user