GameTimeController class is a task manager.
This commit is contained in:
@@ -81,7 +81,7 @@ public class GameServer extends Thread
|
||||
protected final IdManager _idFactory;
|
||||
protected final SpawnTable _spawnTable;
|
||||
protected final CharNameTable _charNametable;
|
||||
protected final GameTimeController _gameTimeController;
|
||||
protected final GameTimeTaskManager _gameTimeController;
|
||||
protected final Announcements _announcements;
|
||||
protected final MapRegionTable _mapRegions;
|
||||
protected final PriceListTable _pricelist;
|
||||
@@ -176,7 +176,7 @@ public class GameServer extends Thread
|
||||
_modifiers = CharStatTable.getInstance();
|
||||
_world = World.getInstance();
|
||||
_spawnTable = SpawnTable.getInstance();
|
||||
_gameTimeController = GameTimeController.getInstance();
|
||||
_gameTimeController = GameTimeTaskManager.getInstance();
|
||||
_announcements = Announcements.getInstance();
|
||||
_mapRegions = MapRegionTable.getInstance();
|
||||
_pricelist = PriceListTable.getInstance();
|
||||
|
@@ -24,24 +24,17 @@ import org.l2jmobius.gameserver.network.serverpackets.SunRise;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SunSet;
|
||||
import org.l2jmobius.util.Chronos;
|
||||
|
||||
public class GameTimeController extends Thread
|
||||
/**
|
||||
* Game Time task manager class.
|
||||
* @author Forsaiken
|
||||
*/
|
||||
public class GameTimeTaskManager extends Thread
|
||||
{
|
||||
private static GameTimeController _instance;
|
||||
private long _gameStartTime = Chronos.currentTimeMillis() - 3600000L;
|
||||
|
||||
public static GameTimeController getInstance()
|
||||
private GameTimeTaskManager()
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new GameTimeController();
|
||||
_instance.start();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
private GameTimeController()
|
||||
{
|
||||
super("GameTimeController");
|
||||
super("GameTimeTaskManager");
|
||||
}
|
||||
|
||||
public int getGameTime()
|
||||
@@ -77,4 +70,14 @@ public class GameTimeController extends Thread
|
||||
player.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public static final GameTimeTaskManager getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final GameTimeTaskManager INSTANCE = new GameTimeTaskManager();
|
||||
}
|
||||
}
|
@@ -23,7 +23,7 @@ import java.util.Collection;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.data.CharTemplateTable;
|
||||
import org.l2jmobius.gameserver.data.ExperienceTable;
|
||||
import org.l2jmobius.gameserver.model.Clan;
|
||||
@@ -57,7 +57,7 @@ public class CommunityBoardManager
|
||||
{
|
||||
final Collection<PlayerInstance> players = World.getInstance().getAllPlayers();
|
||||
htmlCode.append("<table border=0>");
|
||||
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");
|
||||
|
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
public class CharSelected extends ServerBasePacket
|
||||
@@ -65,6 +65,6 @@ public class CharSelected extends ServerBasePacket
|
||||
{
|
||||
writeD(0);
|
||||
}
|
||||
writeD(GameTimeController.getInstance().getGameTime());
|
||||
writeD(GameTimeTaskManager.getInstance().getGameTime());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user