IdManager rework.
This commit is contained in:
@@ -20,7 +20,7 @@ import java.text.DateFormat;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.handler.IBypassHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.games.Lottery;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -225,7 +225,7 @@ public class Loto implements IBypassHandler
|
||||
sm.addItemName(4442);
|
||||
player.sendPacket(sm);
|
||||
|
||||
final ItemInstance item = new ItemInstance(IdFactory.getNextId(), 4442);
|
||||
final ItemInstance item = new ItemInstance(IdManager.getInstance().getNextId(), 4442);
|
||||
item.setCount(1);
|
||||
item.setCustomType1(lotonumber);
|
||||
item.setEnchantLevel(enchant);
|
||||
|
||||
@@ -91,7 +91,6 @@ import org.l2jmobius.gameserver.datatables.SchemeBufferTable;
|
||||
import org.l2jmobius.gameserver.datatables.SpawnTable;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.handler.EffectHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.AirShipManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.BoatManager;
|
||||
@@ -113,6 +112,7 @@ import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FourSepulchersManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ItemAuctionManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
|
||||
@@ -202,9 +202,9 @@ public class GameServer
|
||||
printSection("ThreadPool");
|
||||
ThreadPool.init();
|
||||
|
||||
printSection("IdFactory");
|
||||
IdFactory.init();
|
||||
if (!IdFactory.hasInitialized())
|
||||
printSection("IdManager");
|
||||
IdManager.getInstance();
|
||||
if (!IdManager.hasInitialized())
|
||||
{
|
||||
LOGGER.severe(getClass().getSimpleName() + ": Could not read object IDs from database. Please check your configuration.");
|
||||
throw new Exception("Could not initialize the ID factory!");
|
||||
@@ -425,7 +425,7 @@ public class GameServer
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(Shutdown.getInstance());
|
||||
|
||||
LOGGER.info("IdFactory: Free ObjectID's remaining: " + IdFactory.size());
|
||||
LOGGER.info("IdManager: Free ObjectID's remaining: " + IdManager.size());
|
||||
|
||||
TvTManager.getInstance();
|
||||
|
||||
|
||||
@@ -32,11 +32,11 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.CHSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ClanHallAuctionManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
@@ -197,7 +197,7 @@ public class ClanTable
|
||||
return null;
|
||||
}
|
||||
|
||||
final Clan clan = new Clan(IdFactory.getNextId(), clanName);
|
||||
final Clan clan = new Clan(IdManager.getInstance().getNextId(), clanName);
|
||||
final ClanMember leader = new ClanMember(clan, player);
|
||||
clan.setLeader(leader);
|
||||
leader.setPlayerInstance(player);
|
||||
@@ -272,7 +272,7 @@ public class ClanTable
|
||||
}
|
||||
|
||||
_clans.remove(clanId);
|
||||
IdFactory.releaseId(clanId);
|
||||
IdManager.getInstance().releaseId(clanId);
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.engines.DocumentEngine;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
@@ -204,7 +204,7 @@ public class ItemTable
|
||||
public ItemInstance createItem(String process, int itemId, long count, Creature actor, Object reference)
|
||||
{
|
||||
// Create and Init the ItemInstance corresponding to the Item Identifier
|
||||
final ItemInstance item = new ItemInstance(IdFactory.getNextId(), itemId);
|
||||
final ItemInstance item = new ItemInstance(IdManager.getInstance().getNextId(), itemId);
|
||||
if (process.equalsIgnoreCase("loot") && !Config.AUTO_LOOT_ITEM_IDS.contains(itemId))
|
||||
{
|
||||
ScheduledFuture<?> itemLootShedule;
|
||||
@@ -319,7 +319,7 @@ public class ItemTable
|
||||
item.setLastChange(ItemInstance.REMOVED);
|
||||
|
||||
World.getInstance().removeObject(item);
|
||||
IdFactory.releaseId(item.getObjectId());
|
||||
IdManager.getInstance().releaseId(item.getObjectId());
|
||||
|
||||
if (Config.LOG_ITEMS)
|
||||
{
|
||||
|
||||
@@ -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.idfactory;
|
||||
package org.l2jmobius.gameserver.instancemanager;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -33,40 +33,12 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.util.PrimeFinder;
|
||||
|
||||
/**
|
||||
* @author Mobius (reworked from L2J version)
|
||||
* @author Mobius (reworked from L2J IdFactory)
|
||||
*/
|
||||
public abstract class IdFactory
|
||||
public class IdManager
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(IdFactory.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(IdManager.class.getName());
|
||||
|
||||
protected static final String[] ID_CHECKS =
|
||||
{
|
||||
"SELECT owner_id FROM items WHERE object_id >= ? AND object_id < ?",
|
||||
"SELECT object_id FROM items WHERE object_id >= ? AND object_id < ?",
|
||||
"SELECT charId FROM character_quests WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_contacts WHERE charId >= ? AND charId < ?",
|
||||
"SELECT contactId FROM character_contacts WHERE contactId >= ? AND contactId < ?",
|
||||
"SELECT charId FROM character_friends WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_friends WHERE friendId >= ? AND friendId < ?",
|
||||
"SELECT charId FROM character_hennas WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_recipebook WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_recipeshoplist WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_shortcuts WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_macroses WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_skills WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_skills_save WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_subclasses WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_ui_actions WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM character_ui_categories WHERE charId >= ? AND charId < ?",
|
||||
"SELECT charId FROM characters WHERE charId >= ? AND charId < ?",
|
||||
"SELECT clanid FROM characters WHERE clanid >= ? AND clanid < ?",
|
||||
"SELECT clan_id FROM clan_data WHERE clan_id >= ? AND clan_id < ?",
|
||||
"SELECT clan_id FROM siege_clans WHERE clan_id >= ? AND clan_id < ?",
|
||||
"SELECT ally_id FROM clan_data WHERE ally_id >= ? AND ally_id < ?",
|
||||
"SELECT leader_id FROM clan_data WHERE leader_id >= ? AND leader_id < ?",
|
||||
"SELECT item_obj_id FROM pets WHERE item_obj_id >= ? AND item_obj_id < ?",
|
||||
"SELECT object_id FROM itemsonground WHERE object_id >= ? AND object_id < ?"
|
||||
};
|
||||
//@formatter:off
|
||||
private static final String[][] ID_EXTRACTS =
|
||||
{
|
||||
@@ -77,21 +49,23 @@ public abstract class IdFactory
|
||||
{"messages","messageId"}
|
||||
};
|
||||
//@formatter:on
|
||||
|
||||
private static final String[] TIMESTAMPS_CLEAN =
|
||||
{
|
||||
"DELETE FROM character_instance_time WHERE time <= ?",
|
||||
"DELETE FROM character_skills_save WHERE restore_type = 1 AND systime <= ?"
|
||||
};
|
||||
public static final int FIRST_OID = 0x10000000;
|
||||
public static final int LAST_OID = 0x7FFFFFFF;
|
||||
public static final int FREE_OBJECT_ID_SIZE = LAST_OID - FIRST_OID;
|
||||
|
||||
private static final int FIRST_OID = 0x10000000;
|
||||
private static final int LAST_OID = 0x7FFFFFFF;
|
||||
private static final int FREE_OBJECT_ID_SIZE = LAST_OID - FIRST_OID;
|
||||
|
||||
private static BitSet _freeIds;
|
||||
private static AtomicInteger _freeIdCount;
|
||||
private static AtomicInteger _nextFreeId;
|
||||
private static boolean _initialized;
|
||||
|
||||
public static void init()
|
||||
public IdManager()
|
||||
{
|
||||
// Update characters online status.
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
@@ -102,7 +76,7 @@ public abstract class IdFactory
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("IdFactory: Could not update characters online status: " + e);
|
||||
LOGGER.warning("IdManager: Could not update characters online status: " + e);
|
||||
}
|
||||
|
||||
// Cleanup database.
|
||||
@@ -201,11 +175,11 @@ public abstract class IdFactory
|
||||
statement.executeUpdate("UPDATE clanhall SET ownerId=0, paidUntil=0, paid=0 WHERE clanhall.ownerId NOT IN (SELECT clan_id FROM clan_data);");
|
||||
statement.executeUpdate("UPDATE fort SET owner=0 WHERE owner NOT IN (SELECT clan_id FROM clan_data);");
|
||||
|
||||
LOGGER.info("IdFactory: Cleaned " + cleanCount + " elements from database in " + ((System.currentTimeMillis() - cleanupStart) / 1000) + " seconds.");
|
||||
LOGGER.info("IdManager: Cleaned " + cleanCount + " elements from database in " + ((System.currentTimeMillis() - cleanupStart) / 1000) + " seconds.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("IdFactory: Could not clean up database: " + e);
|
||||
LOGGER.warning("IdManager: Could not clean up database: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,11 +195,11 @@ public abstract class IdFactory
|
||||
cleanCount += statement.executeUpdate();
|
||||
}
|
||||
}
|
||||
LOGGER.info("IdFactory: Cleaned " + cleanCount + " expired timestamps from database.");
|
||||
LOGGER.info("IdManager: Cleaned " + cleanCount + " expired timestamps from database.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("IdFactory: Could not clean expired timestamps from database. " + e);
|
||||
LOGGER.warning("IdManager: Could not clean expired timestamps from database. " + e);
|
||||
}
|
||||
|
||||
// Initialize.
|
||||
@@ -262,7 +236,7 @@ public abstract class IdFactory
|
||||
final int objectId = usedObjectId - FIRST_OID;
|
||||
if (objectId < 0)
|
||||
{
|
||||
LOGGER.warning("IdFactory: Object ID " + usedObjectId + " in DB is less than minimum ID of " + FIRST_OID);
|
||||
LOGGER.warning("IdManager: Object ID " + usedObjectId + " in DB is less than minimum ID of " + FIRST_OID);
|
||||
continue;
|
||||
}
|
||||
_freeIds.set(usedObjectId - FIRST_OID);
|
||||
@@ -275,7 +249,7 @@ public abstract class IdFactory
|
||||
catch (Exception e)
|
||||
{
|
||||
_initialized = false;
|
||||
LOGGER.severe("IdFactory: Could not be initialized properly: " + e.getMessage());
|
||||
LOGGER.severe("IdManager: Could not be initialized properly: " + e.getMessage());
|
||||
}
|
||||
|
||||
// Schedule increase capacity task.
|
||||
@@ -290,10 +264,10 @@ public abstract class IdFactory
|
||||
}
|
||||
}, 30000, 30000);
|
||||
|
||||
LOGGER.info("IdFactory: " + _freeIds.size() + " id's available.");
|
||||
LOGGER.info("IdManager: " + _freeIds.size() + " id's available.");
|
||||
}
|
||||
|
||||
public synchronized static void releaseId(int objectId)
|
||||
public void releaseId(int objectId)
|
||||
{
|
||||
synchronized (_nextFreeId)
|
||||
{
|
||||
@@ -304,12 +278,12 @@ public abstract class IdFactory
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning("IdFactory: Release objectID " + objectId + " failed (< " + FIRST_OID + ")");
|
||||
LOGGER.warning("IdManager: Release objectID " + objectId + " failed (< " + FIRST_OID + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized static int getNextId()
|
||||
public int getNextId()
|
||||
{
|
||||
synchronized (_nextFreeId)
|
||||
{
|
||||
@@ -322,7 +296,7 @@ public abstract class IdFactory
|
||||
{
|
||||
if (_freeIds.size() >= FREE_OBJECT_ID_SIZE)
|
||||
{
|
||||
throw new NullPointerException("IdFactory: Ran out of valid ids.");
|
||||
throw new NullPointerException("IdManager: Ran out of valid ids.");
|
||||
}
|
||||
increaseBitSetCapacity();
|
||||
}
|
||||
@@ -332,14 +306,14 @@ public abstract class IdFactory
|
||||
}
|
||||
}
|
||||
|
||||
private static void increaseBitSetCapacity()
|
||||
private void increaseBitSetCapacity()
|
||||
{
|
||||
final BitSet newBitSet = new BitSet(PrimeFinder.nextPrime((usedIdCount() * 11) / 10));
|
||||
newBitSet.or(_freeIds);
|
||||
_freeIds = newBitSet;
|
||||
}
|
||||
|
||||
private static int usedIdCount()
|
||||
private int usedIdCount()
|
||||
{
|
||||
return _freeIdCount.get() - FIRST_OID;
|
||||
}
|
||||
@@ -353,4 +327,14 @@ public abstract class IdFactory
|
||||
{
|
||||
return _initialized;
|
||||
}
|
||||
|
||||
public static IdManager getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final IdManager INSTANCE = new IdManager();
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.entity.Message;
|
||||
@@ -241,7 +240,7 @@ public class MailManager
|
||||
}
|
||||
|
||||
_messages.remove(msgId);
|
||||
IdFactory.releaseId(msgId);
|
||||
IdManager.getInstance().releaseId(msgId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.NpcData;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.DefenderInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -188,7 +187,7 @@ public class MercTicketManager
|
||||
{
|
||||
itemId = ITEM_IDS[i];
|
||||
// create the ticket in the gameworld
|
||||
final ItemInstance dropticket = new ItemInstance(IdFactory.getNextId(), itemId);
|
||||
final ItemInstance dropticket = new ItemInstance(IdManager.getInstance().getNextId(), itemId);
|
||||
dropticket.setItemLocation(ItemLocation.VOID);
|
||||
dropticket.dropMe(null, x, y, z);
|
||||
dropticket.setDropTime(0); // avoids it from being removed by the auto item destroyer
|
||||
@@ -322,7 +321,7 @@ public class MercTicketManager
|
||||
castle.getSiege().getSiegeGuardManager().hireMerc(x, y, z, heading, NPC_IDS[i]);
|
||||
|
||||
// create the ticket in the gameworld
|
||||
final ItemInstance dropticket = new ItemInstance(IdFactory.getNextId(), itemId);
|
||||
final ItemInstance dropticket = new ItemInstance(IdManager.getInstance().getNextId(), itemId);
|
||||
dropticket.setItemLocation(ItemLocation.VOID);
|
||||
dropticket.dropMe(null, x, y, z);
|
||||
dropticket.setDropTime(0); // avoids it from beeing removed by the auto item destroyer
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.SpawnTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
||||
@@ -177,7 +177,7 @@ public class AutoSpawnHandler
|
||||
}
|
||||
}
|
||||
|
||||
final int newId = IdFactory.getNextId();
|
||||
final int newId = IdManager.getInstance().getNextId();
|
||||
newSpawn._objectId = newId;
|
||||
_registeredSpawns.put(newId, newSpawn);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.PetitionState;
|
||||
import org.l2jmobius.gameserver.enums.PetitionType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.PetitionManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -47,7 +47,7 @@ public class Petition
|
||||
|
||||
public Petition(PlayerInstance petitioner, String petitionText, int petitionType)
|
||||
{
|
||||
_id = IdFactory.getNextId();
|
||||
_id = IdManager.getInstance().getNextId();
|
||||
_type = PetitionType.values()[petitionType - 1];
|
||||
_content = petitionText;
|
||||
_petitioner = petitioner;
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.l2jmobius.gameserver.handler.ActionHandler;
|
||||
import org.l2jmobius.gameserver.handler.ActionShiftHandler;
|
||||
import org.l2jmobius.gameserver.handler.IActionHandler;
|
||||
import org.l2jmobius.gameserver.handler.IActionShiftHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -156,8 +156,8 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
|
||||
public void refreshId()
|
||||
{
|
||||
World.getInstance().removeObject(this);
|
||||
IdFactory.releaseId(getObjectId());
|
||||
_objectId = IdFactory.getNextId();
|
||||
IdManager.getInstance().releaseId(getObjectId());
|
||||
_objectId = IdManager.getInstance().getNextId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ import org.l2jmobius.gameserver.enums.ShotType;
|
||||
import org.l2jmobius.gameserver.enums.Team;
|
||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MapRegionManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.QuestManager;
|
||||
@@ -289,7 +289,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
*/
|
||||
public Creature(CreatureTemplate template)
|
||||
{
|
||||
this(IdFactory.getNextId(), template);
|
||||
this(IdManager.getInstance().getNextId(), template);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.concurrent.Future;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.actor.stat.ControllableAirShipStat;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.CreatureTemplate;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -52,7 +52,7 @@ public class ControllableAirShipInstance extends AirShipInstance
|
||||
super(template);
|
||||
setInstanceType(InstanceType.ControllableAirShipInstance);
|
||||
_ownerId = ownerId;
|
||||
_helmId = IdFactory.getNextId(); // not forget to release !
|
||||
_helmId = IdManager.getInstance().getNextId(); // not forget to release !
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -286,8 +286,8 @@ public class ControllableAirShipInstance extends AirShipInstance
|
||||
public void refreshId()
|
||||
{
|
||||
super.refreshId();
|
||||
IdFactory.releaseId(_helmId);
|
||||
_helmId = IdFactory.getNextId();
|
||||
IdManager.getInstance().releaseId(_helmId);
|
||||
_helmId = IdManager.getInstance().getNextId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import org.l2jmobius.gameserver.data.xml.impl.FenceData;
|
||||
import org.l2jmobius.gameserver.enums.FenceState;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@@ -44,7 +44,7 @@ public class FenceInstance extends WorldObject
|
||||
|
||||
public FenceInstance(int x, int y, String name, int width, int length, int height, FenceState state)
|
||||
{
|
||||
super(IdFactory.getNextId());
|
||||
super(IdManager.getInstance().getNextId());
|
||||
|
||||
_xMin = x - (width / 2);
|
||||
_xMax = x + (width / 2);
|
||||
@@ -59,7 +59,7 @@ public class FenceInstance extends WorldObject
|
||||
_heightFences = new int[height - 1];
|
||||
for (int i = 0; i < _heightFences.length; i++)
|
||||
{
|
||||
_heightFences[i] = IdFactory.getNextId();
|
||||
_heightFences[i] = IdManager.getInstance().getNextId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@ import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import org.l2jmobius.gameserver.handler.ItemHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.CoupleManager;
|
||||
@@ -110,6 +109,7 @@ import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.InstanceManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
@@ -866,7 +866,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
private PlayerInstance(PlayerTemplate template, String accountName, PlayerAppearance app)
|
||||
{
|
||||
this(IdFactory.getNextId(), template, accountName, app);
|
||||
this(IdManager.getInstance().getNextId(), template, accountName, app);
|
||||
}
|
||||
|
||||
public void setPvpFlagLasts(long time)
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Locale;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.StringUtil;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace;
|
||||
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace.HistoryInfo;
|
||||
import org.l2jmobius.gameserver.instancemanager.games.MonsterRace.RaceState;
|
||||
@@ -160,7 +160,7 @@ public class RaceManagerInstance extends Npc
|
||||
|
||||
player.setRace(0, 0);
|
||||
player.setRace(1, 0);
|
||||
ItemInstance item = new ItemInstance(IdFactory.getNextId(), 4443);
|
||||
ItemInstance item = new ItemInstance(IdManager.getInstance().getNextId(), 4443);
|
||||
item.setCount(1);
|
||||
item.setEnchantLevel(MonsterRace.getInstance().getRaceNumber());
|
||||
item.setCustomType1(ticket);
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.l2jmobius.gameserver.model.announce;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.script.DateRange;
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ public class EventAnnouncement implements IAnnouncement
|
||||
|
||||
public EventAnnouncement(DateRange range, String content)
|
||||
{
|
||||
_id = IdFactory.getNextId();
|
||||
_id = IdManager.getInstance().getNextId();
|
||||
_range = range;
|
||||
_content = content;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class EventAnnouncement implements IAnnouncement
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
IdFactory.releaseId(_id);
|
||||
IdManager.getInstance().releaseId(_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import org.l2jmobius.gameserver.enums.AuctionItemType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.ClanHallAuctionManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ClanHallManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
@@ -352,7 +352,7 @@ public class Auction
|
||||
{
|
||||
try (PreparedStatement ps = con.prepareStatement("INSERT INTO auction_bid (id, auctionId, bidderId, bidderName, maxBid, clan_name, time_bid) VALUES (?, ?, ?, ?, ?, ?, ?)"))
|
||||
{
|
||||
ps.setInt(1, IdFactory.getNextId());
|
||||
ps.setInt(1, IdManager.getInstance().getNextId());
|
||||
ps.setInt(2, _id);
|
||||
ps.setInt(3, bidder.getClanId());
|
||||
ps.setString(4, bidder.getName());
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ public class Couple
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
|
||||
{
|
||||
_id = IdFactory.getNextId();
|
||||
_id = IdManager.getInstance().getNextId();
|
||||
ps.setInt(1, _id);
|
||||
ps.setInt(2, _player1Id);
|
||||
ps.setInt(3, _player2Id);
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MailManager;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Mail;
|
||||
|
||||
@@ -95,7 +95,7 @@ public class Message
|
||||
*/
|
||||
public Message(int senderId, int receiverId, boolean isCod, String subject, String text, long reqAdena)
|
||||
{
|
||||
_messageId = IdFactory.getNextId();
|
||||
_messageId = IdManager.getInstance().getNextId();
|
||||
_senderId = senderId;
|
||||
_receiverId = receiverId;
|
||||
_subject = subject;
|
||||
@@ -113,7 +113,7 @@ public class Message
|
||||
*/
|
||||
public Message(int receiverId, String subject, String content, SendBySystem sendBySystem)
|
||||
{
|
||||
_messageId = IdFactory.getNextId();
|
||||
_messageId = IdManager.getInstance().getNextId();
|
||||
_senderId = -1;
|
||||
_receiverId = receiverId;
|
||||
_subject = subject;
|
||||
@@ -133,7 +133,7 @@ public class Message
|
||||
*/
|
||||
public Message(Message msg)
|
||||
{
|
||||
_messageId = IdFactory.getNextId();
|
||||
_messageId = IdManager.getInstance().getNextId();
|
||||
_senderId = msg.getSenderId();
|
||||
_receiverId = msg.getSenderId();
|
||||
_subject = "";
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.enums.ShotType;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MercTicketManager;
|
||||
import org.l2jmobius.gameserver.model.Augmentation;
|
||||
@@ -221,7 +221,7 @@ public class ItemInstance extends WorldObject
|
||||
*/
|
||||
public ItemInstance(int itemId)
|
||||
{
|
||||
this(IdFactory.getNextId(), itemId);
|
||||
this(IdManager.getInstance().getNextId(), itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@@ -75,7 +75,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
|
||||
}
|
||||
else
|
||||
{
|
||||
_teamOne[i] = new Participant(IdFactory.getNextId(), 1);
|
||||
_teamOne[i] = new Participant(IdManager.getInstance().getNextId(), 1);
|
||||
}
|
||||
|
||||
if (i < _teamTwoSize)
|
||||
@@ -89,7 +89,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
|
||||
}
|
||||
else
|
||||
{
|
||||
_teamTwo[i] = new Participant(IdFactory.getNextId(), 2);
|
||||
_teamTwo[i] = new Participant(IdManager.getInstance().getNextId(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -444,7 +444,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
|
||||
}
|
||||
else
|
||||
{
|
||||
IdFactory.releaseId(_teamOne[i].getObjectId());
|
||||
IdManager.getInstance().releaseId(_teamOne[i].getObjectId());
|
||||
}
|
||||
|
||||
if (i < _teamTwoSize)
|
||||
@@ -453,7 +453,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
|
||||
}
|
||||
else
|
||||
{
|
||||
IdFactory.releaseId(_teamTwo[i].getObjectId());
|
||||
IdManager.getInstance().releaseId(_teamTwo[i].getObjectId());
|
||||
}
|
||||
|
||||
_teamOne[i] = null;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.zone;
|
||||
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
@@ -50,7 +50,7 @@ public abstract class ZoneForm
|
||||
|
||||
protected final void dropDebugItem(int itemId, int num, int x, int y, int z)
|
||||
{
|
||||
final ItemInstance item = new ItemInstance(IdFactory.getNextId(), itemId);
|
||||
final ItemInstance item = new ItemInstance(IdManager.getInstance().getNextId(), itemId);
|
||||
item.setCount(num);
|
||||
item.spawnMe(x, y, z + 5);
|
||||
ZoneManager.getInstance().getDebugItems().add(item);
|
||||
|
||||
Reference in New Issue
Block a user