Use of singleton holders for class instances.
This commit is contained in:
@@ -81,19 +81,9 @@ public class nProtect
|
|||||||
protected Method _sendRequest = null;
|
protected Method _sendRequest = null;
|
||||||
protected Method _closeSession = null;
|
protected Method _closeSession = null;
|
||||||
protected Method _sendGGQuery = null;
|
protected Method _sendGGQuery = null;
|
||||||
private static nProtect _instance = null;
|
|
||||||
|
|
||||||
private static boolean enabled = false;
|
private static boolean enabled = false;
|
||||||
|
|
||||||
public static nProtect getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new nProtect();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private nProtect()
|
private nProtect()
|
||||||
{
|
{
|
||||||
Class<?> clazz = null;
|
Class<?> clazz = null;
|
||||||
@@ -220,4 +210,14 @@ public class nProtect
|
|||||||
{
|
{
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static nProtect getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final nProtect INSTANCE = new nProtect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,18 +42,6 @@ public class NetcoreConfig
|
|||||||
public int CLIENT_PACKET_QUEUE_MAX_UNDERFLOWS_PER_MIN; // default 1
|
public int CLIENT_PACKET_QUEUE_MAX_UNDERFLOWS_PER_MIN; // default 1
|
||||||
public int CLIENT_PACKET_QUEUE_MAX_UNKNOWN_PER_MIN; // default 5
|
public int CLIENT_PACKET_QUEUE_MAX_UNKNOWN_PER_MIN; // default 5
|
||||||
|
|
||||||
// ============================================================
|
|
||||||
private static NetcoreConfig _instance;
|
|
||||||
|
|
||||||
public static NetcoreConfig getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new NetcoreConfig();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private NetcoreConfig()
|
private NetcoreConfig()
|
||||||
{
|
{
|
||||||
final String MMO_CONFIG = "./config/protected/MmoCore.ini";
|
final String MMO_CONFIG = "./config/protected/MmoCore.ini";
|
||||||
@@ -84,4 +72,14 @@ public class NetcoreConfig
|
|||||||
throw new Error("Failed to Load " + MMO_CONFIG + " File.");
|
throw new Error("Failed to Load " + MMO_CONFIG + " File.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NetcoreConfig getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final NetcoreConfig INSTANCE = new NetcoreConfig();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ public class GameServer
|
|||||||
PetitionManager.getInstance();
|
PetitionManager.getInstance();
|
||||||
CursedWeaponsManager.getInstance();
|
CursedWeaponsManager.getInstance();
|
||||||
TaskManager.getInstance();
|
TaskManager.getInstance();
|
||||||
PetDataTable.getInstance().loadPetsData();
|
PetDataTable.getInstance();
|
||||||
if (Config.SAVE_DROPPED_ITEM)
|
if (Config.SAVE_DROPPED_ITEM)
|
||||||
{
|
{
|
||||||
ItemsOnGroundManager.getInstance();
|
ItemsOnGroundManager.getInstance();
|
||||||
|
|||||||
@@ -30,29 +30,12 @@ import org.l2jmobius.gameserver.model.items.type.EtcItemType;
|
|||||||
public class ItemsAutoDestroy
|
public class ItemsAutoDestroy
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(ItemsAutoDestroy.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(ItemsAutoDestroy.class.getName());
|
||||||
private static ItemsAutoDestroy _instance;
|
|
||||||
protected Collection<ItemInstance> _items = null;
|
|
||||||
protected static long _sleep;
|
|
||||||
|
|
||||||
private ItemsAutoDestroy()
|
private final Collection<ItemInstance> _items = ConcurrentHashMap.newKeySet();
|
||||||
{
|
|
||||||
_items = ConcurrentHashMap.newKeySet();
|
|
||||||
_sleep = Config.AUTODESTROY_ITEM_AFTER * 1000;
|
|
||||||
if (_sleep == 0)
|
|
||||||
{
|
|
||||||
_sleep = 3600000;
|
|
||||||
}
|
|
||||||
ThreadPool.scheduleAtFixedRate(new CheckItemsForDestroy(), 5000, 5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemsAutoDestroy getInstance()
|
protected ItemsAutoDestroy()
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
ThreadPool.scheduleAtFixedRate(this::removeItems, 5000, 5000);
|
||||||
{
|
|
||||||
LOGGER.info("Initializing ItemsAutoDestroy.");
|
|
||||||
_instance = new ItemsAutoDestroy();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void addItem(ItemInstance item)
|
public synchronized void addItem(ItemInstance item)
|
||||||
@@ -61,7 +44,7 @@ public class ItemsAutoDestroy
|
|||||||
_items.add(item);
|
_items.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void removeItems()
|
private synchronized void removeItems()
|
||||||
{
|
{
|
||||||
if (_items.isEmpty())
|
if (_items.isEmpty())
|
||||||
{
|
{
|
||||||
@@ -90,7 +73,7 @@ public class ItemsAutoDestroy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((curtime - item.getDropTime()) > _sleep)
|
else if ((curtime - item.getDropTime()) > (Config.AUTODESTROY_ITEM_AFTER * 1000))
|
||||||
{
|
{
|
||||||
World.getInstance().removeVisibleObject(item, item.getWorldRegion());
|
World.getInstance().removeVisibleObject(item, item.getWorldRegion());
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
@@ -104,12 +87,13 @@ public class ItemsAutoDestroy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class CheckItemsForDestroy extends Thread
|
public static ItemsAutoDestroy getInstance()
|
||||||
{
|
{
|
||||||
@Override
|
return SingletonHolder.INSTANCE;
|
||||||
public void run()
|
}
|
||||||
{
|
|
||||||
removeItems();
|
private static class SingletonHolder
|
||||||
}
|
{
|
||||||
|
protected static final ItemsAutoDestroy INSTANCE = new ItemsAutoDestroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,8 +62,6 @@ public class LoginServerThread extends Thread
|
|||||||
protected static final Logger LOGGER = Logger.getLogger(LoginServerThread.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(LoginServerThread.class.getName());
|
||||||
|
|
||||||
/** The LoginServerThread singleton */
|
/** The LoginServerThread singleton */
|
||||||
private static LoginServerThread _instance;
|
|
||||||
|
|
||||||
private static final int REVISION = 0x0102;
|
private static final int REVISION = 0x0102;
|
||||||
private RSAPublicKey _publicKey;
|
private RSAPublicKey _publicKey;
|
||||||
private final String _hostname;
|
private final String _hostname;
|
||||||
@@ -122,15 +120,6 @@ public class LoginServerThread extends Thread
|
|||||||
_maxPlayer = Config.MAXIMUM_ONLINE_USERS;
|
_maxPlayer = Config.MAXIMUM_ONLINE_USERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoginServerThread getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new LoginServerThread();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
@@ -207,7 +196,7 @@ public class LoginServerThread extends Thread
|
|||||||
final int packetType = decrypt[0] & 0xff;
|
final int packetType = decrypt[0] & 0xff;
|
||||||
switch (packetType)
|
switch (packetType)
|
||||||
{
|
{
|
||||||
case 00:
|
case 0x00:
|
||||||
{
|
{
|
||||||
final InitLS init = new InitLS(decrypt);
|
final InitLS init = new InitLS(decrypt);
|
||||||
if (init.getRevision() != REVISION)
|
if (init.getRevision() != REVISION)
|
||||||
@@ -225,7 +214,7 @@ public class LoginServerThread extends Thread
|
|||||||
}
|
}
|
||||||
catch (GeneralSecurityException e)
|
catch (GeneralSecurityException e)
|
||||||
{
|
{
|
||||||
LOGGER.warning("Troubles while init the public key send by login");
|
LOGGER.warning("Trouble while init the public key send by login");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// send the blowfish key through the rsa encryption
|
// send the blowfish key through the rsa encryption
|
||||||
@@ -239,14 +228,14 @@ public class LoginServerThread extends Thread
|
|||||||
sendPacket(ar);
|
sendPacket(ar);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 01:
|
case 0x01:
|
||||||
{
|
{
|
||||||
final LoginServerFail lsf = new LoginServerFail(decrypt);
|
final LoginServerFail lsf = new LoginServerFail(decrypt);
|
||||||
LOGGER.info("Damn! Registeration Failed: " + lsf.getReasonString());
|
LOGGER.info("Damn! Registeration Failed: " + lsf.getReasonString());
|
||||||
// login will close the connection here
|
// login will close the connection here
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 02:
|
case 0x02:
|
||||||
{
|
{
|
||||||
final AuthResponse aresp = new AuthResponse(decrypt);
|
final AuthResponse aresp = new AuthResponse(decrypt);
|
||||||
_serverID = aresp.getServerId();
|
_serverID = aresp.getServerId();
|
||||||
@@ -299,7 +288,7 @@ public class LoginServerThread extends Thread
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 03:
|
case 0x03:
|
||||||
{
|
{
|
||||||
final PlayerAuthResponse par = new PlayerAuthResponse(decrypt);
|
final PlayerAuthResponse par = new PlayerAuthResponse(decrypt);
|
||||||
final String account = par.getAccount();
|
final String account = par.getAccount();
|
||||||
@@ -345,7 +334,7 @@ public class LoginServerThread extends Thread
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 04:
|
case 0x04:
|
||||||
{
|
{
|
||||||
KickPlayer kp = new KickPlayer(decrypt);
|
KickPlayer kp = new KickPlayer(decrypt);
|
||||||
doKickPlayer(kp.getAccount());
|
doKickPlayer(kp.getAccount());
|
||||||
@@ -708,4 +697,18 @@ public class LoginServerThread extends Thread
|
|||||||
{
|
{
|
||||||
return _interrupted;
|
return _interrupted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the single instance of LoginServerThread.
|
||||||
|
* @return single instance of LoginServerThread
|
||||||
|
*/
|
||||||
|
public static LoginServerThread getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final LoginServerThread INSTANCE = new LoginServerThread();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ public class Shutdown extends Thread
|
|||||||
|
|
||||||
protected static final Logger LOGGER = Logger.getLogger(Shutdown.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(Shutdown.class.getName());
|
||||||
|
|
||||||
private static Shutdown _instance;
|
|
||||||
private static Shutdown _counterInstance = null;
|
private static Shutdown _counterInstance = null;
|
||||||
|
|
||||||
private int _secondsShut;
|
private int _secondsShut;
|
||||||
@@ -81,13 +80,9 @@ public class Shutdown extends Thread
|
|||||||
|
|
||||||
private boolean _shutdownStarted;
|
private boolean _shutdownStarted;
|
||||||
|
|
||||||
/** 0 */
|
|
||||||
public static final int SIGTERM = 0;
|
public static final int SIGTERM = 0;
|
||||||
/** 1 */
|
|
||||||
public static final int GM_SHUTDOWN = 1;
|
public static final int GM_SHUTDOWN = 1;
|
||||||
/** 2 */
|
|
||||||
public static final int GM_RESTART = 2;
|
public static final int GM_RESTART = 2;
|
||||||
/** 3 */
|
|
||||||
public static final int ABORT = 3;
|
public static final int ABORT = 3;
|
||||||
|
|
||||||
private static final String[] MODE_TEXT =
|
private static final String[] MODE_TEXT =
|
||||||
@@ -132,19 +127,6 @@ public class Shutdown extends Thread
|
|||||||
_shutdownStarted = false;
|
_shutdownStarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get the shutdown-hook instance the shutdown-hook instance is created by the first call of this function, but it has to be registered externally.
|
|
||||||
* @return instance of Shutdown, to be used as shutdown hook
|
|
||||||
*/
|
|
||||||
public static Shutdown getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new Shutdown();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isShutdownStarted()
|
public boolean isShutdownStarted()
|
||||||
{
|
{
|
||||||
boolean output = _shutdownStarted;
|
boolean output = _shutdownStarted;
|
||||||
@@ -165,7 +147,7 @@ public class Shutdown extends Thread
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (this == _instance)
|
if (this == getInstance())
|
||||||
{
|
{
|
||||||
closeServer();
|
closeServer();
|
||||||
}
|
}
|
||||||
@@ -373,7 +355,7 @@ public class Shutdown extends Thread
|
|||||||
|
|
||||||
LOGGER.info("[STATUS] Server shutdown successfully.");
|
LOGGER.info("[STATUS] Server shutdown successfully.");
|
||||||
|
|
||||||
if (_instance._shutdownMode == GM_RESTART)
|
if (getInstance()._shutdownMode == GM_RESTART)
|
||||||
{
|
{
|
||||||
Runtime.getRuntime().halt(2);
|
Runtime.getRuntime().halt(2);
|
||||||
}
|
}
|
||||||
@@ -557,4 +539,18 @@ public class Shutdown extends Thread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the shutdown-hook instance the shutdown-hook instance is created by the first call of this function, but it has to be registered externally.<br>
|
||||||
|
* @return instance of Shutdown, to be used as shutdown hook
|
||||||
|
*/
|
||||||
|
public static Shutdown getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final Shutdown INSTANCE = new Shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ import org.l2jmobius.gameserver.model.actor.instance.ItemInstance;
|
|||||||
public class TradeController
|
public class TradeController
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(TradeController.class.getName());
|
private static Logger LOGGER = Logger.getLogger(TradeController.class.getName());
|
||||||
private static TradeController _instance;
|
|
||||||
|
|
||||||
private int _nextListId;
|
private int _nextListId;
|
||||||
private final Map<Integer, StoreTradeList> _lists;
|
private final Map<Integer, StoreTradeList> _lists;
|
||||||
@@ -73,15 +72,6 @@ public class TradeController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TradeController getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new TradeController();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TradeController()
|
private TradeController()
|
||||||
{
|
{
|
||||||
_lists = new HashMap<>();
|
_lists = new HashMap<>();
|
||||||
@@ -625,11 +615,13 @@ public class TradeController
|
|||||||
return _nextListId++;
|
return _nextListId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static TradeController getInstance()
|
||||||
* This will reload buylists info from DataBase
|
|
||||||
*/
|
|
||||||
public static void reload()
|
|
||||||
{
|
{
|
||||||
_instance = new TradeController();
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TradeController INSTANCE = new TradeController();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,29 +41,13 @@ public class CrestCache
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(CrestCache.class.getName());
|
private static Logger LOGGER = Logger.getLogger(CrestCache.class.getName());
|
||||||
|
|
||||||
private static CrestCache _instance;
|
|
||||||
|
|
||||||
private final Map<Integer, byte[]> _cachePledge = new HashMap<>();
|
private final Map<Integer, byte[]> _cachePledge = new HashMap<>();
|
||||||
|
|
||||||
private final Map<Integer, byte[]> _cachePledgeLarge = new HashMap<>();
|
private final Map<Integer, byte[]> _cachePledgeLarge = new HashMap<>();
|
||||||
|
|
||||||
private final Map<Integer, byte[]> _cacheAlly = new HashMap<>();
|
private final Map<Integer, byte[]> _cacheAlly = new HashMap<>();
|
||||||
|
|
||||||
private int _loadedFiles;
|
private int _loadedFiles;
|
||||||
|
|
||||||
private long _bytesBuffLen;
|
private long _bytesBuffLen;
|
||||||
|
|
||||||
public static CrestCache getInstance()
|
private CrestCache()
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new CrestCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CrestCache()
|
|
||||||
{
|
{
|
||||||
convertOldPedgeFiles();
|
convertOldPedgeFiles();
|
||||||
reload();
|
reload();
|
||||||
@@ -394,4 +378,14 @@ public class CrestCache
|
|||||||
return file.getName().startsWith("Pledge_");
|
return file.getName().startsWith("Pledge_");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CrestCache getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final CrestCache INSTANCE = new CrestCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,24 +33,12 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
public class HtmCache
|
public class HtmCache
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(HtmCache.class.getName());
|
private static Logger LOGGER = Logger.getLogger(HtmCache.class.getName());
|
||||||
private static HtmCache _instance;
|
|
||||||
|
|
||||||
private final Map<Integer, String> _cache;
|
private final Map<Integer, String> _cache;
|
||||||
|
|
||||||
private int _loadedFiles;
|
private int _loadedFiles;
|
||||||
private long _bytesBuffLen;
|
private long _bytesBuffLen;
|
||||||
|
|
||||||
public static HtmCache getInstance()
|
private HtmCache()
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new HtmCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HtmCache()
|
|
||||||
{
|
{
|
||||||
_cache = new HashMap<>();
|
_cache = new HashMap<>();
|
||||||
reload();
|
reload();
|
||||||
@@ -248,4 +236,14 @@ public class HtmCache
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HtmCache getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final HtmCache INSTANCE = new HtmCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,20 +28,9 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
*/
|
*/
|
||||||
public class WarehouseCacheManager
|
public class WarehouseCacheManager
|
||||||
{
|
{
|
||||||
private static WarehouseCacheManager _instance;
|
|
||||||
protected final Map<PlayerInstance, Long> _cachedWh;
|
protected final Map<PlayerInstance, Long> _cachedWh;
|
||||||
protected final long _cacheTime;
|
protected final long _cacheTime;
|
||||||
|
|
||||||
public static WarehouseCacheManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new WarehouseCacheManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private WarehouseCacheManager()
|
private WarehouseCacheManager()
|
||||||
{
|
{
|
||||||
_cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000; // 60*1000 = 60000
|
_cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000; // 60*1000 = 60000
|
||||||
@@ -75,4 +64,14 @@ public class WarehouseCacheManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static WarehouseCacheManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final WarehouseCacheManager INSTANCE = new WarehouseCacheManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import org.l2jmobius.gameserver.model.Skill;
|
|||||||
*/
|
*/
|
||||||
public class HeroSkillTable
|
public class HeroSkillTable
|
||||||
{
|
{
|
||||||
private static HeroSkillTable _instance;
|
|
||||||
private static Skill[] _heroSkills;
|
private static Skill[] _heroSkills;
|
||||||
|
|
||||||
private HeroSkillTable()
|
private HeroSkillTable()
|
||||||
@@ -36,16 +35,6 @@ public class HeroSkillTable
|
|||||||
_heroSkills[4] = SkillTable.getInstance().getInfo(1376, 1);
|
_heroSkills[4] = SkillTable.getInstance().getInfo(1376, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HeroSkillTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new HeroSkillTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Skill[] getHeroSkills()
|
public static Skill[] getHeroSkills()
|
||||||
{
|
{
|
||||||
return _heroSkills;
|
return _heroSkills;
|
||||||
@@ -72,4 +61,14 @@ public class HeroSkillTable
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HeroSkillTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final HeroSkillTable INSTANCE = new HeroSkillTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,27 +27,16 @@ import org.l2jmobius.gameserver.model.actor.instance.ControllableMobInstance;
|
|||||||
*/
|
*/
|
||||||
public class MobGroupTable
|
public class MobGroupTable
|
||||||
{
|
{
|
||||||
private static MobGroupTable _instance;
|
|
||||||
private final Map<Integer, MobGroup> _groupMap;
|
private final Map<Integer, MobGroup> _groupMap;
|
||||||
|
|
||||||
public static final int FOLLOW_RANGE = 300;
|
public static final int FOLLOW_RANGE = 300;
|
||||||
public static final int RANDOM_RANGE = 300;
|
public static final int RANDOM_RANGE = 300;
|
||||||
|
|
||||||
public MobGroupTable()
|
private MobGroupTable()
|
||||||
{
|
{
|
||||||
_groupMap = new HashMap<>();
|
_groupMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MobGroupTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new MobGroupTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addGroup(int groupKey, MobGroup group)
|
public void addGroup(int groupKey, MobGroup group)
|
||||||
{
|
{
|
||||||
_groupMap.put(groupKey, group);
|
_groupMap.put(groupKey, group);
|
||||||
@@ -85,4 +74,14 @@ public class MobGroupTable
|
|||||||
{
|
{
|
||||||
return _groupMap.remove(groupKey) != null;
|
return _groupMap.remove(groupKey) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MobGroupTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final MobGroupTable INSTANCE = new MobGroupTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import org.l2jmobius.gameserver.model.Skill;
|
|||||||
*/
|
*/
|
||||||
public class NobleSkillTable
|
public class NobleSkillTable
|
||||||
{
|
{
|
||||||
private static NobleSkillTable _instance;
|
|
||||||
private static Skill[] _nobleSkills;
|
private static Skill[] _nobleSkills;
|
||||||
|
|
||||||
private NobleSkillTable()
|
private NobleSkillTable()
|
||||||
@@ -39,18 +38,18 @@ public class NobleSkillTable
|
|||||||
_nobleSkills[7] = SkillTable.getInstance().getInfo(1327, 1);
|
_nobleSkills[7] = SkillTable.getInstance().getInfo(1327, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NobleSkillTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new NobleSkillTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Skill[] GetNobleSkills()
|
public Skill[] GetNobleSkills()
|
||||||
{
|
{
|
||||||
return _nobleSkills;
|
return _nobleSkills;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NobleSkillTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final NobleSkillTable INSTANCE = new NobleSkillTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,31 +25,18 @@ import org.l2jmobius.gameserver.model.items.type.WeaponType;
|
|||||||
|
|
||||||
public class SkillTable
|
public class SkillTable
|
||||||
{
|
{
|
||||||
// private static Logger LOGGER = Logger.getLogger(SkillTable.class);
|
private final Map<Integer, Skill> _skills = new HashMap<>();
|
||||||
private static SkillTable _instance;
|
|
||||||
|
|
||||||
private final Map<Integer, Skill> _skills;
|
|
||||||
private final boolean _initialized = true;
|
private final boolean _initialized = true;
|
||||||
|
|
||||||
public static SkillTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new SkillTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SkillTable()
|
private SkillTable()
|
||||||
{
|
{
|
||||||
_skills = new HashMap<>();
|
reload();
|
||||||
DocumentEngine.getInstance().loadAllSkills(_skills);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reload()
|
public void reload()
|
||||||
{
|
{
|
||||||
_instance = new SkillTable();
|
_skills.clear();
|
||||||
|
DocumentEngine.getInstance().loadAllSkills(_skills);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInitialized()
|
public boolean isInitialized()
|
||||||
@@ -135,4 +122,14 @@ public class SkillTable
|
|||||||
|
|
||||||
return weaponsAllowed;
|
return weaponsAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SkillTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final SkillTable INSTANCE = new SkillTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,18 +38,6 @@ public class ExtractableItemsData
|
|||||||
// Map<itemid, ExtractableItem>
|
// Map<itemid, ExtractableItem>
|
||||||
private Map<Integer, ExtractableItem> _items;
|
private Map<Integer, ExtractableItem> _items;
|
||||||
|
|
||||||
private static ExtractableItemsData _instance = null;
|
|
||||||
|
|
||||||
public static ExtractableItemsData getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new ExtractableItemsData();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ExtractableItemsData()
|
public ExtractableItemsData()
|
||||||
{
|
{
|
||||||
_items = new HashMap<>();
|
_items = new HashMap<>();
|
||||||
@@ -176,4 +164,14 @@ public class ExtractableItemsData
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ExtractableItemsData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final ExtractableItemsData INSTANCE = new ExtractableItemsData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,18 +37,12 @@ import org.l2jmobius.gameserver.model.FishData;
|
|||||||
public class FishTable
|
public class FishTable
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(SkillTreeTable.class.getName());
|
private static Logger LOGGER = Logger.getLogger(SkillTreeTable.class.getName());
|
||||||
private static final FishTable INSTANCE = new FishTable();
|
|
||||||
|
|
||||||
private static List<FishData> _fishsNormal;
|
private static List<FishData> _fishsNormal;
|
||||||
private static List<FishData> _fishsEasy;
|
private static List<FishData> _fishsEasy;
|
||||||
private static List<FishData> _fishsHard;
|
private static List<FishData> _fishsHard;
|
||||||
public static FishData fish;
|
public static FishData fish;
|
||||||
|
|
||||||
public static FishTable getInstance()
|
|
||||||
{
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private FishTable()
|
private FishTable()
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -221,4 +215,14 @@ public class FishTable
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FishTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final FishTable INSTANCE = new FishTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,28 +31,13 @@ import org.l2jmobius.Config;
|
|||||||
import org.l2jmobius.gameserver.model.StatsSet;
|
import org.l2jmobius.gameserver.model.StatsSet;
|
||||||
import org.l2jmobius.gameserver.model.items.Henna;
|
import org.l2jmobius.gameserver.model.items.Henna;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version $Revision$ $Date$
|
|
||||||
*/
|
|
||||||
public class HennaTable
|
public class HennaTable
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(HennaTable.class.getName());
|
private static Logger LOGGER = Logger.getLogger(HennaTable.class.getName());
|
||||||
|
|
||||||
private static HennaTable _instance;
|
|
||||||
|
|
||||||
private final Map<Integer, Henna> _henna;
|
private final Map<Integer, Henna> _henna;
|
||||||
private final boolean _initialized = true;
|
private final boolean _initialized = true;
|
||||||
|
|
||||||
public static HennaTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new HennaTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private HennaTable()
|
private HennaTable()
|
||||||
{
|
{
|
||||||
_henna = new HashMap<>();
|
_henna = new HashMap<>();
|
||||||
@@ -163,4 +148,13 @@ public class HennaTable
|
|||||||
return _henna.get(id);
|
return _henna.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HennaTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final HennaTable INSTANCE = new HennaTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,10 +49,7 @@ public class MapRegionTable
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(MapRegionTable.class.getName());
|
private static Logger LOGGER = Logger.getLogger(MapRegionTable.class.getName());
|
||||||
|
|
||||||
private static MapRegionTable _instance;
|
|
||||||
|
|
||||||
private final int[][] _regions = new int[19][21];
|
private final int[][] _regions = new int[19][21];
|
||||||
|
|
||||||
private final int[][] _pointsWithKarmas;
|
private final int[][] _pointsWithKarmas;
|
||||||
|
|
||||||
public enum TeleportWhereType
|
public enum TeleportWhereType
|
||||||
@@ -64,16 +61,6 @@ public class MapRegionTable
|
|||||||
Fortress
|
Fortress
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MapRegionTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new MapRegionTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private MapRegionTable()
|
private MapRegionTable()
|
||||||
{
|
{
|
||||||
FileReader reader = null;
|
FileReader reader = null;
|
||||||
@@ -620,4 +607,14 @@ public class MapRegionTable
|
|||||||
coord = local_zone.getSpawnLoc();
|
coord = local_zone.getSpawnLoc();
|
||||||
return new Location(coord[0], coord[1], coord[2]);
|
return new Location(coord[0], coord[1], coord[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MapRegionTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final MapRegionTable INSTANCE = new MapRegionTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,24 +39,10 @@ public class NpcWalkerRoutesTable
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(NpcWalkerRoutesTable.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(NpcWalkerRoutesTable.class.getName());
|
||||||
|
|
||||||
private static NpcWalkerRoutesTable _instance;
|
|
||||||
|
|
||||||
private List<NpcWalkerNode> _routes;
|
private List<NpcWalkerNode> _routes;
|
||||||
|
|
||||||
public static NpcWalkerRoutesTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new NpcWalkerRoutesTable();
|
|
||||||
LOGGER.info("Initializing Walkers Routes Table.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private NpcWalkerRoutesTable()
|
private NpcWalkerRoutesTable()
|
||||||
{
|
{
|
||||||
// not here
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load()
|
public void load()
|
||||||
@@ -166,7 +152,6 @@ public class NpcWalkerRoutesTable
|
|||||||
public List<NpcWalkerNode> getRouteForNpc(int id)
|
public List<NpcWalkerNode> getRouteForNpc(int id)
|
||||||
{
|
{
|
||||||
final List<NpcWalkerNode> _return = new ArrayList<>();
|
final List<NpcWalkerNode> _return = new ArrayList<>();
|
||||||
|
|
||||||
for (NpcWalkerNode node : _routes)
|
for (NpcWalkerNode node : _routes)
|
||||||
{
|
{
|
||||||
if (node.getNpcId() == id)
|
if (node.getNpcId() == id)
|
||||||
@@ -174,7 +159,16 @@ public class NpcWalkerRoutesTable
|
|||||||
_return.add(node);
|
_return.add(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _return;
|
return _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NpcWalkerRoutesTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final NpcWalkerRoutesTable INSTANCE = new NpcWalkerRoutesTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,20 +38,9 @@ import org.l2jmobius.gameserver.model.actor.instance.RecipeInstance;
|
|||||||
public class RecipeTable extends RecipeController
|
public class RecipeTable extends RecipeController
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(RecipeTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(RecipeTable.class.getName());
|
||||||
|
|
||||||
private final Map<Integer, RecipeList> _lists;
|
private final Map<Integer, RecipeList> _lists;
|
||||||
|
|
||||||
private static RecipeTable instance;
|
|
||||||
|
|
||||||
public static RecipeTable getInstance()
|
|
||||||
{
|
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
instance = new RecipeTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private RecipeTable()
|
private RecipeTable()
|
||||||
{
|
{
|
||||||
_lists = new HashMap<>();
|
_lists = new HashMap<>();
|
||||||
@@ -232,4 +221,14 @@ public class RecipeTable extends RecipeController
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RecipeTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final RecipeTable INSTANCE = new RecipeTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,19 +34,8 @@ public class StaticObjects
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(StaticObjects.class.getName());
|
private static Logger LOGGER = Logger.getLogger(StaticObjects.class.getName());
|
||||||
|
|
||||||
private static StaticObjects _instance;
|
|
||||||
private final Map<Integer, StaticObjectInstance> _staticObjects;
|
private final Map<Integer, StaticObjectInstance> _staticObjects;
|
||||||
|
|
||||||
public static StaticObjects getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new StaticObjects();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StaticObjects()
|
public StaticObjects()
|
||||||
{
|
{
|
||||||
_staticObjects = new HashMap<>();
|
_staticObjects = new HashMap<>();
|
||||||
@@ -152,4 +141,14 @@ public class StaticObjects
|
|||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static StaticObjects getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final StaticObjects INSTANCE = new StaticObjects();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,18 +31,6 @@ public class SummonItemsData
|
|||||||
|
|
||||||
private final Map<Integer, SummonItem> _summonitems;
|
private final Map<Integer, SummonItem> _summonitems;
|
||||||
|
|
||||||
private static SummonItemsData _instance;
|
|
||||||
|
|
||||||
public static SummonItemsData getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new SummonItemsData();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SummonItemsData()
|
public SummonItemsData()
|
||||||
{
|
{
|
||||||
_summonitems = new HashMap<>();
|
_summonitems = new HashMap<>();
|
||||||
@@ -132,4 +120,14 @@ public class SummonItemsData
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SummonItemsData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final SummonItemsData INSTANCE = new SummonItemsData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,21 +29,10 @@ import org.l2jmobius.gameserver.model.ArmorSet;
|
|||||||
public class ArmorSetsTable
|
public class ArmorSetsTable
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(ArmorSetsTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ArmorSetsTable.class.getName());
|
||||||
private static ArmorSetsTable _instance;
|
|
||||||
|
|
||||||
public Map<Integer, ArmorSet> armorSets;
|
public Map<Integer, ArmorSet> armorSets;
|
||||||
private final Map<Integer, ArmorDummy> cusArmorSets;
|
private final Map<Integer, ArmorDummy> cusArmorSets;
|
||||||
|
|
||||||
public static ArmorSetsTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new ArmorSetsTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArmorSetsTable()
|
private ArmorSetsTable()
|
||||||
{
|
{
|
||||||
armorSets = new HashMap<>();
|
armorSets = new HashMap<>();
|
||||||
@@ -162,4 +151,14 @@ public class ArmorSetsTable
|
|||||||
return _shield;
|
return _shield;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ArmorSetsTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final ArmorSetsTable INSTANCE = new ArmorSetsTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,17 +28,6 @@ public class CharNameTable
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(CharNameTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(CharNameTable.class.getName());
|
||||||
|
|
||||||
private static CharNameTable _instance;
|
|
||||||
|
|
||||||
public static CharNameTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new CharNameTable();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized boolean doesCharNameExist(String name)
|
public synchronized boolean doesCharNameExist(String name)
|
||||||
{
|
{
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
@@ -166,4 +155,14 @@ public class CharNameTable
|
|||||||
|
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CharNameTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final CharNameTable INSTANCE = new CharNameTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ public class CharTemplateTable
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(CharTemplateTable.class.getName());
|
private static Logger LOGGER = Logger.getLogger(CharTemplateTable.class.getName());
|
||||||
|
|
||||||
private static CharTemplateTable _instance;
|
|
||||||
|
|
||||||
private static final String[] CHAR_CLASSES =
|
private static final String[] CHAR_CLASSES =
|
||||||
{
|
{
|
||||||
"Human Fighter",
|
"Human Fighter",
|
||||||
@@ -163,16 +161,6 @@ public class CharTemplateTable
|
|||||||
|
|
||||||
private final Map<Integer, PlayerTemplate> _templates;
|
private final Map<Integer, PlayerTemplate> _templates;
|
||||||
|
|
||||||
public static CharTemplateTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new CharTemplateTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CharTemplateTable()
|
private CharTemplateTable()
|
||||||
{
|
{
|
||||||
_templates = new HashMap<>();
|
_templates = new HashMap<>();
|
||||||
@@ -269,7 +257,6 @@ public class CharTemplateTable
|
|||||||
public static final int getClassIdByName(String className)
|
public static final int getClassIdByName(String className)
|
||||||
{
|
{
|
||||||
int currId = 1;
|
int currId = 1;
|
||||||
|
|
||||||
for (String name : CHAR_CLASSES)
|
for (String name : CHAR_CLASSES)
|
||||||
{
|
{
|
||||||
if (name.equalsIgnoreCase(className))
|
if (name.equalsIgnoreCase(className))
|
||||||
@@ -279,7 +266,16 @@ public class CharTemplateTable
|
|||||||
|
|
||||||
currId++;
|
currId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return currId;
|
return currId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CharTemplateTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final CharTemplateTable INSTANCE = new CharTemplateTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,62 +54,16 @@ public class ClanTable
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
|
private static Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
|
||||||
|
|
||||||
private static ClanTable _instance;
|
private final Map<Integer, Clan> _clans = new HashMap<>();
|
||||||
|
|
||||||
private final Map<Integer, Clan> _clans;
|
|
||||||
|
|
||||||
public static ClanTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new ClanTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void reload()
|
|
||||||
{
|
|
||||||
_instance = null;
|
|
||||||
getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Clan[] getClans()
|
|
||||||
{
|
|
||||||
return _clans.values().toArray(new Clan[_clans.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTopRate(int clan_id)
|
|
||||||
{
|
|
||||||
Clan clan = getClan(clan_id);
|
|
||||||
if (clan.getLevel() < 3)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int i = 1;
|
|
||||||
for (Clan clans : getClans())
|
|
||||||
{
|
|
||||||
if (clan != clans)
|
|
||||||
{
|
|
||||||
if (clan.getLevel() < clans.getLevel())
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else if (clan.getLevel() == clans.getLevel())
|
|
||||||
{
|
|
||||||
if (clan.getReputationScore() <= clans.getReputationScore())
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ClanTable()
|
private ClanTable()
|
||||||
{
|
{
|
||||||
_clans = new HashMap<>();
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
_clans.clear();
|
||||||
Clan clan;
|
Clan clan;
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
@@ -154,6 +108,39 @@ public class ClanTable
|
|||||||
restoreClanWars();
|
restoreClanWars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Clan[] getClans()
|
||||||
|
{
|
||||||
|
return _clans.values().toArray(new Clan[_clans.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTopRate(int clan_id)
|
||||||
|
{
|
||||||
|
Clan clan = getClan(clan_id);
|
||||||
|
if (clan.getLevel() < 3)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int i = 1;
|
||||||
|
for (Clan clans : getClans())
|
||||||
|
{
|
||||||
|
if (clan != clans)
|
||||||
|
{
|
||||||
|
if (clan.getLevel() < clans.getLevel())
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else if (clan.getLevel() == clans.getLevel())
|
||||||
|
{
|
||||||
|
if (clan.getReputationScore() <= clans.getReputationScore())
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clanId
|
* @param clanId
|
||||||
* @return
|
* @return
|
||||||
@@ -558,4 +545,14 @@ public class ClanTable
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ClanTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final ClanTable INSTANCE = new ClanTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,16 +30,6 @@ import org.l2jmobius.gameserver.model.ArmorSet;
|
|||||||
public class CustomArmorSetsTable
|
public class CustomArmorSetsTable
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(CustomArmorSetsTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(CustomArmorSetsTable.class.getName());
|
||||||
private static CustomArmorSetsTable _instance;
|
|
||||||
|
|
||||||
public static CustomArmorSetsTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new CustomArmorSetsTable();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomArmorSetsTable()
|
public CustomArmorSetsTable()
|
||||||
{
|
{
|
||||||
@@ -71,4 +61,14 @@ public class CustomArmorSetsTable
|
|||||||
LOGGER.warning("ArmorSetsTable: Error reading Custom ArmorSets table " + e);
|
LOGGER.warning("ArmorSetsTable: Error reading Custom ArmorSets table " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CustomArmorSetsTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final CustomArmorSetsTable INSTANCE = new CustomArmorSetsTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,28 +35,17 @@ public class HelperBuffTable
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(HennaTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(HennaTable.class.getName());
|
||||||
|
|
||||||
private static HelperBuffTable _instance;
|
public List<HelperBuffHolder> helperBuff = new ArrayList<>();
|
||||||
public List<HelperBuffHolder> helperBuff;
|
|
||||||
private final boolean _initialized = true;
|
private final boolean _initialized = true;
|
||||||
private int _magicClassLowestLevel = 100;
|
private int _magicClassLowestLevel = 100;
|
||||||
private int _physicClassLowestLevel = 100;
|
private int _physicClassLowestLevel = 100;
|
||||||
private int _magicClassHighestLevel = 1;
|
private int _magicClassHighestLevel = 1;
|
||||||
private int _physicClassHighestLevel = 1;
|
private int _physicClassHighestLevel = 1;
|
||||||
|
|
||||||
public static HelperBuffTable getInstance()
|
public void load()
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
helperBuff.clear();
|
||||||
{
|
restoreHelperBuffData();
|
||||||
_instance = new HelperBuffTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void reload()
|
|
||||||
{
|
|
||||||
_instance = null;
|
|
||||||
getInstance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,8 +53,7 @@ public class HelperBuffTable
|
|||||||
*/
|
*/
|
||||||
private HelperBuffTable()
|
private HelperBuffTable()
|
||||||
{
|
{
|
||||||
helperBuff = new ArrayList<>();
|
load();
|
||||||
restoreHelperBuffData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,4 +210,14 @@ public class HelperBuffTable
|
|||||||
{
|
{
|
||||||
_physicClassLowestLevel = physicClassLowestLevel;
|
_physicClassLowestLevel = physicClassLowestLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HelperBuffTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final HelperBuffTable INSTANCE = new HelperBuffTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,15 +34,10 @@ import org.l2jmobius.gameserver.model.items.Henna;
|
|||||||
public class HennaTreeTable
|
public class HennaTreeTable
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(HennaTreeTable.class.getName());
|
private static Logger LOGGER = Logger.getLogger(HennaTreeTable.class.getName());
|
||||||
private static final HennaTreeTable INSTANCE = new HennaTreeTable();
|
|
||||||
private final Map<ClassId, List<HennaInstance>> _hennaTrees;
|
private final Map<ClassId, List<HennaInstance>> _hennaTrees;
|
||||||
private final boolean _initialized = true;
|
private final boolean _initialized = true;
|
||||||
|
|
||||||
public static HennaTreeTable getInstance()
|
|
||||||
{
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private HennaTreeTable()
|
private HennaTreeTable()
|
||||||
{
|
{
|
||||||
_hennaTrees = new HashMap<>();
|
_hennaTrees = new HashMap<>();
|
||||||
@@ -128,4 +123,14 @@ public class HennaTreeTable
|
|||||||
{
|
{
|
||||||
return _initialized;
|
return _initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HennaTreeTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final HennaTreeTable INSTANCE = new HennaTreeTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,23 +48,11 @@ public class LevelUpData
|
|||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(LevelUpData.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(LevelUpData.class.getName());
|
||||||
|
|
||||||
private static LevelUpData _instance;
|
private final Map<Integer, LvlupData> _lvlTable;
|
||||||
|
|
||||||
private final Map<Integer, LvlupData> lvlTable;
|
|
||||||
|
|
||||||
public static LevelUpData getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new LevelUpData();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private LevelUpData()
|
private LevelUpData()
|
||||||
{
|
{
|
||||||
lvlTable = new HashMap<>();
|
_lvlTable = new HashMap<>();
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
final PreparedStatement statement = con.prepareStatement(SELECT_ALL);
|
final PreparedStatement statement = con.prepareStatement(SELECT_ALL);
|
||||||
@@ -86,13 +74,13 @@ public class LevelUpData
|
|||||||
lvlDat.setClassMpAdd(rset.getFloat(MP_ADD));
|
lvlDat.setClassMpAdd(rset.getFloat(MP_ADD));
|
||||||
lvlDat.setClassMpModifier(rset.getFloat(MP_MOD));
|
lvlDat.setClassMpModifier(rset.getFloat(MP_MOD));
|
||||||
|
|
||||||
lvlTable.put(lvlDat.getClassid(), lvlDat);
|
_lvlTable.put(lvlDat.getClassid(), lvlDat);
|
||||||
}
|
}
|
||||||
|
|
||||||
statement.close();
|
statement.close();
|
||||||
rset.close();
|
rset.close();
|
||||||
|
|
||||||
LOGGER.info("LevelUpData: Loaded " + lvlTable.size() + " Character Level Up Templates.");
|
LOGGER.info("LevelUpData: Loaded " + _lvlTable.size() + " Character Level Up Templates.");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -106,11 +94,21 @@ public class LevelUpData
|
|||||||
*/
|
*/
|
||||||
public LvlupData getTemplate(int classId)
|
public LvlupData getTemplate(int classId)
|
||||||
{
|
{
|
||||||
return lvlTable.get(classId);
|
return _lvlTable.get(classId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LvlupData getTemplate(ClassId classId)
|
public LvlupData getTemplate(ClassId classId)
|
||||||
{
|
{
|
||||||
return lvlTable.get(classId.getId());
|
return _lvlTable.get(classId.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LevelUpData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final LevelUpData INSTANCE = new LevelUpData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,30 +46,18 @@ public class NpcTable
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(NpcTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(NpcTable.class.getName());
|
||||||
|
|
||||||
private static NpcTable _instance;
|
private final Map<Integer, NpcTemplate> _npcs = new HashMap<>();
|
||||||
|
|
||||||
private final Map<Integer, NpcTemplate> npcs;
|
|
||||||
private boolean _initialized = false;
|
private boolean _initialized = false;
|
||||||
|
|
||||||
public static NpcTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new NpcTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private NpcTable()
|
private NpcTable()
|
||||||
{
|
{
|
||||||
npcs = new HashMap<>();
|
load();
|
||||||
|
|
||||||
restoreNpcData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreNpcData()
|
private void load()
|
||||||
{
|
{
|
||||||
|
_npcs.clear();
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
PreparedStatement statement = con.prepareStatement("SELECT * FROM npc");
|
PreparedStatement statement = con.prepareStatement("SELECT * FROM npc");
|
||||||
@@ -109,7 +97,7 @@ public class NpcTable
|
|||||||
while (npcskills.next())
|
while (npcskills.next())
|
||||||
{
|
{
|
||||||
final int mobId = npcskills.getInt("npcid");
|
final int mobId = npcskills.getInt("npcid");
|
||||||
npcDat = npcs.get(mobId);
|
npcDat = _npcs.get(mobId);
|
||||||
|
|
||||||
if (npcDat == null)
|
if (npcDat == null)
|
||||||
{
|
{
|
||||||
@@ -156,7 +144,7 @@ public class NpcTable
|
|||||||
{
|
{
|
||||||
final int mobId = dropData.getInt("mobId");
|
final int mobId = dropData.getInt("mobId");
|
||||||
|
|
||||||
final NpcTemplate npcDat = npcs.get(mobId);
|
final NpcTemplate npcDat = _npcs.get(mobId);
|
||||||
|
|
||||||
if (npcDat == null)
|
if (npcDat == null)
|
||||||
{
|
{
|
||||||
@@ -196,7 +184,7 @@ public class NpcTable
|
|||||||
{
|
{
|
||||||
final int mobId = dropData.getInt("mobId");
|
final int mobId = dropData.getInt("mobId");
|
||||||
|
|
||||||
npcDat = npcs.get(mobId);
|
npcDat = _npcs.get(mobId);
|
||||||
|
|
||||||
if (npcDat == null)
|
if (npcDat == null)
|
||||||
{
|
{
|
||||||
@@ -270,7 +258,7 @@ public class NpcTable
|
|||||||
{
|
{
|
||||||
final int raidId = minionData.getInt("boss_id");
|
final int raidId = minionData.getInt("boss_id");
|
||||||
|
|
||||||
npcDat = npcs.get(raidId);
|
npcDat = _npcs.get(raidId);
|
||||||
minionDat = new MinionData();
|
minionDat = new MinionData();
|
||||||
minionDat.setMinionId(minionData.getInt("minion_id"));
|
minionDat.setMinionId(minionData.getInt("minion_id"));
|
||||||
minionDat.setAmountMin(minionData.getInt("amount_min"));
|
minionDat.setAmountMin(minionData.getInt("amount_min"));
|
||||||
@@ -535,10 +523,10 @@ public class NpcTable
|
|||||||
template.addVulnerability(Stats.BLUNT_WPN_VULN, 1);
|
template.addVulnerability(Stats.BLUNT_WPN_VULN, 1);
|
||||||
template.addVulnerability(Stats.DAGGER_WPN_VULN, 1);
|
template.addVulnerability(Stats.DAGGER_WPN_VULN, 1);
|
||||||
|
|
||||||
npcs.put(id, template);
|
_npcs.put(id, template);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("NpcTable: Loaded " + npcs.size() + " Npc Templates.");
|
LOGGER.info("NpcTable: Loaded " + _npcs.size() + " Npc Templates.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadNpc(int id)
|
public void reloadNpc(int id)
|
||||||
@@ -611,7 +599,7 @@ public class NpcTable
|
|||||||
|
|
||||||
public void reloadAllNpc()
|
public void reloadAllNpc()
|
||||||
{
|
{
|
||||||
restoreNpcData();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveNpc(StatsSet npc)
|
public void saveNpc(StatsSet npc)
|
||||||
@@ -666,17 +654,17 @@ public class NpcTable
|
|||||||
|
|
||||||
public void replaceTemplate(NpcTemplate npc)
|
public void replaceTemplate(NpcTemplate npc)
|
||||||
{
|
{
|
||||||
npcs.put(npc.npcId, npc);
|
_npcs.put(npc.npcId, npc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NpcTemplate getTemplate(int id)
|
public NpcTemplate getTemplate(int id)
|
||||||
{
|
{
|
||||||
return npcs.get(id);
|
return _npcs.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public NpcTemplate getTemplateByName(String name)
|
public NpcTemplate getTemplateByName(String name)
|
||||||
{
|
{
|
||||||
for (NpcTemplate npcTemplate : npcs.values())
|
for (NpcTemplate npcTemplate : _npcs.values())
|
||||||
{
|
{
|
||||||
if (npcTemplate.name.equalsIgnoreCase(name))
|
if (npcTemplate.name.equalsIgnoreCase(name))
|
||||||
{
|
{
|
||||||
@@ -691,7 +679,7 @@ public class NpcTable
|
|||||||
{
|
{
|
||||||
final List<NpcTemplate> list = new ArrayList<>();
|
final List<NpcTemplate> list = new ArrayList<>();
|
||||||
|
|
||||||
for (NpcTemplate t : npcs.values())
|
for (NpcTemplate t : _npcs.values())
|
||||||
{
|
{
|
||||||
if (t.level == lvl)
|
if (t.level == lvl)
|
||||||
{
|
{
|
||||||
@@ -706,7 +694,7 @@ public class NpcTable
|
|||||||
{
|
{
|
||||||
final List<NpcTemplate> list = new ArrayList<>();
|
final List<NpcTemplate> list = new ArrayList<>();
|
||||||
|
|
||||||
for (NpcTemplate t : npcs.values())
|
for (NpcTemplate t : _npcs.values())
|
||||||
{
|
{
|
||||||
if ((t.level == lvl) && "Monster".equals(t.type))
|
if ((t.level == lvl) && "Monster".equals(t.type))
|
||||||
{
|
{
|
||||||
@@ -721,7 +709,7 @@ public class NpcTable
|
|||||||
{
|
{
|
||||||
final List<NpcTemplate> list = new ArrayList<>();
|
final List<NpcTemplate> list = new ArrayList<>();
|
||||||
|
|
||||||
for (NpcTemplate t : npcs.values())
|
for (NpcTemplate t : _npcs.values())
|
||||||
{
|
{
|
||||||
if (t.name.startsWith(letter) && "Npc".equals(t.type))
|
if (t.name.startsWith(letter) && "Npc".equals(t.type))
|
||||||
{
|
{
|
||||||
@@ -761,6 +749,16 @@ public class NpcTable
|
|||||||
|
|
||||||
public Map<Integer, NpcTemplate> getAllTemplates()
|
public Map<Integer, NpcTemplate> getAllTemplates()
|
||||||
{
|
{
|
||||||
return npcs;
|
return _npcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NpcTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final NpcTable INSTANCE = new NpcTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,26 +30,18 @@ import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
|||||||
public class PetDataTable
|
public class PetDataTable
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(PetInstance.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(PetInstance.class.getName());
|
||||||
private static PetDataTable _instance;
|
|
||||||
private static Map<Integer, Map<Integer, PetData>> _petTable;
|
|
||||||
|
|
||||||
public static PetDataTable getInstance()
|
private static Map<Integer, Map<Integer, PetData>> _petTable = new HashMap<>();
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new PetDataTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PetDataTable()
|
private PetDataTable()
|
||||||
{
|
{
|
||||||
_petTable = new HashMap<>();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadPetsData()
|
private void load()
|
||||||
{
|
{
|
||||||
|
_petTable.clear();
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
final PreparedStatement statement = con.prepareStatement("SELECT typeID, level, expMax, hpMax, mpMax, patk, pdef, matk, mdef, acc, evasion, crit, speed, atk_speed, cast_speed, feedMax, feedbattle, feednormal, loadMax, hpregen, mpregen, owner_exp_taken FROM pets_stats");
|
final PreparedStatement statement = con.prepareStatement("SELECT typeID, level, expMax, hpMax, mpMax, patk, pdef, matk, mdef, acc, evasion, crit, speed, atk_speed, cast_speed, feedMax, feedbattle, feednormal, loadMax, hpregen, mpregen, owner_exp_taken FROM pets_stats");
|
||||||
@@ -447,4 +439,14 @@ public class PetDataTable
|
|||||||
|| (npcId == 12528) // twilight strider
|
|| (npcId == 12528) // twilight strider
|
||||||
|| (npcId == 12621); // wyvern
|
|| (npcId == 12621); // wyvern
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PetDataTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final PetDataTable INSTANCE = new PetDataTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,18 +32,6 @@ public class PetNameTable
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(PetNameTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(PetNameTable.class.getName());
|
||||||
|
|
||||||
private static PetNameTable _instance;
|
|
||||||
|
|
||||||
public static PetNameTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new PetNameTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean doesPetNameExist(String name, int petNpcId)
|
public boolean doesPetNameExist(String name, int petNpcId)
|
||||||
{
|
{
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
@@ -120,4 +108,14 @@ public class PetNameTable
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PetNameTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final PetNameTable INSTANCE = new PetNameTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,20 +32,9 @@ import org.l2jmobius.gameserver.model.Skill;
|
|||||||
public class SkillSpellbookTable
|
public class SkillSpellbookTable
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(SkillTreeTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(SkillTreeTable.class.getName());
|
||||||
private static SkillSpellbookTable _instance;
|
|
||||||
|
|
||||||
private static Map<Integer, Integer> skillSpellbooks;
|
private static Map<Integer, Integer> skillSpellbooks;
|
||||||
|
|
||||||
public static SkillSpellbookTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new SkillSpellbookTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SkillSpellbookTable()
|
private SkillSpellbookTable()
|
||||||
{
|
{
|
||||||
skillSpellbooks = new HashMap<>();
|
skillSpellbooks = new HashMap<>();
|
||||||
@@ -116,4 +105,14 @@ public class SkillSpellbookTable
|
|||||||
{
|
{
|
||||||
return getBookForSkill(skill.getId(), level);
|
return getBookForSkill(skill.getId(), level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SkillSpellbookTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final SkillSpellbookTable INSTANCE = new SkillSpellbookTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import org.l2jmobius.gameserver.skills.holders.PlayerSkillHolder;
|
|||||||
public class SkillTreeTable
|
public class SkillTreeTable
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(SkillTreeTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(SkillTreeTable.class.getName());
|
||||||
private static SkillTreeTable _instance;
|
|
||||||
private Map<ClassId, Map<Integer, SkillLearn>> _skillTrees;
|
private Map<ClassId, Map<Integer, SkillLearn>> _skillTrees;
|
||||||
private List<SkillLearn> _fishingSkillTrees; // all common skills (teached by Fisherman)
|
private List<SkillLearn> _fishingSkillTrees; // all common skills (teached by Fisherman)
|
||||||
private List<SkillLearn> _expandDwarfCraftSkillTrees; // list of special skill for dwarf (expand dwarf craft) learned by class teacher
|
private List<SkillLearn> _expandDwarfCraftSkillTrees; // list of special skill for dwarf (expand dwarf craft) learned by class teacher
|
||||||
@@ -256,16 +256,6 @@ public class SkillTreeTable
|
|||||||
LOGGER.info("PledgeSkillTreeTable: Loaded " + count5 + " pledge skills.");
|
LOGGER.info("PledgeSkillTreeTable: Loaded " + count5 + " pledge skills.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SkillTreeTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new SkillTreeTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the minimum level needed to have this Expertise.<BR>
|
* Return the minimum level needed to have this Expertise.<BR>
|
||||||
* <BR>
|
* <BR>
|
||||||
@@ -712,4 +702,14 @@ public class SkillTreeTable
|
|||||||
}
|
}
|
||||||
return holder.getSkills().values();
|
return holder.getSkills().values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SkillTreeTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final SkillTreeTable INSTANCE = new SkillTreeTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -39,19 +39,11 @@ public class SpawnTable
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(SpawnTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(SpawnTable.class.getName());
|
||||||
|
|
||||||
private static final SpawnTable INSTANCE = new SpawnTable();
|
private final Map<Integer, Spawn> _spawntable = new ConcurrentHashMap<>();
|
||||||
|
private int _npcSpawnCount;
|
||||||
private final Map<Integer, Spawn> spawntable = new ConcurrentHashMap<>();
|
private int _customSpawnCount;
|
||||||
private int npcSpawnCount;
|
|
||||||
private int customSpawnCount;
|
|
||||||
|
|
||||||
private int _highestId;
|
private int _highestId;
|
||||||
|
|
||||||
public static SpawnTable getInstance()
|
|
||||||
{
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SpawnTable()
|
private SpawnTable()
|
||||||
{
|
{
|
||||||
if (!Config.ALT_DEV_NO_SPAWNS)
|
if (!Config.ALT_DEV_NO_SPAWNS)
|
||||||
@@ -62,7 +54,7 @@ public class SpawnTable
|
|||||||
|
|
||||||
public Map<Integer, Spawn> getSpawnTable()
|
public Map<Integer, Spawn> getSpawnTable()
|
||||||
{
|
{
|
||||||
return spawntable;
|
return _spawntable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillSpawnTable()
|
private void fillSpawnTable()
|
||||||
@@ -125,24 +117,24 @@ public class SpawnTable
|
|||||||
{
|
{
|
||||||
case 0: // default
|
case 0: // default
|
||||||
{
|
{
|
||||||
npcSpawnCount += spawnDat.init();
|
_npcSpawnCount += spawnDat.init();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: // Day
|
case 1: // Day
|
||||||
{
|
{
|
||||||
DayNightSpawnManager.getInstance().addDayCreature(spawnDat);
|
DayNightSpawnManager.getInstance().addDayCreature(spawnDat);
|
||||||
npcSpawnCount++;
|
_npcSpawnCount++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: // Night
|
case 2: // Night
|
||||||
{
|
{
|
||||||
DayNightSpawnManager.getInstance().addNightCreature(spawnDat);
|
DayNightSpawnManager.getInstance().addNightCreature(spawnDat);
|
||||||
npcSpawnCount++;
|
_npcSpawnCount++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spawntable.put(spawnDat.getId(), spawnDat);
|
_spawntable.put(spawnDat.getId(), spawnDat);
|
||||||
if (spawnDat.getId() > _highestId)
|
if (spawnDat.getId() > _highestId)
|
||||||
{
|
{
|
||||||
_highestId = spawnDat.getId();
|
_highestId = spawnDat.getId();
|
||||||
@@ -166,8 +158,8 @@ public class SpawnTable
|
|||||||
LOGGER.warning("SpawnTable: Spawn could not be initialized. " + e);
|
LOGGER.warning("SpawnTable: Spawn could not be initialized. " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("SpawnTable: Loaded " + spawntable.size() + " Npc Spawn Locations. ");
|
LOGGER.info("SpawnTable: Loaded " + _spawntable.size() + " Npc Spawn Locations. ");
|
||||||
LOGGER.info("SpawnTable: Total number of NPCs in the world: " + npcSpawnCount);
|
LOGGER.info("SpawnTable: Total number of NPCs in the world: " + _npcSpawnCount);
|
||||||
|
|
||||||
// -------------------------------Custom Spawnlist----------------------------//
|
// -------------------------------Custom Spawnlist----------------------------//
|
||||||
if (Config.CUSTOM_SPAWNLIST_TABLE)
|
if (Config.CUSTOM_SPAWNLIST_TABLE)
|
||||||
@@ -227,24 +219,24 @@ public class SpawnTable
|
|||||||
{
|
{
|
||||||
case 0: // default
|
case 0: // default
|
||||||
{
|
{
|
||||||
customSpawnCount += spawnDat.init();
|
_customSpawnCount += spawnDat.init();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: // Day
|
case 1: // Day
|
||||||
{
|
{
|
||||||
DayNightSpawnManager.getInstance().addDayCreature(spawnDat);
|
DayNightSpawnManager.getInstance().addDayCreature(spawnDat);
|
||||||
customSpawnCount++;
|
_customSpawnCount++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: // Night
|
case 2: // Night
|
||||||
{
|
{
|
||||||
DayNightSpawnManager.getInstance().addNightCreature(spawnDat);
|
DayNightSpawnManager.getInstance().addNightCreature(spawnDat);
|
||||||
customSpawnCount++;
|
_customSpawnCount++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spawntable.put(spawnDat.getId(), spawnDat);
|
_spawntable.put(spawnDat.getId(), spawnDat);
|
||||||
if (spawnDat.getId() > _highestId)
|
if (spawnDat.getId() > _highestId)
|
||||||
{
|
{
|
||||||
_highestId = spawnDat.getId();
|
_highestId = spawnDat.getId();
|
||||||
@@ -264,21 +256,21 @@ public class SpawnTable
|
|||||||
LOGGER.warning("CustomSpawnTable: Spawn could not be initialized. " + e);
|
LOGGER.warning("CustomSpawnTable: Spawn could not be initialized. " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("CustomSpawnTable: Loaded " + customSpawnCount + " Npc Spawn Locations. ");
|
LOGGER.info("CustomSpawnTable: Loaded " + _customSpawnCount + " Npc Spawn Locations. ");
|
||||||
LOGGER.info("CustomSpawnTable: Total number of NPCs in the world: " + customSpawnCount);
|
LOGGER.info("CustomSpawnTable: Total number of NPCs in the world: " + _customSpawnCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Spawn getTemplate(int id)
|
public Spawn getTemplate(int id)
|
||||||
{
|
{
|
||||||
return spawntable.get(id);
|
return _spawntable.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNewSpawn(Spawn spawn, boolean storeInDb)
|
public void addNewSpawn(Spawn spawn, boolean storeInDb)
|
||||||
{
|
{
|
||||||
_highestId++;
|
_highestId++;
|
||||||
spawn.setId(_highestId);
|
spawn.setId(_highestId);
|
||||||
spawntable.put(_highestId, spawn);
|
_spawntable.put(_highestId, spawn);
|
||||||
|
|
||||||
if (storeInDb)
|
if (storeInDb)
|
||||||
{
|
{
|
||||||
@@ -306,7 +298,7 @@ public class SpawnTable
|
|||||||
|
|
||||||
public void deleteSpawn(Spawn spawn, boolean updateDb)
|
public void deleteSpawn(Spawn spawn, boolean updateDb)
|
||||||
{
|
{
|
||||||
if (spawntable.remove(spawn.getId()) == null)
|
if (_spawntable.remove(spawn.getId()) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -361,7 +353,7 @@ public class SpawnTable
|
|||||||
public void findNPCInstances(PlayerInstance player, int npcId, int teleportIndex)
|
public void findNPCInstances(PlayerInstance player, int npcId, int teleportIndex)
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (Spawn spawn : spawntable.values())
|
for (Spawn spawn : _spawntable.values())
|
||||||
{
|
{
|
||||||
if (npcId == spawn.getNpcId())
|
if (npcId == spawn.getNpcId())
|
||||||
{
|
{
|
||||||
@@ -389,6 +381,16 @@ public class SpawnTable
|
|||||||
|
|
||||||
public Map<Integer, Spawn> getAllTemplates()
|
public Map<Integer, Spawn> getAllTemplates()
|
||||||
{
|
{
|
||||||
return spawntable;
|
return _spawntable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SpawnTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final SpawnTable INSTANCE = new SpawnTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,28 +34,16 @@ public class TeleportLocationTable
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(TeleportLocationTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(TeleportLocationTable.class.getName());
|
||||||
|
|
||||||
private static TeleportLocationTable _instance;
|
private final Map<Integer, TeleportLocation> _teleports = new HashMap<>();
|
||||||
|
|
||||||
private Map<Integer, TeleportLocation> teleports;
|
|
||||||
|
|
||||||
public static TeleportLocationTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new TeleportLocationTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TeleportLocationTable()
|
private TeleportLocationTable()
|
||||||
{
|
{
|
||||||
reloadAll();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadAll()
|
public void load()
|
||||||
{
|
{
|
||||||
teleports = new HashMap<>();
|
_teleports.clear();
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
@@ -74,13 +62,13 @@ public class TeleportLocationTable
|
|||||||
teleport.setPrice(rset.getInt("price"));
|
teleport.setPrice(rset.getInt("price"));
|
||||||
teleport.setIsForNoble(rset.getInt("fornoble") == 1);
|
teleport.setIsForNoble(rset.getInt("fornoble") == 1);
|
||||||
|
|
||||||
teleports.put(teleport.getTeleId(), teleport);
|
_teleports.put(teleport.getTeleId(), teleport);
|
||||||
}
|
}
|
||||||
|
|
||||||
statement.close();
|
statement.close();
|
||||||
rset.close();
|
rset.close();
|
||||||
|
|
||||||
LOGGER.info("TeleportLocationTable: Loaded " + teleports.size() + " Teleport Location Templates");
|
LOGGER.info("TeleportLocationTable: Loaded " + _teleports.size() + " Teleport Location Templates");
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -95,7 +83,7 @@ public class TeleportLocationTable
|
|||||||
final ResultSet rset = statement.executeQuery();
|
final ResultSet rset = statement.executeQuery();
|
||||||
TeleportLocation teleport;
|
TeleportLocation teleport;
|
||||||
|
|
||||||
int _cTeleCount = teleports.size();
|
int _cTeleCount = _teleports.size();
|
||||||
|
|
||||||
while (rset.next())
|
while (rset.next())
|
||||||
{
|
{
|
||||||
@@ -106,13 +94,13 @@ public class TeleportLocationTable
|
|||||||
teleport.setZ(rset.getInt("loc_z"));
|
teleport.setZ(rset.getInt("loc_z"));
|
||||||
teleport.setPrice(rset.getInt("price"));
|
teleport.setPrice(rset.getInt("price"));
|
||||||
teleport.setIsForNoble(rset.getInt("fornoble") == 1);
|
teleport.setIsForNoble(rset.getInt("fornoble") == 1);
|
||||||
teleports.put(teleport.getTeleId(), teleport);
|
_teleports.put(teleport.getTeleId(), teleport);
|
||||||
}
|
}
|
||||||
|
|
||||||
statement.close();
|
statement.close();
|
||||||
rset.close();
|
rset.close();
|
||||||
|
|
||||||
_cTeleCount = teleports.size() - _cTeleCount;
|
_cTeleCount = _teleports.size() - _cTeleCount;
|
||||||
|
|
||||||
if (_cTeleCount > 0)
|
if (_cTeleCount > 0)
|
||||||
{
|
{
|
||||||
@@ -126,12 +114,18 @@ public class TeleportLocationTable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public TeleportLocation getTemplate(int id)
|
public TeleportLocation getTemplate(int id)
|
||||||
{
|
{
|
||||||
return teleports.get(id);
|
return _teleports.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TeleportLocationTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TeleportLocationTable INSTANCE = new TeleportLocationTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,11 +32,6 @@ public class TerritoryTable
|
|||||||
private static final Logger LOGGER = Logger.getLogger(TradeController.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(TradeController.class.getName());
|
||||||
private static Map<Integer, Territory> _territory = new HashMap<>();
|
private static Map<Integer, Territory> _territory = new HashMap<>();
|
||||||
|
|
||||||
public static TerritoryTable getInstance()
|
|
||||||
{
|
|
||||||
return SingletonHolder.INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TerritoryTable()
|
public TerritoryTable()
|
||||||
{
|
{
|
||||||
_territory.clear();
|
_territory.clear();
|
||||||
@@ -84,6 +79,11 @@ public class TerritoryTable
|
|||||||
LOGGER.info("TerritoryTable: Loaded " + _territory.size() + " locations.");
|
LOGGER.info("TerritoryTable: Loaded " + _territory.size() + " locations.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TerritoryTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
private static class SingletonHolder
|
private static class SingletonHolder
|
||||||
{
|
{
|
||||||
protected static final TerritoryTable INSTANCE = new TerritoryTable();
|
protected static final TerritoryTable INSTANCE = new TerritoryTable();
|
||||||
|
|||||||
@@ -38,48 +38,38 @@ import org.l2jmobius.gameserver.model.actor.instance.ItemInstance;
|
|||||||
public class TradeListTable
|
public class TradeListTable
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(TradeListTable.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(TradeListTable.class.getName());
|
||||||
private static TradeListTable _instance;
|
|
||||||
|
|
||||||
private int _nextListId;
|
private int _nextListId;
|
||||||
private final Map<Integer, StoreTradeList> _lists;
|
private final Map<Integer, StoreTradeList> _lists = new HashMap<>();
|
||||||
|
|
||||||
/** Task launching the function for restore count of Item (Clan Hall) */
|
/** Task launching the function for restore count of Item (Clan Hall) */
|
||||||
private class RestoreCount implements Runnable
|
private class RestoreCount implements Runnable
|
||||||
{
|
{
|
||||||
private final int timer;
|
private final int _timer;
|
||||||
|
|
||||||
public RestoreCount(int time)
|
public RestoreCount(int time)
|
||||||
{
|
{
|
||||||
timer = time;
|
_timer = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
restoreCount(timer);
|
restoreCount(_timer);
|
||||||
dataTimerSave(timer);
|
dataTimerSave(_timer);
|
||||||
ThreadPool.schedule(new RestoreCount(timer), timer * 60 * 60 * 1000);
|
ThreadPool.schedule(new RestoreCount(_timer), _timer * 60 * 60 * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TradeListTable getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new TradeListTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TradeListTable()
|
private TradeListTable()
|
||||||
{
|
{
|
||||||
_lists = new HashMap<>();
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void load(boolean custom)
|
private void load(boolean custom)
|
||||||
{
|
{
|
||||||
|
_lists.clear();
|
||||||
|
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
final PreparedStatement statement1 = con.prepareStatement("SELECT shop_id,npc_id FROM " + (custom ? "custom_merchant_shopids" : "merchant_shopids"));
|
final PreparedStatement statement1 = con.prepareStatement("SELECT shop_id,npc_id FROM " + (custom ? "custom_merchant_shopids" : "merchant_shopids"));
|
||||||
@@ -318,4 +308,14 @@ public class TradeListTable
|
|||||||
LOGGER.warning("TradeController: Could not store Count Item. " + e);
|
LOGGER.warning("TradeController: Could not store Count Item. " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TradeListTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TradeListTable INSTANCE = new TradeListTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,18 +46,6 @@ public class AugmentationData
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(AugmentationData.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(AugmentationData.class.getName());
|
||||||
|
|
||||||
private static AugmentationData _instance;
|
|
||||||
|
|
||||||
public static final AugmentationData getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new AugmentationData();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
// stats
|
// stats
|
||||||
private static final int STAT_START = 1;
|
private static final int STAT_START = 1;
|
||||||
private static final int STAT_END = 14560;
|
private static final int STAT_END = 14560;
|
||||||
@@ -74,13 +62,18 @@ public class AugmentationData
|
|||||||
private static final int BASESTAT_INT = 16343;
|
private static final int BASESTAT_INT = 16343;
|
||||||
private static final int BASESTAT_MEN = 16344;
|
private static final int BASESTAT_MEN = 16344;
|
||||||
|
|
||||||
private final List<augmentationStat> _augmentationStats[];
|
private static List<augmentationStat> _augmentationStats[] = null;
|
||||||
private final Map<Integer, ArrayList<augmentationSkill>> _blueSkills;
|
private static Map<Integer, ArrayList<augmentationSkill>> _blueSkills = null;
|
||||||
private final Map<Integer, ArrayList<augmentationSkill>> _purpleSkills;
|
private static Map<Integer, ArrayList<augmentationSkill>> _purpleSkills = null;
|
||||||
private final Map<Integer, ArrayList<augmentationSkill>> _redSkills;
|
private static Map<Integer, ArrayList<augmentationSkill>> _redSkills = null;
|
||||||
|
|
||||||
|
private AugmentationData()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private AugmentationData()
|
public void load()
|
||||||
{
|
{
|
||||||
LOGGER.info("Initializing AugmentationData.");
|
LOGGER.info("Initializing AugmentationData.");
|
||||||
|
|
||||||
@@ -100,102 +93,6 @@ public class AugmentationData
|
|||||||
_redSkills.put(i, new ArrayList<augmentationSkill>());
|
_redSkills.put(i, new ArrayList<augmentationSkill>());
|
||||||
}
|
}
|
||||||
|
|
||||||
load();
|
|
||||||
|
|
||||||
// Use size*4: since theres 4 blocks of stat-data with equivalent size
|
|
||||||
LOGGER.info("AugmentationData: Loaded " + (_augmentationStats[0].size() * 4) + " augmentation stats.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void reload()
|
|
||||||
{
|
|
||||||
_instance = null;
|
|
||||||
getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class augmentationSkill
|
|
||||||
{
|
|
||||||
private final int _skillId;
|
|
||||||
private final int _maxSkillLevel;
|
|
||||||
private final int _augmentationSkillId;
|
|
||||||
|
|
||||||
public augmentationSkill(int skillId, int maxSkillLevel, int augmentationSkillId)
|
|
||||||
{
|
|
||||||
_skillId = skillId;
|
|
||||||
_maxSkillLevel = maxSkillLevel;
|
|
||||||
_augmentationSkillId = augmentationSkillId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Skill getSkill(int level)
|
|
||||||
{
|
|
||||||
if (level > _maxSkillLevel)
|
|
||||||
{
|
|
||||||
return SkillTable.getInstance().getInfo(_skillId, _maxSkillLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
return SkillTable.getInstance().getInfo(_skillId, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAugmentationSkillId()
|
|
||||||
{
|
|
||||||
return _augmentationSkillId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class augmentationStat
|
|
||||||
{
|
|
||||||
private final Stats _stat;
|
|
||||||
private final int _singleSize;
|
|
||||||
private final int _combinedSize;
|
|
||||||
private final float _singleValues[];
|
|
||||||
private final float _combinedValues[];
|
|
||||||
|
|
||||||
public augmentationStat(Stats stat, float sValues[], float cValues[])
|
|
||||||
{
|
|
||||||
_stat = stat;
|
|
||||||
_singleSize = sValues.length;
|
|
||||||
_singleValues = sValues;
|
|
||||||
_combinedSize = cValues.length;
|
|
||||||
_combinedValues = cValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSingleStatSize()
|
|
||||||
{
|
|
||||||
return _singleSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCombinedStatSize()
|
|
||||||
{
|
|
||||||
return _combinedSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getSingleStatValue(int i)
|
|
||||||
{
|
|
||||||
if ((i >= _singleSize) || (i < 0))
|
|
||||||
{
|
|
||||||
return _singleValues[_singleSize - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
return _singleValues[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getCombinedStatValue(int i)
|
|
||||||
{
|
|
||||||
if ((i >= _combinedSize) || (i < 0))
|
|
||||||
{
|
|
||||||
return _combinedValues[_combinedSize - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
return _combinedValues[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
public Stats getStat()
|
|
||||||
{
|
|
||||||
return _stat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final void load()
|
|
||||||
{
|
|
||||||
// Load the skillmap
|
// Load the skillmap
|
||||||
// Note: the skillmap data is only used when generating new augmentations the client expects a different id in order to display the skill in the items description.
|
// Note: the skillmap data is only used when generating new augmentations the client expects a different id in order to display the skill in the items description.
|
||||||
try
|
try
|
||||||
@@ -375,6 +272,9 @@ public class AugmentationData
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use size*4: since theres 4 blocks of stat-data with equivalent size
|
||||||
|
LOGGER.info("AugmentationData: Loaded " + (_augmentationStats[0].size() * 4) + " augmentation stats.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -687,4 +587,96 @@ public class AugmentationData
|
|||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class augmentationSkill
|
||||||
|
{
|
||||||
|
private final int _skillId;
|
||||||
|
private final int _maxSkillLevel;
|
||||||
|
private final int _augmentationSkillId;
|
||||||
|
|
||||||
|
public augmentationSkill(int skillId, int maxSkillLevel, int augmentationSkillId)
|
||||||
|
{
|
||||||
|
_skillId = skillId;
|
||||||
|
_maxSkillLevel = maxSkillLevel;
|
||||||
|
_augmentationSkillId = augmentationSkillId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Skill getSkill(int level)
|
||||||
|
{
|
||||||
|
if (level > _maxSkillLevel)
|
||||||
|
{
|
||||||
|
return SkillTable.getInstance().getInfo(_skillId, _maxSkillLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return SkillTable.getInstance().getInfo(_skillId, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAugmentationSkillId()
|
||||||
|
{
|
||||||
|
return _augmentationSkillId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class augmentationStat
|
||||||
|
{
|
||||||
|
private final Stats _stat;
|
||||||
|
private final int _singleSize;
|
||||||
|
private final int _combinedSize;
|
||||||
|
private final float _singleValues[];
|
||||||
|
private final float _combinedValues[];
|
||||||
|
|
||||||
|
public augmentationStat(Stats stat, float sValues[], float cValues[])
|
||||||
|
{
|
||||||
|
_stat = stat;
|
||||||
|
_singleSize = sValues.length;
|
||||||
|
_singleValues = sValues;
|
||||||
|
_combinedSize = cValues.length;
|
||||||
|
_combinedValues = cValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSingleStatSize()
|
||||||
|
{
|
||||||
|
return _singleSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCombinedStatSize()
|
||||||
|
{
|
||||||
|
return _combinedSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getSingleStatValue(int i)
|
||||||
|
{
|
||||||
|
if ((i >= _singleSize) || (i < 0))
|
||||||
|
{
|
||||||
|
return _singleValues[_singleSize - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return _singleValues[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getCombinedStatValue(int i)
|
||||||
|
{
|
||||||
|
if ((i >= _combinedSize) || (i < 0))
|
||||||
|
{
|
||||||
|
return _combinedValues[_combinedSize - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return _combinedValues[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Stats getStat()
|
||||||
|
{
|
||||||
|
return _stat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AugmentationData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final AugmentationData INSTANCE = new AugmentationData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ public class ExperienceData
|
|||||||
|
|
||||||
private ExperienceData()
|
private ExperienceData()
|
||||||
{
|
{
|
||||||
loadData();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadData()
|
public void load()
|
||||||
{
|
{
|
||||||
final File xml = new File(Config.DATAPACK_ROOT, "data/stats/experience.xml");
|
final File xml = new File(Config.DATAPACK_ROOT, "data/stats/experience.xml");
|
||||||
if (!xml.exists())
|
if (!xml.exists())
|
||||||
|
|||||||
@@ -70,15 +70,6 @@ public class ItemTable
|
|||||||
_crystalTypes.put("none", Item.CRYSTAL_NONE);
|
_crystalTypes.put("none", Item.CRYSTAL_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns instance of ItemTable
|
|
||||||
* @return ItemTable
|
|
||||||
*/
|
|
||||||
public static ItemTable getInstance()
|
|
||||||
{
|
|
||||||
return SingletonHolder.INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new object Item
|
* Returns a new object Item
|
||||||
* @return
|
* @return
|
||||||
@@ -365,6 +356,15 @@ public class ItemTable
|
|||||||
return _allTemplates.length;
|
return _allTemplates.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns instance of ItemTable
|
||||||
|
* @return ItemTable
|
||||||
|
*/
|
||||||
|
public static ItemTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
private static class SingletonHolder
|
private static class SingletonHolder
|
||||||
{
|
{
|
||||||
protected static final ItemTable INSTANCE = new ItemTable();
|
protected static final ItemTable INSTANCE = new ItemTable();
|
||||||
|
|||||||
@@ -68,42 +68,19 @@ import org.l2jmobius.gameserver.model.zone.type.TownZone;
|
|||||||
import org.l2jmobius.gameserver.model.zone.type.WaterZone;
|
import org.l2jmobius.gameserver.model.zone.type.WaterZone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class manages the augmentation data and can also create new augmentations.
|
|
||||||
* @author durgus
|
* @author durgus
|
||||||
*/
|
*/
|
||||||
public class ZoneData
|
public class ZoneData
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(ZoneData.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ZoneData.class.getName());
|
||||||
|
|
||||||
private static ZoneData _instance;
|
|
||||||
|
|
||||||
public static final ZoneData getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new ZoneData();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ZoneData()
|
public ZoneData()
|
||||||
{
|
{
|
||||||
LOGGER.info("Loading zones...");
|
LOGGER.info("Loading zones...");
|
||||||
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reload()
|
public void load()
|
||||||
{
|
|
||||||
synchronized (_instance)
|
|
||||||
{
|
|
||||||
_instance = null;
|
|
||||||
_instance = new ZoneData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final void load()
|
|
||||||
{
|
{
|
||||||
int zoneCount = 0;
|
int zoneCount = 0;
|
||||||
|
|
||||||
@@ -559,4 +536,14 @@ public class ZoneData
|
|||||||
|
|
||||||
LOGGER.info("Done: loaded " + zoneCount + " zones.");
|
LOGGER.info("Done: loaded " + zoneCount + " zones.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ZoneData getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final ZoneData INSTANCE = new ZoneData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,19 +97,8 @@ public class AdminCommandHandler
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(AdminCommandHandler.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(AdminCommandHandler.class.getName());
|
||||||
|
|
||||||
private static AdminCommandHandler _instance;
|
|
||||||
|
|
||||||
private final Map<String, IAdminCommandHandler> _datatable;
|
private final Map<String, IAdminCommandHandler> _datatable;
|
||||||
|
|
||||||
public static AdminCommandHandler getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new AdminCommandHandler();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private AdminCommandHandler()
|
private AdminCommandHandler()
|
||||||
{
|
{
|
||||||
_datatable = new HashMap<>();
|
_datatable = new HashMap<>();
|
||||||
@@ -213,4 +202,14 @@ public class AdminCommandHandler
|
|||||||
|
|
||||||
return _datatable.get(command);
|
return _datatable.get(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AdminCommandHandler getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final AdminCommandHandler INSTANCE = new AdminCommandHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
|||||||
public class AutoAnnouncementHandler
|
public class AutoAnnouncementHandler
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(AutoAnnouncementHandler.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(AutoAnnouncementHandler.class.getName());
|
||||||
private static AutoAnnouncementHandler _instance;
|
|
||||||
private static final long DEFAULT_ANNOUNCEMENT_DELAY = 180000; // 3 mins by default
|
private static final long DEFAULT_ANNOUNCEMENT_DELAY = 180000; // 3 mins by default
|
||||||
protected Map<Integer, AutoAnnouncementInstance> _registeredAnnouncements;
|
protected Map<Integer, AutoAnnouncementInstance> _registeredAnnouncements;
|
||||||
|
|
||||||
@@ -117,19 +117,6 @@ public class AutoAnnouncementHandler
|
|||||||
player.sendPacket(adminReply);
|
player.sendPacket(adminReply);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static AutoAnnouncementHandler getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new AutoAnnouncementHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -467,4 +454,14 @@ public class AutoAnnouncementHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AutoAnnouncementHandler getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final AutoAnnouncementHandler INSTANCE = new AutoAnnouncementHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,10 +46,8 @@ import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
|||||||
public class AutoChatHandler implements SpawnListener
|
public class AutoChatHandler implements SpawnListener
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(AutoChatHandler.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(AutoChatHandler.class.getName());
|
||||||
private static AutoChatHandler _instance;
|
|
||||||
|
|
||||||
private static final long DEFAULT_CHAT_DELAY = 30000; // 30 secs by default
|
private static final long DEFAULT_CHAT_DELAY = 30000; // 30 secs by default
|
||||||
|
|
||||||
protected Map<Integer, AutoChatInstance> _registeredChats;
|
protected Map<Integer, AutoChatInstance> _registeredChats;
|
||||||
|
|
||||||
protected AutoChatHandler()
|
protected AutoChatHandler()
|
||||||
@@ -100,16 +98,6 @@ public class AutoChatHandler implements SpawnListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AutoChatHandler getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new AutoChatHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int size()
|
public int size()
|
||||||
{
|
{
|
||||||
return _registeredChats.size();
|
return _registeredChats.size();
|
||||||
@@ -825,4 +813,14 @@ public class AutoChatHandler implements SpawnListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AutoChatHandler getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final AutoChatHandler INSTANCE = new AutoChatHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,24 +68,8 @@ public class ItemHandler
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
|
||||||
|
|
||||||
private static ItemHandler _instance;
|
|
||||||
|
|
||||||
private final Map<Integer, IItemHandler> _datatable;
|
private final Map<Integer, IItemHandler> _datatable;
|
||||||
|
|
||||||
/**
|
|
||||||
* Create ItemHandler if doesn't exist and returns ItemHandler
|
|
||||||
* @return ItemHandler
|
|
||||||
*/
|
|
||||||
public static ItemHandler getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new ItemHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of elements contained in datatable
|
* Returns the number of elements contained in datatable
|
||||||
* @return int : Size of the datatable
|
* @return int : Size of the datatable
|
||||||
@@ -174,4 +158,14 @@ public class ItemHandler
|
|||||||
{
|
{
|
||||||
return _datatable.get(itemId);
|
return _datatable.get(itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ItemHandler getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final ItemHandler INSTANCE = new ItemHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,20 +61,8 @@ public class SkillHandler
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
|
||||||
|
|
||||||
private static SkillHandler _instance;
|
|
||||||
|
|
||||||
private final Map<SkillType, ISkillHandler> _datatable;
|
private final Map<SkillType, ISkillHandler> _datatable;
|
||||||
|
|
||||||
public static SkillHandler getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new SkillHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SkillHandler()
|
private SkillHandler()
|
||||||
{
|
{
|
||||||
_datatable = new TreeMap<>();
|
_datatable = new TreeMap<>();
|
||||||
@@ -134,4 +122,14 @@ public class SkillHandler
|
|||||||
{
|
{
|
||||||
return _datatable.size();
|
return _datatable.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SkillHandler getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final SkillHandler INSTANCE = new SkillHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -41,20 +41,8 @@ public class UserCommandHandler
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
|
||||||
|
|
||||||
private static UserCommandHandler _instance;
|
|
||||||
|
|
||||||
private final Map<Integer, IUserCommandHandler> _datatable;
|
private final Map<Integer, IUserCommandHandler> _datatable;
|
||||||
|
|
||||||
public static UserCommandHandler getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new UserCommandHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private UserCommandHandler()
|
private UserCommandHandler()
|
||||||
{
|
{
|
||||||
_datatable = new HashMap<>();
|
_datatable = new HashMap<>();
|
||||||
@@ -95,4 +83,14 @@ public class UserCommandHandler
|
|||||||
{
|
{
|
||||||
return _datatable.size();
|
return _datatable.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static UserCommandHandler getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final UserCommandHandler INSTANCE = new UserCommandHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -38,20 +38,8 @@ public class VoicedCommandHandler
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(GameServer.class.getName());
|
private static Logger LOGGER = Logger.getLogger(GameServer.class.getName());
|
||||||
|
|
||||||
private static VoicedCommandHandler _instance;
|
|
||||||
|
|
||||||
private final Map<String, IVoicedCommandHandler> _datatable;
|
private final Map<String, IVoicedCommandHandler> _datatable;
|
||||||
|
|
||||||
public static VoicedCommandHandler getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new VoicedCommandHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private VoicedCommandHandler()
|
private VoicedCommandHandler()
|
||||||
{
|
{
|
||||||
_datatable = new HashMap<>();
|
_datatable = new HashMap<>();
|
||||||
@@ -131,4 +119,14 @@ public class VoicedCommandHandler
|
|||||||
{
|
{
|
||||||
return _datatable.size();
|
return _datatable.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static VoicedCommandHandler getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final VoicedCommandHandler INSTANCE = new VoicedCommandHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ public class AdminReload implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (type.startsWith("teleport"))
|
else if (type.startsWith("teleport"))
|
||||||
{
|
{
|
||||||
TeleportLocationTable.getInstance().reloadAll();
|
TeleportLocationTable.getInstance().load();
|
||||||
sendReloadPage(activeChar);
|
sendReloadPage(activeChar);
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Teleport location table reloaded.");
|
BuilderUtil.sendSysMessage(activeChar, "Teleport location table reloaded.");
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ public class AdminReload implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (type.equals("tradelist"))
|
else if (type.equals("tradelist"))
|
||||||
{
|
{
|
||||||
TradeController.reload();
|
TradeController.getInstance();
|
||||||
sendReloadPage(activeChar);
|
sendReloadPage(activeChar);
|
||||||
BuilderUtil.sendSysMessage(activeChar, "TradeList Table reloaded.");
|
BuilderUtil.sendSysMessage(activeChar, "TradeList Table reloaded.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ public class AdminSpawn implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
else if (command.startsWith("admin_teleport_reload"))
|
else if (command.startsWith("admin_teleport_reload"))
|
||||||
{
|
{
|
||||||
TeleportLocationTable.getInstance().reloadAll();
|
TeleportLocationTable.getInstance().load();
|
||||||
AdminData.broadcastMessageToGMs("Teleport List Table reloaded.");
|
AdminData.broadcastMessageToGMs("Teleport List Table reloaded.");
|
||||||
}
|
}
|
||||||
else if (command.startsWith("admin_topspawncount") || command.startsWith("admin_top_spawn_count"))
|
else if (command.startsWith("admin_topspawncount") || command.startsWith("admin_top_spawn_count"))
|
||||||
|
|||||||
@@ -37,34 +37,18 @@ public class CustomBypassHandler
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(BitSetIDFactory.class.getName());
|
private static Logger LOGGER = Logger.getLogger(BitSetIDFactory.class.getName());
|
||||||
|
|
||||||
private static CustomBypassHandler _instance = null;
|
|
||||||
private final Map<String, ICustomByPassHandler> _handlers;
|
private final Map<String, ICustomByPassHandler> _handlers;
|
||||||
|
|
||||||
private CustomBypassHandler()
|
private CustomBypassHandler()
|
||||||
{
|
{
|
||||||
_handlers = new HashMap<>();
|
_handlers = new HashMap<>();
|
||||||
|
|
||||||
registerCustomBypassHandler(new ExtractableByPassHandler());
|
registerCustomBypassHandler(new ExtractableByPassHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Receives the non-static instance of the RebirthManager.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static CustomBypassHandler getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new CustomBypassHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param handler as ICustomByPassHandler
|
* @param handler as ICustomByPassHandler
|
||||||
*/
|
*/
|
||||||
public void registerCustomBypassHandler(ICustomByPassHandler handler)
|
private void registerCustomBypassHandler(ICustomByPassHandler handler)
|
||||||
{
|
{
|
||||||
for (String s : handler.getByPassCommands())
|
for (String s : handler.getByPassCommands())
|
||||||
{
|
{
|
||||||
@@ -110,4 +94,14 @@ public class CustomBypassHandler
|
|||||||
Rebirth.getInstance().handleCommand(player, command);
|
Rebirth.getInstance().handleCommand(player, command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CustomBypassHandler getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final CustomBypassHandler INSTANCE = new CustomBypassHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -26,27 +26,11 @@ import org.l2jmobius.gameserver.model.entity.Rebirth;
|
|||||||
*/
|
*/
|
||||||
public class CustomWorldHandler
|
public class CustomWorldHandler
|
||||||
{
|
{
|
||||||
private static CustomWorldHandler _instance = null;
|
|
||||||
|
|
||||||
private CustomWorldHandler()
|
private CustomWorldHandler()
|
||||||
{
|
{
|
||||||
// Do Nothing ^_-
|
// Do Nothing ^_-
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Receives the non-static instance of the RebirthManager.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static CustomWorldHandler getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new CustomWorldHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests entry into the world - manages appropriately.
|
* Requests entry into the world - manages appropriately.
|
||||||
* @param player
|
* @param player
|
||||||
@@ -68,4 +52,14 @@ public class CustomWorldHandler
|
|||||||
{
|
{
|
||||||
// TODO: Remove the rebirth engine's bonus skills from player?
|
// TODO: Remove the rebirth engine's bonus skills from player?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CustomWorldHandler getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final CustomWorldHandler INSTANCE = new CustomWorldHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,29 +18,15 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
import org.l2jmobius.gameserver.model.zone.type.ArenaZone;
|
import org.l2jmobius.gameserver.model.zone.type.ArenaZone;
|
||||||
|
|
||||||
public class ArenaManager
|
public class ArenaManager
|
||||||
{
|
{
|
||||||
private static ArenaManager _instance;
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(ArenaManager.class.getName());
|
|
||||||
|
|
||||||
public static final ArenaManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
LOGGER.info("Initializing ArenaManager");
|
|
||||||
_instance = new ArenaManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<ArenaZone> _arenas;
|
private List<ArenaZone> _arenas;
|
||||||
|
|
||||||
public ArenaManager()
|
private ArenaManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,4 +71,14 @@ public class ArenaManager
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ArenaManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final ArenaManager INSTANCE = new ArenaManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import org.l2jmobius.gameserver.model.World;
|
|||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>AutoSave</b> only
|
|
||||||
* @author Shyla
|
* @author Shyla
|
||||||
*/
|
*/
|
||||||
public class AutoSaveManager
|
public class AutoSaveManager
|
||||||
|
|||||||
@@ -34,17 +34,12 @@ import org.l2jmobius.gameserver.network.serverpackets.SocialAction;
|
|||||||
public class AwayManager
|
public class AwayManager
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(AwayManager.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(AwayManager.class.getName());
|
||||||
private static AwayManager _instance;
|
|
||||||
protected Map<PlayerInstance, RestoreData> _awayPlayers;
|
protected Map<PlayerInstance, RestoreData> _awayPlayers;
|
||||||
|
|
||||||
public static final AwayManager getInstance()
|
private AwayManager()
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
_awayPlayers = Collections.synchronizedMap(new WeakHashMap<PlayerInstance, RestoreData>());
|
||||||
{
|
|
||||||
_instance = new AwayManager();
|
|
||||||
LOGGER.info("AwayManager: initialized.");
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class RestoreData
|
private final class RestoreData
|
||||||
@@ -72,11 +67,6 @@ public class AwayManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private AwayManager()
|
|
||||||
{
|
|
||||||
_awayPlayers = Collections.synchronizedMap(new WeakHashMap<PlayerInstance, RestoreData>());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAway(PlayerInstance player, String text)
|
public void setAway(PlayerInstance player, String text)
|
||||||
{
|
{
|
||||||
player.set_awaying(true);
|
player.set_awaying(true);
|
||||||
@@ -212,4 +202,14 @@ public class AwayManager
|
|||||||
_player.sendMessage("You are Back now!");
|
_player.sendMessage("You are Back now!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AwayManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final AwayManager INSTANCE = new AwayManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,6 @@ public class CastleManorManager
|
|||||||
{
|
{
|
||||||
protected static Logger LOGGER = Logger.getLogger(CastleManorManager.class.getName());
|
protected static Logger LOGGER = Logger.getLogger(CastleManorManager.class.getName());
|
||||||
|
|
||||||
private static CastleManorManager _instance;
|
|
||||||
|
|
||||||
public static final int PERIOD_CURRENT = 0;
|
public static final int PERIOD_CURRENT = 0;
|
||||||
public static final int PERIOD_NEXT = 1;
|
public static final int PERIOD_NEXT = 1;
|
||||||
public static int APPROVE = -1;
|
public static int APPROVE = -1;
|
||||||
@@ -64,16 +62,6 @@ public class CastleManorManager
|
|||||||
boolean _underMaintenance;
|
boolean _underMaintenance;
|
||||||
boolean _disabled;
|
boolean _disabled;
|
||||||
|
|
||||||
public static CastleManorManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
LOGGER.info("Initializing CastleManorManager");
|
|
||||||
_instance = new CastleManorManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CropProcure
|
public class CropProcure
|
||||||
{
|
{
|
||||||
int _cropId;
|
int _cropId;
|
||||||
@@ -555,4 +543,14 @@ public class CastleManorManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CastleManorManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final CastleManorManager INSTANCE = new CastleManorManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,31 +37,27 @@ public class ClanHallManager
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(ClanHallManager.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ClanHallManager.class.getName());
|
||||||
|
|
||||||
private final Map<String, List<ClanHall>> _allClanHalls;
|
private final Map<String, List<ClanHall>> _allClanHalls = new HashMap<>();
|
||||||
private final Map<Integer, ClanHall> _clanHall;
|
private final Map<Integer, ClanHall> _clanHall = new HashMap<>();
|
||||||
private final Map<Integer, ClanHall> _freeClanHall;
|
private final Map<Integer, ClanHall> _freeClanHall = new HashMap<>();
|
||||||
private boolean _loaded = false;
|
private boolean _loaded = false;
|
||||||
|
|
||||||
public static ClanHallManager getInstance()
|
|
||||||
{
|
|
||||||
return SingletonHolder.INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean loaded()
|
public boolean loaded()
|
||||||
{
|
{
|
||||||
return _loaded;
|
return _loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ClanHallManager()
|
private ClanHallManager()
|
||||||
{
|
{
|
||||||
_allClanHalls = new HashMap<>();
|
|
||||||
_clanHall = new HashMap<>();
|
|
||||||
_freeClanHall = new HashMap<>();
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
_allClanHalls.clear();
|
||||||
|
_clanHall.clear();
|
||||||
|
_freeClanHall.clear();
|
||||||
|
|
||||||
LOGGER.info("Initializing ClanHallManager");
|
LOGGER.info("Initializing ClanHallManager");
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
@@ -254,6 +250,11 @@ public class ClanHallManager
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ClanHallManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
private static class SingletonHolder
|
private static class SingletonHolder
|
||||||
{
|
{
|
||||||
protected static final ClanHallManager INSTANCE = new ClanHallManager();
|
protected static final ClanHallManager INSTANCE = new ClanHallManager();
|
||||||
|
|||||||
@@ -31,20 +31,9 @@ import org.l2jmobius.gameserver.model.entity.siege.Castle;
|
|||||||
public class CrownManager
|
public class CrownManager
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(CrownManager.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(CrownManager.class.getName());
|
||||||
private static CrownManager _instance;
|
|
||||||
|
|
||||||
public static final CrownManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new CrownManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CrownManager()
|
public CrownManager()
|
||||||
{
|
{
|
||||||
LOGGER.info("CrownManager: initialized");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkCrowns(Clan clan)
|
public void checkCrowns(Clan clan)
|
||||||
@@ -147,4 +136,14 @@ public class CrownManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CrownManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final CrownManager INSTANCE = new CrownManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import org.l2jmobius.commons.util.Rnd;
|
|||||||
public class CustomNpcInstanceManager
|
public class CustomNpcInstanceManager
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(CustomNpcInstanceManager.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(CustomNpcInstanceManager.class.getName());
|
||||||
private static CustomNpcInstanceManager _instance;
|
|
||||||
private Map<Integer, customInfo> spawns; // <Object id , info>
|
private Map<Integer, customInfo> spawns; // <Object id , info>
|
||||||
private Map<Integer, customInfo> templates; // <Npc Template Id , info>
|
private Map<Integer, customInfo> templates; // <Npc Template Id , info>
|
||||||
|
|
||||||
@@ -57,19 +57,6 @@ public class CustomNpcInstanceManager
|
|||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiates the manager (if not initiated yet) and/or returns <b>this</b> manager instance
|
|
||||||
* @return CustomNpcInstanceManager _instance
|
|
||||||
*/
|
|
||||||
public static final CustomNpcInstanceManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new CustomNpcInstanceManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush the old data, and load new data
|
* Flush the old data, and load new data
|
||||||
*/
|
*/
|
||||||
@@ -306,4 +293,14 @@ public class CustomNpcInstanceManager
|
|||||||
LOGGER.warning("Could not add Npc Morph info into the DB: ");
|
LOGGER.warning("Could not add Npc Morph info into the DB: ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CustomNpcInstanceManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final CustomNpcInstanceManager INSTANCE = new CustomNpcInstanceManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ public class DatatablesManager
|
|||||||
public static void reloadAll()
|
public static void reloadAll()
|
||||||
{
|
{
|
||||||
AdminData.getInstance().load();
|
AdminData.getInstance().load();
|
||||||
AugmentationData.reload();
|
AugmentationData.getInstance().load();
|
||||||
ClanTable.reload();
|
ClanTable.getInstance().load();
|
||||||
HelperBuffTable.reload();
|
HelperBuffTable.getInstance().load();
|
||||||
ExperienceData.getInstance();
|
ExperienceData.getInstance().load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,24 +42,12 @@ public class DayNightSpawnManager
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(DayNightSpawnManager.class.getName());
|
private static Logger LOGGER = Logger.getLogger(DayNightSpawnManager.class.getName());
|
||||||
|
|
||||||
private static DayNightSpawnManager _instance;
|
|
||||||
private final List<Spawn> _dayCreatures = new ArrayList<>();
|
private final List<Spawn> _dayCreatures = new ArrayList<>();
|
||||||
private final List<Spawn> _nightCreatures = new ArrayList<>();
|
private final List<Spawn> _nightCreatures = new ArrayList<>();
|
||||||
private final Map<Spawn, RaidBossInstance> _bosses = new ConcurrentHashMap<>();
|
private final Map<Spawn, RaidBossInstance> _bosses = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static DayNightSpawnManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new DayNightSpawnManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private DayNightSpawnManager()
|
private DayNightSpawnManager()
|
||||||
{
|
{
|
||||||
LOGGER.info("DayNightSpawnManager: Day/Night handler initialised");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addDayCreature(Spawn spawnDat)
|
public void addDayCreature(Spawn spawnDat)
|
||||||
@@ -300,4 +288,14 @@ public class DayNightSpawnManager
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DayNightSpawnManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final DayNightSpawnManager INSTANCE = new DayNightSpawnManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,21 +55,11 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
public class DimensionalRiftManager
|
public class DimensionalRiftManager
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(DimensionalRiftManager.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(DimensionalRiftManager.class.getName());
|
||||||
private static DimensionalRiftManager _instance;
|
|
||||||
private final Map<Byte, Map<Byte, DimensionalRiftRoom>> _rooms = new HashMap<>();
|
private final Map<Byte, Map<Byte, DimensionalRiftRoom>> _rooms = new HashMap<>();
|
||||||
private final short DIMENSIONAL_FRAGMENT_ITEM_ID = 7079;
|
private final short DIMENSIONAL_FRAGMENT_ITEM_ID = 7079;
|
||||||
private static final int MAX_PARTY_PER_AREA = 3;
|
private static final int MAX_PARTY_PER_AREA = 3;
|
||||||
|
|
||||||
public static DimensionalRiftManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new DimensionalRiftManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private DimensionalRiftManager()
|
private DimensionalRiftManager()
|
||||||
{
|
{
|
||||||
loadRooms();
|
loadRooms();
|
||||||
@@ -601,4 +591,14 @@ public class DimensionalRiftManager
|
|||||||
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " tried to cheat in dimensional rift.", Config.DEFAULT_PUNISH);
|
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " tried to cheat in dimensional rift.", Config.DEFAULT_PUNISH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DimensionalRiftManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final DimensionalRiftManager INSTANCE = new DimensionalRiftManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,17 +29,6 @@ public class DuelManager
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(DuelManager.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(DuelManager.class.getName());
|
||||||
|
|
||||||
private static DuelManager _instance;
|
|
||||||
|
|
||||||
public static final DuelManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new DuelManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final List<Duel> _duels;
|
private final List<Duel> _duels;
|
||||||
private int _currentDuelId = 0x90;
|
private int _currentDuelId = 0x90;
|
||||||
|
|
||||||
@@ -238,4 +227,14 @@ public class DuelManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DuelManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final DuelManager INSTANCE = new DuelManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,30 +18,16 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.model.zone.type.FishingZone;
|
import org.l2jmobius.gameserver.model.zone.type.FishingZone;
|
||||||
import org.l2jmobius.gameserver.model.zone.type.WaterZone;
|
import org.l2jmobius.gameserver.model.zone.type.WaterZone;
|
||||||
|
|
||||||
public class FishingZoneManager
|
public class FishingZoneManager
|
||||||
{
|
{
|
||||||
private static FishingZoneManager _instance;
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(FishingZoneManager.class.getName());
|
|
||||||
|
|
||||||
public static final FishingZoneManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
LOGGER.info("Initializing FishingZoneManager");
|
|
||||||
_instance = new FishingZoneManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<FishingZone> _fishingZones;
|
private List<FishingZone> _fishingZones;
|
||||||
private List<WaterZone> _waterZones;
|
private List<WaterZone> _waterZones;
|
||||||
|
|
||||||
public FishingZoneManager()
|
private FishingZoneManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,4 +78,14 @@ public class FishingZoneManager
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FishingZoneManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final FishingZoneManager INSTANCE = new FishingZoneManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ import org.l2jmobius.gameserver.util.Util;
|
|||||||
*/
|
*/
|
||||||
public class FourSepulchersManager extends GrandBossManager
|
public class FourSepulchersManager extends GrandBossManager
|
||||||
{
|
{
|
||||||
private static final String QUEST_ID = "620_FourGoblets";
|
private static final String QUEST_ID = "Q620_FourGoblets";
|
||||||
|
|
||||||
private static final int ENTRANCE_PASS = 7075;
|
private static final int ENTRANCE_PASS = 7075;
|
||||||
private static final int USED_PASS = 7261;
|
private static final int USED_PASS = 7261;
|
||||||
@@ -1544,7 +1544,7 @@ public class FourSepulchersManager extends GrandBossManager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGGER.warning("Ahenbek ashelbek! Shaitanama!! " + doorId);
|
LOGGER.warning("Could not find door with id " + doorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -63,26 +63,11 @@ public class GrandBossManager
|
|||||||
private static final String UPDATE_GRAND_BOSS_DATA = "UPDATE grandboss_data set loc_x = ?, loc_y = ?, loc_z = ?, heading = ?, respawn_time = ?, currentHP = ?, currentMP = ?, status = ? where boss_id = ?";
|
private static final String UPDATE_GRAND_BOSS_DATA = "UPDATE grandboss_data set loc_x = ?, loc_y = ?, loc_z = ?, heading = ?, respawn_time = ?, currentHP = ?, currentMP = ?, status = ? where boss_id = ?";
|
||||||
private static final String UPDATE_GRAND_BOSS_DATA2 = "UPDATE grandboss_data set status = ? where boss_id = ?";
|
private static final String UPDATE_GRAND_BOSS_DATA2 = "UPDATE grandboss_data set status = ? where boss_id = ?";
|
||||||
|
|
||||||
private static GrandBossManager _instance;
|
|
||||||
|
|
||||||
protected static Map<Integer, GrandBossInstance> _bosses;
|
protected static Map<Integer, GrandBossInstance> _bosses;
|
||||||
|
|
||||||
protected static Map<Integer, StatsSet> _storedInfo;
|
protected static Map<Integer, StatsSet> _storedInfo;
|
||||||
|
|
||||||
private Map<Integer, Integer> _bossStatus;
|
private Map<Integer, Integer> _bossStatus;
|
||||||
|
|
||||||
private Collection<BossZone> _zones;
|
private Collection<BossZone> _zones;
|
||||||
|
|
||||||
public static GrandBossManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
LOGGER.info("Initializing GrandBossManager");
|
|
||||||
_instance = new GrandBossManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GrandBossManager()
|
public GrandBossManager()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@@ -472,4 +457,14 @@ public class GrandBossManager
|
|||||||
{
|
{
|
||||||
return _bossStatus.get(bossId) != null;
|
return _bossStatus.get(bossId) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GrandBossManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final GrandBossManager INSTANCE = new GrandBossManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ public class Manager
|
|||||||
if (!Config.ALT_DEV_NO_QUESTS)
|
if (!Config.ALT_DEV_NO_QUESTS)
|
||||||
{
|
{
|
||||||
QuestManager.getInstance();
|
QuestManager.getInstance();
|
||||||
QuestManager.reload();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,19 +25,7 @@ import org.l2jmobius.gameserver.model.zone.type.OlympiadStadiumZone;
|
|||||||
|
|
||||||
public class OlympiadStadiaManager
|
public class OlympiadStadiaManager
|
||||||
{
|
{
|
||||||
protected static Logger LOGGER = Logger.getLogger(OlympiadStadiaManager.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(OlympiadStadiaManager.class.getName());
|
||||||
|
|
||||||
private static OlympiadStadiaManager _instance;
|
|
||||||
|
|
||||||
public static final OlympiadStadiaManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
LOGGER.info("Initializing OlympiadStadiaManager");
|
|
||||||
_instance = new OlympiadStadiaManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<OlympiadStadiumZone> _olympiadStadias;
|
private List<OlympiadStadiumZone> _olympiadStadias;
|
||||||
|
|
||||||
@@ -83,4 +71,14 @@ public class OlympiadStadiaManager
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static OlympiadStadiaManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final OlympiadStadiaManager INSTANCE = new OlympiadStadiaManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
public class PetitionManager
|
public class PetitionManager
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(PetitionManager.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(PetitionManager.class.getName());
|
||||||
private static PetitionManager _instance;
|
|
||||||
|
|
||||||
final Map<Integer, Petition> _pendingPetitions;
|
final Map<Integer, Petition> _pendingPetitions;
|
||||||
final Map<Integer, Petition> _completedPetitions;
|
final Map<Integer, Petition> _completedPetitions;
|
||||||
@@ -73,17 +72,6 @@ public class PetitionManager
|
|||||||
Other
|
Other
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PetitionManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
LOGGER.info("Initializing PetitionManager");
|
|
||||||
_instance = new PetitionManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class Petition
|
private class Petition
|
||||||
{
|
{
|
||||||
private final long _submitTime = System.currentTimeMillis();
|
private final long _submitTime = System.currentTimeMillis();
|
||||||
@@ -627,4 +615,14 @@ public class PetitionManager
|
|||||||
htmlMsg.setHtml(htmlContent.toString());
|
htmlMsg.setHtml(htmlContent.toString());
|
||||||
player.sendPacket(htmlMsg);
|
player.sendPacket(htmlMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PetitionManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final PetitionManager INSTANCE = new PetitionManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,23 +25,12 @@ import org.l2jmobius.gameserver.model.quest.Quest;
|
|||||||
public class QuestManager
|
public class QuestManager
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(QuestManager.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(QuestManager.class.getName());
|
||||||
private Map<String, Quest> _quests = new HashMap<>();
|
|
||||||
private static QuestManager _instance;
|
|
||||||
private int _questCount;
|
|
||||||
|
|
||||||
public static QuestManager getInstance()
|
private static Map<String, Quest> _quests = new HashMap<>();
|
||||||
{
|
private static int _questCount = 0;
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new QuestManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QuestManager()
|
private QuestManager()
|
||||||
{
|
{
|
||||||
LOGGER.info("Initializing QuestManager.");
|
|
||||||
_questCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean reload(String questFolder)
|
public boolean reload(String questFolder)
|
||||||
@@ -142,14 +131,6 @@ public class QuestManager
|
|||||||
return _quests;
|
return _quests;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This will reload quests
|
|
||||||
*/
|
|
||||||
public static void reload()
|
|
||||||
{
|
|
||||||
_instance = new QuestManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Iterable<Quest> getAllManagedScripts()
|
public Iterable<Quest> getAllManagedScripts()
|
||||||
{
|
{
|
||||||
return _quests.values();
|
return _quests.values();
|
||||||
@@ -184,4 +165,14 @@ public class QuestManager
|
|||||||
}
|
}
|
||||||
getInstance().report();
|
getInstance().report();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static QuestManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final QuestManager INSTANCE = new QuestManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.datatables.csv.MapRegionTable;
|
import org.l2jmobius.gameserver.datatables.csv.MapRegionTable;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -27,23 +26,9 @@ import org.l2jmobius.gameserver.model.zone.type.TownZone;
|
|||||||
|
|
||||||
public class TownManager
|
public class TownManager
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(TownManager.class.getName());
|
|
||||||
|
|
||||||
private static TownManager _instance;
|
|
||||||
|
|
||||||
public static final TownManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
LOGGER.info("Initializing TownManager");
|
|
||||||
_instance = new TownManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<TownZone> _towns;
|
private List<TownZone> _towns;
|
||||||
|
|
||||||
public TownManager()
|
private TownManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,4 +310,14 @@ public class TownManager
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TownManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TownManager INSTANCE = new TownManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,30 +39,18 @@ import org.l2jmobius.gameserver.model.items.Item;
|
|||||||
public class Manor
|
public class Manor
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(Manor.class.getName());
|
private static Logger LOGGER = Logger.getLogger(Manor.class.getName());
|
||||||
private static Manor _instance;
|
|
||||||
|
|
||||||
private static Map<Integer, SeedData> _seeds;
|
private static Map<Integer, SeedData> _seeds = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public Manor()
|
public Manor()
|
||||||
{
|
{
|
||||||
_seeds = new ConcurrentHashMap<>();
|
_seeds.clear();
|
||||||
parseData();
|
parseData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Manor getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new Manor();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Integer> getAllCrops()
|
public List<Integer> getAllCrops()
|
||||||
{
|
{
|
||||||
final List<Integer> crops = new ArrayList<>();
|
final List<Integer> crops = new ArrayList<>();
|
||||||
|
|
||||||
for (SeedData seed : _seeds.values())
|
for (SeedData seed : _seeds.values())
|
||||||
{
|
{
|
||||||
if (!crops.contains(seed.getCrop()) && (seed.getCrop() != 0) && !crops.contains(seed.getCrop()))
|
if (!crops.contains(seed.getCrop()) && (seed.getCrop() != 0) && !crops.contains(seed.getCrop()))
|
||||||
@@ -70,7 +58,6 @@ public class Manor
|
|||||||
crops.add(seed.getCrop());
|
crops.add(seed.getCrop());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return crops;
|
return crops;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,14 +81,12 @@ public class Manor
|
|||||||
return getSeedBasicPrice(seed.getId());
|
return getSeedBasicPrice(seed.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCropBasicPrice(int cropId)
|
public int getCropBasicPrice(int cropId)
|
||||||
{
|
{
|
||||||
final Item cropItem = ItemTable.getInstance().getTemplate(cropId);
|
final Item cropItem = ItemTable.getInstance().getTemplate(cropId);
|
||||||
|
|
||||||
if (cropItem != null)
|
if (cropItem != null)
|
||||||
{
|
{
|
||||||
return cropItem.getReferencePrice();
|
return cropItem.getReferencePrice();
|
||||||
@@ -129,14 +114,12 @@ public class Manor
|
|||||||
public int getSeedBuyPrice(int seedId)
|
public int getSeedBuyPrice(int seedId)
|
||||||
{
|
{
|
||||||
final int buyPrice = getSeedBasicPrice(seedId) / 10;
|
final int buyPrice = getSeedBasicPrice(seedId) / 10;
|
||||||
|
|
||||||
return buyPrice > 0 ? buyPrice : 1;
|
return buyPrice > 0 ? buyPrice : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSeedMinLevel(int seedId)
|
public int getSeedMinLevel(int seedId)
|
||||||
{
|
{
|
||||||
final SeedData seed = _seeds.get(seedId);
|
final SeedData seed = _seeds.get(seedId);
|
||||||
|
|
||||||
if (seed != null)
|
if (seed != null)
|
||||||
{
|
{
|
||||||
return seed.getLevel() - 5;
|
return seed.getLevel() - 5;
|
||||||
@@ -147,7 +130,6 @@ public class Manor
|
|||||||
public int getSeedMaxLevel(int seedId)
|
public int getSeedMaxLevel(int seedId)
|
||||||
{
|
{
|
||||||
final SeedData seed = _seeds.get(seedId);
|
final SeedData seed = _seeds.get(seedId);
|
||||||
|
|
||||||
if (seed != null)
|
if (seed != null)
|
||||||
{
|
{
|
||||||
return seed.getLevel() + 5;
|
return seed.getLevel() + 5;
|
||||||
@@ -170,7 +152,6 @@ public class Manor
|
|||||||
public int getSeedLevel(int seedId)
|
public int getSeedLevel(int seedId)
|
||||||
{
|
{
|
||||||
final SeedData seed = _seeds.get(seedId);
|
final SeedData seed = _seeds.get(seedId);
|
||||||
|
|
||||||
if (seed != null)
|
if (seed != null)
|
||||||
{
|
{
|
||||||
return seed.getLevel();
|
return seed.getLevel();
|
||||||
@@ -193,7 +174,6 @@ public class Manor
|
|||||||
public int getCropType(int seedId)
|
public int getCropType(int seedId)
|
||||||
{
|
{
|
||||||
final SeedData seed = _seeds.get(seedId);
|
final SeedData seed = _seeds.get(seedId);
|
||||||
|
|
||||||
if (seed != null)
|
if (seed != null)
|
||||||
{
|
{
|
||||||
return seed.getCrop();
|
return seed.getCrop();
|
||||||
@@ -216,7 +196,6 @@ public class Manor
|
|||||||
public synchronized int getRewardItemBySeed(int seedId, int type)
|
public synchronized int getRewardItemBySeed(int seedId, int type)
|
||||||
{
|
{
|
||||||
final SeedData seed = _seeds.get(seedId);
|
final SeedData seed = _seeds.get(seedId);
|
||||||
|
|
||||||
if (seed != null)
|
if (seed != null)
|
||||||
{
|
{
|
||||||
return seed.getReward(type);
|
return seed.getReward(type);
|
||||||
@@ -232,7 +211,6 @@ public class Manor
|
|||||||
public List<Integer> getCropsForCastle(int castleId)
|
public List<Integer> getCropsForCastle(int castleId)
|
||||||
{
|
{
|
||||||
final List<Integer> crops = new ArrayList<>();
|
final List<Integer> crops = new ArrayList<>();
|
||||||
|
|
||||||
for (SeedData seed : _seeds.values())
|
for (SeedData seed : _seeds.values())
|
||||||
{
|
{
|
||||||
if ((seed.getManorId() == castleId) && !crops.contains(seed.getCrop()))
|
if ((seed.getManorId() == castleId) && !crops.contains(seed.getCrop()))
|
||||||
@@ -240,7 +218,6 @@ public class Manor
|
|||||||
crops.add(seed.getCrop());
|
crops.add(seed.getCrop());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return crops;
|
return crops;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +229,6 @@ public class Manor
|
|||||||
public List<Integer> getSeedsForCastle(int castleId)
|
public List<Integer> getSeedsForCastle(int castleId)
|
||||||
{
|
{
|
||||||
final List<Integer> seedsID = new ArrayList<>();
|
final List<Integer> seedsID = new ArrayList<>();
|
||||||
|
|
||||||
for (SeedData seed : _seeds.values())
|
for (SeedData seed : _seeds.values())
|
||||||
{
|
{
|
||||||
if ((seed.getManorId() == castleId) && !seedsID.contains(seed.getId()))
|
if ((seed.getManorId() == castleId) && !seedsID.contains(seed.getId()))
|
||||||
@@ -260,7 +236,6 @@ public class Manor
|
|||||||
seedsID.add(seed.getId());
|
seedsID.add(seed.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return seedsID;
|
return seedsID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +257,6 @@ public class Manor
|
|||||||
public int getSeedSaleLimit(int seedId)
|
public int getSeedSaleLimit(int seedId)
|
||||||
{
|
{
|
||||||
final SeedData seed = _seeds.get(seedId);
|
final SeedData seed = _seeds.get(seedId);
|
||||||
|
|
||||||
if (seed != null)
|
if (seed != null)
|
||||||
{
|
{
|
||||||
return seed.getSeedLimit();
|
return seed.getSeedLimit();
|
||||||
@@ -477,4 +451,14 @@ public class Manor
|
|||||||
|
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Manor getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final Manor INSTANCE = new Manor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,11 +37,11 @@ public class Potion extends WorldObject
|
|||||||
|
|
||||||
class PotionHpHealing implements Runnable
|
class PotionHpHealing implements Runnable
|
||||||
{
|
{
|
||||||
Creature _instance;
|
Creature _creature;
|
||||||
|
|
||||||
public PotionHpHealing(Creature instance)
|
public PotionHpHealing(Creature creature)
|
||||||
{
|
{
|
||||||
_instance = instance;
|
_creature = creature;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -51,7 +51,7 @@ public class Potion extends WorldObject
|
|||||||
{
|
{
|
||||||
synchronized (_hpLock)
|
synchronized (_hpLock)
|
||||||
{
|
{
|
||||||
double nowHp = _instance.getCurrentHp();
|
double nowHp = _creature.getCurrentHp();
|
||||||
|
|
||||||
if (_duration == 0)
|
if (_duration == 0)
|
||||||
{
|
{
|
||||||
@@ -60,7 +60,7 @@ public class Potion extends WorldObject
|
|||||||
if (_duration != 0)
|
if (_duration != 0)
|
||||||
{
|
{
|
||||||
nowHp += _effect;
|
nowHp += _effect;
|
||||||
_instance.setCurrentHp(nowHp);
|
_creature.setCurrentHp(nowHp);
|
||||||
_duration = _duration - (_milliseconds / 1000);
|
_duration = _duration - (_milliseconds / 1000);
|
||||||
setCurrentHpPotion2();
|
setCurrentHpPotion2();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,9 +71,6 @@ public class World
|
|||||||
/** List with the pets instances and their owner id. */
|
/** List with the pets instances and their owner id. */
|
||||||
private static final Map<Integer, PetInstance> _petsInstance = new ConcurrentHashMap<>();
|
private static final Map<Integer, PetInstance> _petsInstance = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/** The _instance. */
|
|
||||||
private static World _instance = null;
|
|
||||||
|
|
||||||
/** The _world regions. */
|
/** The _world regions. */
|
||||||
private WorldRegion[][] _worldRegions;
|
private WorldRegion[][] _worldRegions;
|
||||||
|
|
||||||
@@ -82,19 +79,6 @@ public class World
|
|||||||
initRegions();
|
initRegions();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the single instance of World.
|
|
||||||
* @return the current instance of World.
|
|
||||||
*/
|
|
||||||
public static World getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new World();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add WorldObject object in _allObjects.<BR>
|
* Add WorldObject object in _allObjects.<BR>
|
||||||
* <BR>
|
* <BR>
|
||||||
@@ -853,19 +837,29 @@ public class World
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the account players.
|
* Gets the account players.
|
||||||
* @param account_name the account_name
|
* @param account the account_name
|
||||||
* @return the account players
|
* @return the account players
|
||||||
*/
|
*/
|
||||||
public List<PlayerInstance> getAccountPlayers(String account_name)
|
public List<PlayerInstance> getAccountPlayers(String account)
|
||||||
{
|
{
|
||||||
final List<PlayerInstance> players_for_account = new ArrayList<>();
|
final List<PlayerInstance> result = new ArrayList<>();
|
||||||
for (PlayerInstance actual : _allPlayers.values())
|
for (PlayerInstance actual : _allPlayers.values())
|
||||||
{
|
{
|
||||||
if (actual.getAccountName().equals(account_name))
|
if (actual.getAccountName().equals(account))
|
||||||
{
|
{
|
||||||
players_for_account.add(actual);
|
result.add(actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return players_for_account;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static World getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final World INSTANCE = new World();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public class Announcements
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(Announcements.class.getName());
|
private static Logger LOGGER = Logger.getLogger(Announcements.class.getName());
|
||||||
|
|
||||||
private static Announcements _instance;
|
|
||||||
private final List<String> _announcements = new ArrayList<>();
|
private final List<String> _announcements = new ArrayList<>();
|
||||||
private final List<List<Object>> _eventAnnouncements = new ArrayList<>();
|
private final List<List<Object>> _eventAnnouncements = new ArrayList<>();
|
||||||
|
|
||||||
@@ -55,16 +54,6 @@ public class Announcements
|
|||||||
loadAnnouncements();
|
loadAnnouncements();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Announcements getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new Announcements();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadAnnouncements()
|
public void loadAnnouncements()
|
||||||
{
|
{
|
||||||
_announcements.clear();
|
_announcements.clear();
|
||||||
@@ -287,4 +276,14 @@ public class Announcements
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Announcements getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final Announcements INSTANCE = new Announcements();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ public class Hero
|
|||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(Hero.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(Hero.class.getName());
|
||||||
|
|
||||||
private static Hero _instance;
|
|
||||||
private static final String GET_HEROES = "SELECT * FROM heroes WHERE played = 1";
|
private static final String GET_HEROES = "SELECT * FROM heroes WHERE played = 1";
|
||||||
private static final String GET_ALL_HEROES = "SELECT * FROM heroes";
|
private static final String GET_ALL_HEROES = "SELECT * FROM heroes";
|
||||||
private static final String UPDATE_ALL = "UPDATE heroes SET played = 0";
|
private static final String UPDATE_ALL = "UPDATE heroes SET played = 0";
|
||||||
@@ -68,15 +67,6 @@ public class Hero
|
|||||||
public static final String ALLY_NAME = "ally_name";
|
public static final String ALLY_NAME = "ally_name";
|
||||||
public static final String ALLY_CREST = "ally_crest";
|
public static final String ALLY_CREST = "ally_crest";
|
||||||
|
|
||||||
public static Hero getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new Hero();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Hero()
|
public Hero()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@@ -496,4 +486,14 @@ public class Hero
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Hero getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final Hero INSTANCE = new Hero();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,6 @@ import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
|||||||
public class MonsterRace
|
public class MonsterRace
|
||||||
{
|
{
|
||||||
private final NpcInstance[] _monsters;
|
private final NpcInstance[] _monsters;
|
||||||
private static MonsterRace _instance;
|
|
||||||
private Constructor<?> _constructor;
|
private Constructor<?> _constructor;
|
||||||
private int[][] _speeds;
|
private int[][] _speeds;
|
||||||
private final int[] _first;
|
private final int[] _first;
|
||||||
@@ -41,16 +40,6 @@ public class MonsterRace
|
|||||||
_second = new int[2];
|
_second = new int[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MonsterRace getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new MonsterRace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void newRace()
|
public void newRace()
|
||||||
{
|
{
|
||||||
int random = 0;
|
int random = 0;
|
||||||
@@ -148,4 +137,14 @@ public class MonsterRace
|
|||||||
{
|
{
|
||||||
return _second[0];
|
return _second[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MonsterRace getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final MonsterRace INSTANCE = new MonsterRace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ public class Rebirth
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(BitSetIDFactory.class.getName());
|
private static Logger LOGGER = Logger.getLogger(BitSetIDFactory.class.getName());
|
||||||
|
|
||||||
private static Rebirth _instance = null;
|
|
||||||
private final HashMap<Integer, Integer> _playersRebirthInfo = new HashMap<>();
|
private final HashMap<Integer, Integer> _playersRebirthInfo = new HashMap<>();
|
||||||
|
|
||||||
private Rebirth()
|
private Rebirth()
|
||||||
@@ -55,19 +54,6 @@ public class Rebirth
|
|||||||
// Do Nothing ^_-
|
// Do Nothing ^_-
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Receives the non-static instance of the RebirthManager.
|
|
||||||
* @return single instance of Rebirth
|
|
||||||
*/
|
|
||||||
public static Rebirth getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new Rebirth();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is what it called from the Bypass Handler. (I think that's all thats needed here).
|
* This is what it called from the Bypass Handler. (I think that's all thats needed here).
|
||||||
* @param player the player
|
* @param player the player
|
||||||
@@ -478,4 +464,14 @@ public class Rebirth
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Rebirth getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final Rebirth INSTANCE = new Rebirth();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -52,8 +52,6 @@ public class Lottery
|
|||||||
protected boolean _isStarted;
|
protected boolean _isStarted;
|
||||||
protected long _enddate;
|
protected long _enddate;
|
||||||
|
|
||||||
private static Lottery _instance;
|
|
||||||
|
|
||||||
private Lottery()
|
private Lottery()
|
||||||
{
|
{
|
||||||
_number = 1;
|
_number = 1;
|
||||||
@@ -68,16 +66,6 @@ public class Lottery
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Lottery getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new Lottery();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId()
|
public int getId()
|
||||||
{
|
{
|
||||||
return _number;
|
return _number;
|
||||||
@@ -554,4 +542,14 @@ public class Lottery
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Lottery getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final Lottery INSTANCE = new Lottery();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,17 +31,6 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
public class PcPoint implements Runnable
|
public class PcPoint implements Runnable
|
||||||
{
|
{
|
||||||
Logger LOGGER = Logger.getLogger(PcPoint.class.getName());
|
Logger LOGGER = Logger.getLogger(PcPoint.class.getName());
|
||||||
private static PcPoint _instance;
|
|
||||||
|
|
||||||
public static PcPoint getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new PcPoint();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PcPoint()
|
private PcPoint()
|
||||||
{
|
{
|
||||||
@@ -83,4 +72,14 @@ public class PcPoint implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PcPoint getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final PcPoint INSTANCE = new PcPoint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
public class Olympiad
|
public class Olympiad
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(Olympiad.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(Olympiad.class.getName());
|
||||||
private static Olympiad _instance;
|
|
||||||
|
|
||||||
private static Map<Integer, StatsSet> _nobles;
|
private static Map<Integer, StatsSet> _nobles;
|
||||||
private static Map<Integer, StatsSet> _oldnobles;
|
private static Map<Integer, StatsSet> _oldnobles;
|
||||||
@@ -161,15 +160,6 @@ public class Olympiad
|
|||||||
NON_CLASSED
|
NON_CLASSED
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Olympiad getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new Olympiad();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Olympiad()
|
public Olympiad()
|
||||||
{
|
{
|
||||||
load();
|
load();
|
||||||
@@ -1774,4 +1764,14 @@ public class Olympiad
|
|||||||
_nextWeeklyChange = nextChange.getTimeInMillis() + restoreTime;
|
_nextWeeklyChange = nextChange.getTimeInMillis() + restoreTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Olympiad getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final Olympiad INSTANCE = new Olympiad();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ public class SevenSigns
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(SevenSigns.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(SevenSigns.class.getName());
|
||||||
|
|
||||||
private static SevenSigns _instance;
|
|
||||||
public static final String SEVEN_SIGNS_DATA_FILE = "config/main/sevensigns.ini";
|
public static final String SEVEN_SIGNS_DATA_FILE = "config/main/sevensigns.ini";
|
||||||
public static final String SEVEN_SIGNS_HTML_PATH = "data/html/seven_signs/";
|
public static final String SEVEN_SIGNS_HTML_PATH = "data/html/seven_signs/";
|
||||||
public static final int CABAL_NULL = 0;
|
public static final int CABAL_NULL = 0;
|
||||||
@@ -349,20 +348,6 @@ public class SevenSigns
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the single instance of SevenSigns.
|
|
||||||
* @return single instance of SevenSigns
|
|
||||||
*/
|
|
||||||
public static SevenSigns getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new SevenSigns();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calc contribution score.
|
* Calc contribution score.
|
||||||
* @param blueCount the blue count
|
* @param blueCount the blue count
|
||||||
@@ -1652,4 +1637,14 @@ public class SevenSigns
|
|||||||
ThreadPool.schedule(sspc, getMilliToPeriodChange());
|
ThreadPool.schedule(sspc, getMilliToPeriodChange());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SevenSigns getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final SevenSigns INSTANCE = new SevenSigns();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ public class SevenSignsFestival implements SpawnListener
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(SevenSignsFestival.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(SevenSignsFestival.class.getName());
|
||||||
|
|
||||||
private static SevenSignsFestival _instance;
|
|
||||||
private static final String GET_CLAN_NAME = "SELECT clan_name FROM clan_data WHERE clan_id = (SELECT clanid FROM characters WHERE char_name = ?)";
|
private static final String GET_CLAN_NAME = "SELECT clan_name FROM clan_data WHERE clan_id = (SELECT clanid FROM characters WHERE char_name = ?)";
|
||||||
public static final long FESTIVAL_SIGNUP_TIME = Config.ALT_FESTIVAL_CYCLE_LENGTH - Config.ALT_FESTIVAL_LENGTH - 60000;
|
public static final long FESTIVAL_SIGNUP_TIME = Config.ALT_FESTIVAL_CYCLE_LENGTH - Config.ALT_FESTIVAL_LENGTH - 60000;
|
||||||
private static final int FESTIVAL_MAX_OFFSET_X = 230;
|
private static final int FESTIVAL_MAX_OFFSET_X = 230;
|
||||||
@@ -3169,20 +3168,6 @@ public class SevenSignsFestival implements SpawnListener
|
|||||||
startFestivalManager();
|
startFestivalManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the single instance of SevenSignsFestival.
|
|
||||||
* @return single instance of SevenSignsFestival
|
|
||||||
*/
|
|
||||||
public static SevenSignsFestival getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new SevenSignsFestival();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the associated name (level range) to a given festival ID.
|
* Returns the associated name (level range) to a given festival ID.
|
||||||
* @param festivalID the festival id
|
* @param festivalID the festival id
|
||||||
@@ -4920,4 +4905,14 @@ public class SevenSignsFestival implements SpawnListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SevenSignsFestival getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final SevenSignsFestival INSTANCE = new SevenSignsFestival();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import org.l2jmobius.gameserver.taskmanager.ExclusiveTask;
|
|||||||
public class BanditStrongholdSiege extends ClanHallSiege
|
public class BanditStrongholdSiege extends ClanHallSiege
|
||||||
{
|
{
|
||||||
protected static Logger LOGGER = Logger.getLogger(BanditStrongholdSiege.class.getName());
|
protected static Logger LOGGER = Logger.getLogger(BanditStrongholdSiege.class.getName());
|
||||||
private static BanditStrongholdSiege _instance;
|
|
||||||
boolean _registrationPeriod = false;
|
boolean _registrationPeriod = false;
|
||||||
private int _clanCounter = 0;
|
private int _clanCounter = 0;
|
||||||
protected Map<Integer, clanPlayersInfo> _clansInfo = new HashMap<>();
|
protected Map<Integer, clanPlayersInfo> _clansInfo = new HashMap<>();
|
||||||
@@ -60,15 +60,6 @@ public class BanditStrongholdSiege extends ClanHallSiege
|
|||||||
protected boolean _finalStage = false;
|
protected boolean _finalStage = false;
|
||||||
protected ScheduledFuture<?> _midTimer;
|
protected ScheduledFuture<?> _midTimer;
|
||||||
|
|
||||||
public static final BanditStrongholdSiege getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new BanditStrongholdSiege();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private BanditStrongholdSiege()
|
private BanditStrongholdSiege()
|
||||||
{
|
{
|
||||||
LOGGER.info("SiegeManager of Bandits Stronghold");
|
LOGGER.info("SiegeManager of Bandits Stronghold");
|
||||||
@@ -690,4 +681,14 @@ public class BanditStrongholdSiege extends ClanHallSiege
|
|||||||
public MonsterInstance _mob = null;
|
public MonsterInstance _mob = null;
|
||||||
public List<String> _players = new ArrayList<>();
|
public List<String> _players = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BanditStrongholdSiege getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final BanditStrongholdSiege INSTANCE = new BanditStrongholdSiege();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import org.l2jmobius.gameserver.model.spawn.Spawn;
|
|||||||
public class DevastatedCastle
|
public class DevastatedCastle
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(DevastatedCastle.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(DevastatedCastle.class.getName());
|
||||||
private static DevastatedCastle _instance;
|
|
||||||
private final Map<Integer, DamageInfo> _clansDamageInfo;
|
private final Map<Integer, DamageInfo> _clansDamageInfo;
|
||||||
|
|
||||||
private static int START_DAY = 1;
|
private static int START_DAY = 1;
|
||||||
@@ -70,15 +70,6 @@ public class DevastatedCastle
|
|||||||
|
|
||||||
public boolean _progress = false;
|
public boolean _progress = false;
|
||||||
|
|
||||||
public static DevastatedCastle getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new DevastatedCastle();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected class DamageInfo
|
protected class DamageInfo
|
||||||
{
|
{
|
||||||
public Clan _clan;
|
public Clan _clan;
|
||||||
@@ -883,4 +874,14 @@ public class DevastatedCastle
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DevastatedCastle getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final DevastatedCastle INSTANCE = new DevastatedCastle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import org.l2jmobius.gameserver.model.spawn.Spawn;
|
|||||||
public class FortressOfResistance
|
public class FortressOfResistance
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(FortressOfResistance.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(FortressOfResistance.class.getName());
|
||||||
private static FortressOfResistance _instance;
|
|
||||||
private final Map<Integer, DamageInfo> _clansDamageInfo;
|
private final Map<Integer, DamageInfo> _clansDamageInfo;
|
||||||
|
|
||||||
private static int START_DAY = 1;
|
private static int START_DAY = 1;
|
||||||
@@ -56,15 +56,6 @@ public class FortressOfResistance
|
|||||||
|
|
||||||
private final Calendar _capturetime = Calendar.getInstance();
|
private final Calendar _capturetime = Calendar.getInstance();
|
||||||
|
|
||||||
public static FortressOfResistance getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new FortressOfResistance();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected class DamageInfo
|
protected class DamageInfo
|
||||||
{
|
{
|
||||||
public Clan _clan;
|
public Clan _clan;
|
||||||
@@ -375,4 +366,14 @@ public class FortressOfResistance
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FortressOfResistance getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final FortressOfResistance INSTANCE = new FortressOfResistance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import org.l2jmobius.gameserver.taskmanager.ExclusiveTask;
|
|||||||
public class WildBeastFarmSiege extends ClanHallSiege
|
public class WildBeastFarmSiege extends ClanHallSiege
|
||||||
{
|
{
|
||||||
protected static Logger LOGGER = Logger.getLogger(WildBeastFarmSiege.class.getName());
|
protected static Logger LOGGER = Logger.getLogger(WildBeastFarmSiege.class.getName());
|
||||||
private static WildBeastFarmSiege _instance;
|
|
||||||
boolean _registrationPeriod = false;
|
boolean _registrationPeriod = false;
|
||||||
private int _clanCounter = 0;
|
private int _clanCounter = 0;
|
||||||
protected Map<Integer, clanPlayersInfo> _clansInfo = new HashMap<>();
|
protected Map<Integer, clanPlayersInfo> _clansInfo = new HashMap<>();
|
||||||
@@ -57,15 +57,6 @@ public class WildBeastFarmSiege extends ClanHallSiege
|
|||||||
protected ScheduledFuture<?> _midTimer;
|
protected ScheduledFuture<?> _midTimer;
|
||||||
private ClanHallZone zone;
|
private ClanHallZone zone;
|
||||||
|
|
||||||
public static final WildBeastFarmSiege getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new WildBeastFarmSiege();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private WildBeastFarmSiege()
|
private WildBeastFarmSiege()
|
||||||
{
|
{
|
||||||
LOGGER.info("SiegeManager of Wild Beasts Farm");
|
LOGGER.info("SiegeManager of Wild Beasts Farm");
|
||||||
@@ -676,4 +667,14 @@ public class WildBeastFarmSiege extends ClanHallSiege
|
|||||||
public MonsterInstance _mob = null;
|
public MonsterInstance _mob = null;
|
||||||
public List<String> _players = new ArrayList<>();
|
public List<String> _players = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static WildBeastFarmSiege getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final WildBeastFarmSiege INSTANCE = new WildBeastFarmSiege();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ public class Multisell
|
|||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(Multisell.class.getName());
|
private static Logger LOGGER = Logger.getLogger(Multisell.class.getName());
|
||||||
private final List<MultiSellListContainer> _entries = new ArrayList<>();
|
private final List<MultiSellListContainer> _entries = new ArrayList<>();
|
||||||
private static Multisell _instance;
|
|
||||||
|
|
||||||
public MultiSellListContainer getList(int id)
|
public MultiSellListContainer getList(int id)
|
||||||
{
|
{
|
||||||
@@ -72,15 +71,6 @@ public class Multisell
|
|||||||
parseData();
|
parseData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Multisell getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new Multisell();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parseData()
|
private void parseData()
|
||||||
{
|
{
|
||||||
_entries.clear();
|
_entries.clear();
|
||||||
@@ -476,4 +466,14 @@ public class Multisell
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Multisell getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final Multisell INSTANCE = new Multisell();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ public class QuestStateManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static QuestStateManager _instance;
|
|
||||||
private List<QuestState> _questStates = new ArrayList<>();
|
private List<QuestState> _questStates = new ArrayList<>();
|
||||||
|
|
||||||
public QuestStateManager()
|
public QuestStateManager()
|
||||||
@@ -87,15 +86,6 @@ public class QuestStateManager
|
|||||||
qs = null;
|
qs = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final QuestStateManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new QuestStateManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return QuestState for specified player instance
|
* Return QuestState for specified player instance
|
||||||
* @param player
|
* @param player
|
||||||
@@ -109,9 +99,7 @@ public class QuestStateManager
|
|||||||
{
|
{
|
||||||
return getQuestStates().get(i);
|
return getQuestStates().get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +113,16 @@ public class QuestStateManager
|
|||||||
{
|
{
|
||||||
_questStates = new ArrayList<>();
|
_questStates = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _questStates;
|
return _questStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static QuestStateManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final QuestStateManager INSTANCE = new QuestStateManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ public class AutoSpawn
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(AutoSpawn.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(AutoSpawn.class.getName());
|
||||||
|
|
||||||
private static AutoSpawn _instance;
|
|
||||||
|
|
||||||
private static final int DEFAULT_INITIAL_SPAWN = 30000; // 30 seconds after registration
|
private static final int DEFAULT_INITIAL_SPAWN = 30000; // 30 seconds after registration
|
||||||
private static final int DEFAULT_RESPAWN = 3600000; // 1 hour in millisecs
|
private static final int DEFAULT_RESPAWN = 3600000; // 1 hour in millisecs
|
||||||
private static final int DEFAULT_DESPAWN = 3600000; // 1 hour in millisecs
|
private static final int DEFAULT_DESPAWN = 3600000; // 1 hour in millisecs
|
||||||
@@ -70,16 +68,6 @@ public class AutoSpawn
|
|||||||
restoreSpawnData();
|
restoreSpawnData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AutoSpawn getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new AutoSpawn();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int size()
|
public int size()
|
||||||
{
|
{
|
||||||
synchronized (_registeredSpawns)
|
synchronized (_registeredSpawns)
|
||||||
@@ -813,4 +801,14 @@ public class AutoSpawn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AutoSpawn getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final AutoSpawn INSTANCE = new AutoSpawn();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,21 +26,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class EventDroplist
|
public class EventDroplist
|
||||||
{
|
{
|
||||||
private static EventDroplist _instance;
|
|
||||||
|
|
||||||
/** The table containing all DataDrop object */
|
/** The table containing all DataDrop object */
|
||||||
private final List<DateDrop> _allNpcDateDrops;
|
private final List<DateDrop> _allNpcDateDrops;
|
||||||
|
|
||||||
public static EventDroplist getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new EventDroplist();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DateDrop
|
public class DateDrop
|
||||||
{
|
{
|
||||||
/** Start and end date of the Event */
|
/** Start and end date of the Event */
|
||||||
@@ -105,4 +93,14 @@ public class EventDroplist
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static EventDroplist getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final EventDroplist INSTANCE = new EventDroplist();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,25 +31,14 @@ import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance;
|
|||||||
public class DecayTaskManager
|
public class DecayTaskManager
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(DecayTaskManager.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(DecayTaskManager.class.getName());
|
||||||
|
|
||||||
protected Map<Creature, Long> _decayTasks = new ConcurrentHashMap<>();
|
protected Map<Creature, Long> _decayTasks = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private static DecayTaskManager _instance;
|
private DecayTaskManager()
|
||||||
|
|
||||||
public DecayTaskManager()
|
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(new DecayScheduler(), 10000, 5000);
|
ThreadPool.scheduleAtFixedRate(new DecayScheduler(), 10000, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DecayTaskManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new DecayTaskManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addDecayTask(Creature actor)
|
public void addDecayTask(Creature actor)
|
||||||
{
|
{
|
||||||
_decayTasks.put(actor, System.currentTimeMillis());
|
_decayTasks.put(actor, System.currentTimeMillis());
|
||||||
@@ -127,4 +116,14 @@ public class DecayTaskManager
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DecayTaskManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final DecayTaskManager INSTANCE = new DecayTaskManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,23 +29,11 @@ public class KnownListUpdateTaskManager
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(DecayTaskManager.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(DecayTaskManager.class.getName());
|
||||||
|
|
||||||
private static KnownListUpdateTaskManager _instance;
|
|
||||||
|
|
||||||
public KnownListUpdateTaskManager()
|
public KnownListUpdateTaskManager()
|
||||||
{
|
{
|
||||||
ThreadPool.scheduleAtFixedRate(new KnownListUpdate(), 1000, 750);
|
ThreadPool.scheduleAtFixedRate(new KnownListUpdate(), 1000, 750);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static KnownListUpdateTaskManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new KnownListUpdateTaskManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class KnownListUpdate implements Runnable
|
private class KnownListUpdate implements Runnable
|
||||||
{
|
{
|
||||||
boolean toggle = false;
|
boolean toggle = false;
|
||||||
@@ -136,4 +124,14 @@ public class KnownListUpdateTaskManager
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static KnownListUpdateTaskManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final KnownListUpdateTaskManager INSTANCE = new KnownListUpdateTaskManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ import org.l2jmobius.gameserver.taskmanager.tasks.TaskShutdown;
|
|||||||
public class TaskManager
|
public class TaskManager
|
||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
||||||
private static TaskManager _instance;
|
|
||||||
|
|
||||||
protected static final String[] SQL_STATEMENTS =
|
protected static final String[] SQL_STATEMENTS =
|
||||||
{
|
{
|
||||||
@@ -171,15 +170,6 @@ public class TaskManager
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TaskManager getInstance()
|
|
||||||
{
|
|
||||||
if (_instance == null)
|
|
||||||
{
|
|
||||||
_instance = new TaskManager();
|
|
||||||
}
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TaskManager()
|
private TaskManager()
|
||||||
{
|
{
|
||||||
initializate();
|
initializate();
|
||||||
@@ -408,4 +398,14 @@ public class TaskManager
|
|||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TaskManager getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final TaskManager INSTANCE = new TaskManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,8 @@ package org.l2jmobius.loginserver;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.GeneralSecurityException;
|
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
|
||||||
import java.security.KeyPair;
|
import java.security.KeyPair;
|
||||||
import java.security.KeyPairGenerator;
|
import java.security.KeyPairGenerator;
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.security.spec.RSAKeyGenParameterSpec;
|
import java.security.spec.RSAKeyGenParameterSpec;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
@@ -52,7 +49,6 @@ import org.l2jmobius.loginserver.network.gameserverpackets.ServerStatus;
|
|||||||
public class GameServerTable
|
public class GameServerTable
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(GameServerTable.class.getName());
|
private static Logger LOGGER = Logger.getLogger(GameServerTable.class.getName());
|
||||||
private static GameServerTable _instance;
|
|
||||||
|
|
||||||
// Server Names Config
|
// Server Names Config
|
||||||
private static Map<Integer, String> _serverNames = new HashMap<>();
|
private static Map<Integer, String> _serverNames = new HashMap<>();
|
||||||
@@ -64,24 +60,10 @@ public class GameServerTable
|
|||||||
private static final int KEYS_SIZE = 10;
|
private static final int KEYS_SIZE = 10;
|
||||||
private KeyPair[] _keyPairs;
|
private KeyPair[] _keyPairs;
|
||||||
|
|
||||||
public static void load() throws GeneralSecurityException
|
/**
|
||||||
{
|
* Instantiates a new game server table.
|
||||||
if (_instance == null)
|
*/
|
||||||
{
|
public GameServerTable()
|
||||||
_instance = new GameServerTable();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IllegalStateException("Load can only be invoked a single time.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GameServerTable getInstance()
|
|
||||||
{
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GameServerTable() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException
|
|
||||||
{
|
{
|
||||||
loadServerNames();
|
loadServerNames();
|
||||||
LOGGER.info("Loaded " + _serverNames.size() + " server names");
|
LOGGER.info("Loaded " + _serverNames.size() + " server names");
|
||||||
@@ -93,16 +75,23 @@ public class GameServerTable
|
|||||||
LOGGER.info("Cached " + _keyPairs.length + " RSA keys for Game Server communication.");
|
LOGGER.info("Cached " + _keyPairs.length + " RSA keys for Game Server communication.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadRSAKeys() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException
|
private void loadRSAKeys()
|
||||||
{
|
{
|
||||||
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
|
try
|
||||||
RSAKeyGenParameterSpec spec = new RSAKeyGenParameterSpec(512, RSAKeyGenParameterSpec.F4);
|
|
||||||
keyGen.initialize(spec);
|
|
||||||
|
|
||||||
_keyPairs = new KeyPair[KEYS_SIZE];
|
|
||||||
for (int i = 0; i < KEYS_SIZE; i++)
|
|
||||||
{
|
{
|
||||||
_keyPairs[i] = keyGen.genKeyPair();
|
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
|
||||||
|
RSAKeyGenParameterSpec spec = new RSAKeyGenParameterSpec(512, RSAKeyGenParameterSpec.F4);
|
||||||
|
keyGen.initialize(spec);
|
||||||
|
|
||||||
|
_keyPairs = new KeyPair[KEYS_SIZE];
|
||||||
|
for (int i = 0; i < KEYS_SIZE; i++)
|
||||||
|
{
|
||||||
|
_keyPairs[i] = keyGen.genKeyPair();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.severe("Error loading RSA keys for Game Server communication!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,4 +448,21 @@ public class GameServerTable
|
|||||||
setStatus(ServerStatus.STATUS_DOWN);
|
setStatus(ServerStatus.STATUS_DOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the single instance of GameServerTable.
|
||||||
|
* @return single instance of GameServerTable
|
||||||
|
*/
|
||||||
|
public static GameServerTable getInstance()
|
||||||
|
{
|
||||||
|
return SingletonHolder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class SingletonHolder.
|
||||||
|
*/
|
||||||
|
private static class SingletonHolder
|
||||||
|
{
|
||||||
|
protected static final GameServerTable INSTANCE = new GameServerTable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,12 +104,7 @@ public class LoginServer
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GameServerTable.load();
|
GameServerTable.getInstance();
|
||||||
}
|
|
||||||
catch (GeneralSecurityException e)
|
|
||||||
{
|
|
||||||
LOGGER.severe("Failed to load GameServerTable" + e);
|
|
||||||
System.exit(1);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -765,13 +765,13 @@ public class GameStatusThread extends Thread
|
|||||||
else if (type.equals("zone"))
|
else if (type.equals("zone"))
|
||||||
{
|
{
|
||||||
_print.print("Reloading zone tables... ");
|
_print.print("Reloading zone tables... ");
|
||||||
ZoneData.getInstance().reload();
|
ZoneData.getInstance().load();
|
||||||
_print.println("done");
|
_print.println("done");
|
||||||
}
|
}
|
||||||
else if (type.equals("teleports"))
|
else if (type.equals("teleports"))
|
||||||
{
|
{
|
||||||
_print.print("Reloading telport location table... ");
|
_print.print("Reloading telport location table... ");
|
||||||
TeleportLocationTable.getInstance().reloadAll();
|
TeleportLocationTable.getInstance().load();
|
||||||
_print.println("done");
|
_print.println("done");
|
||||||
}
|
}
|
||||||
else if (type.equals("spawns"))
|
else if (type.equals("spawns"))
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.GeneralSecurityException;
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -69,16 +68,6 @@ public abstract class BaseGameServerRegister
|
|||||||
Config.load(ServerMode.LOGIN);
|
Config.load(ServerMode.LOGIN);
|
||||||
DatabaseFactory.init();
|
DatabaseFactory.init();
|
||||||
GameServerTable.getInstance();
|
GameServerTable.getInstance();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
GameServerTable.load();
|
|
||||||
}
|
|
||||||
catch (GeneralSecurityException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user