Advertisement
Guest User

Untitled

a guest
Jan 4th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.99 KB | None | 0 0
  1. /*
  2. * L2jFrozen Project - www.l2jfrozen.com
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2, or (at your option)
  7. * any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  17. * 02111-1307, USA.
  18. *
  19. * http://www.gnu.org/copyleft/gpl.html
  20. */
  21. package com.l2jfrozen.gameserver;
  22.  
  23. import java.io.File;
  24. import java.io.FileInputStream;
  25. import java.io.IOException;
  26. import java.io.InputStream;
  27. import java.net.InetAddress;
  28. import java.net.UnknownHostException;
  29. import java.util.Calendar;
  30. import java.util.logging.LogManager;
  31.  
  32. import org.apache.log4j.Logger;
  33. import org.apache.log4j.PropertyConfigurator;
  34.  
  35. import Extensions.balancer.BalanceLoad;
  36. import Extensions.ban.BanManager;
  37.  
  38. import com.l2jfrozen.Config;
  39. import com.l2jfrozen.FService;
  40. import com.l2jfrozen.L2Frozen;
  41. import com.l2jfrozen.ServerType;
  42. import com.l2jfrozen.crypt.nProtect;
  43. import com.l2jfrozen.gameserver.ai.special.manager.AILoader;
  44. import com.l2jfrozen.gameserver.cache.CrestCache;
  45. import com.l2jfrozen.gameserver.cache.HtmCache;
  46. import com.l2jfrozen.gameserver.communitybbs.Manager.ForumsBBSManager;
  47. import com.l2jfrozen.gameserver.controllers.GameTimeController;
  48. import com.l2jfrozen.gameserver.controllers.RecipeController;
  49. import com.l2jfrozen.gameserver.controllers.TradeController;
  50. import com.l2jfrozen.gameserver.custom.AutoVoteReward;
  51. import com.l2jfrozen.gameserver.custom.BalanceManager;
  52. import com.l2jfrozen.gameserver.custom.ClassBalanceManager;
  53. import com.l2jfrozen.gameserver.custom.SkillsBalanceManager;
  54. import com.l2jfrozen.gameserver.datatables.GmListTable;
  55. import com.l2jfrozen.gameserver.datatables.HeroSkillTable;
  56. import com.l2jfrozen.gameserver.datatables.NobleSkillTable;
  57. import com.l2jfrozen.gameserver.datatables.OfflineTradeTable;
  58. import com.l2jfrozen.gameserver.datatables.SkillTable;
  59. import com.l2jfrozen.gameserver.datatables.csv.DoorTable;
  60. import com.l2jfrozen.gameserver.datatables.csv.ExtractableItemsData;
  61. import com.l2jfrozen.gameserver.datatables.csv.FishTable;
  62. import com.l2jfrozen.gameserver.datatables.csv.HennaTable;
  63. import com.l2jfrozen.gameserver.datatables.csv.MapRegionTable;
  64. import com.l2jfrozen.gameserver.datatables.csv.NpcWalkerRoutesTable;
  65. import com.l2jfrozen.gameserver.datatables.csv.RecipeTable;
  66. import com.l2jfrozen.gameserver.datatables.csv.StaticObjects;
  67. import com.l2jfrozen.gameserver.datatables.csv.SummonItemsData;
  68. import com.l2jfrozen.gameserver.datatables.sql.AccessLevels;
  69. import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights;
  70. import com.l2jfrozen.gameserver.datatables.sql.ArmorSetsTable;
  71. import com.l2jfrozen.gameserver.datatables.sql.CharNameTable;
  72. import com.l2jfrozen.gameserver.datatables.sql.CharTemplateTable;
  73. import com.l2jfrozen.gameserver.datatables.sql.ClanTable;
  74. import com.l2jfrozen.gameserver.datatables.sql.CustomArmorSetsTable;
  75. import com.l2jfrozen.gameserver.datatables.sql.HelperBuffTable;
  76. import com.l2jfrozen.gameserver.datatables.sql.HennaTreeTable;
  77. import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
  78. import com.l2jfrozen.gameserver.datatables.sql.L2PetDataTable;
  79. import com.l2jfrozen.gameserver.datatables.sql.LevelUpData;
  80. import com.l2jfrozen.gameserver.datatables.sql.NpcTable;
  81. import com.l2jfrozen.gameserver.datatables.sql.SkillSpellbookTable;
  82. import com.l2jfrozen.gameserver.datatables.sql.SkillTreeTable;
  83. import com.l2jfrozen.gameserver.datatables.sql.SpawnTable;
  84. import com.l2jfrozen.gameserver.datatables.sql.TeleportLocationTable;
  85. import com.l2jfrozen.gameserver.datatables.xml.AugmentationData;
  86. import com.l2jfrozen.gameserver.datatables.xml.ExperienceData;
  87. import com.l2jfrozen.gameserver.datatables.xml.ZoneData;
  88. import com.l2jfrozen.gameserver.geo.GeoData;
  89. import com.l2jfrozen.gameserver.geo.geoeditorcon.GeoEditorListener;
  90. import com.l2jfrozen.gameserver.geo.pathfinding.PathFinding;
  91. import com.l2jfrozen.gameserver.handler.AdminCommandHandler;
  92. import com.l2jfrozen.gameserver.handler.AutoAnnouncementHandler;
  93. import com.l2jfrozen.gameserver.handler.AutoChatHandler;
  94. import com.l2jfrozen.gameserver.handler.ItemHandler;
  95. import com.l2jfrozen.gameserver.handler.SkillHandler;
  96. import com.l2jfrozen.gameserver.handler.UserCommandHandler;
  97. import com.l2jfrozen.gameserver.handler.VoicedCommandHandler;
  98. import com.l2jfrozen.gameserver.idfactory.IdFactory;
  99. import com.l2jfrozen.gameserver.managers.AuctionManager;
  100. import com.l2jfrozen.gameserver.managers.AutoSaveManager;
  101. import com.l2jfrozen.gameserver.managers.AwayManager;
  102. import com.l2jfrozen.gameserver.managers.BoatManager;
  103. import com.l2jfrozen.gameserver.managers.CastleManager;
  104. import com.l2jfrozen.gameserver.managers.CastleManorManager;
  105. import com.l2jfrozen.gameserver.managers.ClanHallManager;
  106. import com.l2jfrozen.gameserver.managers.ClassDamageManager;
  107. import com.l2jfrozen.gameserver.managers.CoupleManager;
  108. import com.l2jfrozen.gameserver.managers.CrownManager;
  109. import com.l2jfrozen.gameserver.managers.CursedWeaponsManager;
  110. import com.l2jfrozen.gameserver.managers.DayNightSpawnManager;
  111. import com.l2jfrozen.gameserver.managers.DimensionalRiftManager;
  112. import com.l2jfrozen.gameserver.managers.DuelManager;
  113. import com.l2jfrozen.gameserver.managers.FortManager;
  114. import com.l2jfrozen.gameserver.managers.FortSiegeManager;
  115. import com.l2jfrozen.gameserver.managers.FourSepulchersManager;
  116. import com.l2jfrozen.gameserver.managers.GrandBossManager;
  117. import com.l2jfrozen.gameserver.managers.IrcManager;
  118. import com.l2jfrozen.gameserver.managers.ItemsOnGroundManager;
  119. import com.l2jfrozen.gameserver.managers.MercTicketManager;
  120. import com.l2jfrozen.gameserver.managers.PetitionManager;
  121. import com.l2jfrozen.gameserver.managers.QuestManager;
  122. import com.l2jfrozen.gameserver.managers.RaidBossPointsManager;
  123. import com.l2jfrozen.gameserver.managers.RaidBossSpawnManager;
  124. import com.l2jfrozen.gameserver.managers.SiegeManager;
  125. import com.l2jfrozen.gameserver.model.L2Manor;
  126. import com.l2jfrozen.gameserver.model.L2World;
  127. import com.l2jfrozen.gameserver.model.PartyMatchRoomList;
  128. import com.l2jfrozen.gameserver.model.PartyMatchWaitingList;
  129. import com.l2jfrozen.gameserver.model.entity.Announcements;
  130. import com.l2jfrozen.gameserver.model.entity.Hero;
  131. import com.l2jfrozen.gameserver.model.entity.MonsterRace;
  132. import com.l2jfrozen.gameserver.model.entity.event.manager.EventManager;
  133. import com.l2jfrozen.gameserver.model.entity.event.TriviaEventManager;
  134. import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
  135. import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSigns;
  136. import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSignsFestival;
  137. import com.l2jfrozen.gameserver.model.entity.siege.clanhalls.BanditStrongholdSiege;
  138. import com.l2jfrozen.gameserver.model.entity.siege.clanhalls.DevastatedCastle;
  139. import com.l2jfrozen.gameserver.model.entity.siege.clanhalls.FortressOfResistance;
  140. import com.l2jfrozen.gameserver.model.multisell.L2Multisell;
  141. import com.l2jfrozen.gameserver.model.spawn.AutoSpawn;
  142. import com.l2jfrozen.gameserver.monumentstatuet.EventMonumentStatuet;
  143. import com.l2jfrozen.gameserver.network.L2GameClient;
  144. import com.l2jfrozen.gameserver.network.L2GamePacketHandler;
  145. import com.l2jfrozen.gameserver.powerpak.PowerPak;
  146. import com.l2jfrozen.gameserver.script.EventDroplist;
  147. import com.l2jfrozen.gameserver.script.faenor.FaenorScriptEngine;
  148. import com.l2jfrozen.gameserver.scripting.CompiledScriptCache;
  149. import com.l2jfrozen.gameserver.scripting.L2ScriptEngineManager;
  150. import com.l2jfrozen.gameserver.taskmanager.TaskManager;
  151. import com.l2jfrozen.gameserver.thread.LoginServerThread;
  152. import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
  153. import com.l2jfrozen.gameserver.thread.daemons.DeadlockDetector;
  154. import com.l2jfrozen.gameserver.thread.daemons.ItemsAutoDestroy;
  155. import com.l2jfrozen.gameserver.thread.daemons.PcPoint;
  156. import com.l2jfrozen.gameserver.util.DynamicExtension;
  157. import com.l2jfrozen.gameserver.util.sql.SQLQueue;
  158. import com.l2jfrozen.netcore.NetcoreConfig;
  159. import com.l2jfrozen.netcore.SelectorConfig;
  160. import com.l2jfrozen.netcore.SelectorThread;
  161. import com.l2jfrozen.status.Status;
  162. import com.l2jfrozen.util.IPv4Filter;
  163. import com.l2jfrozen.util.Memory;
  164. import com.l2jfrozen.util.Util;
  165. import com.l2jfrozen.util.database.L2DatabaseFactory;
  166.  
  167. public class GameServer
  168. {
  169. private static Logger LOGGER = Logger.getLogger("Loader");
  170. private static SelectorThread<L2GameClient> _selectorThread;
  171. private static LoginServerThread _loginThread;
  172. private static L2GamePacketHandler _gamePacketHandler;
  173. private static Status _statusServer;
  174.  
  175. public static final Calendar dateTimeServerStarted = Calendar.getInstance();
  176.  
  177. public static void main(final String[] args) throws Exception
  178. {
  179. PropertyConfigurator.configure(FService.LOG_CONF_FILE);
  180. ServerType.serverMode = ServerType.MODE_GAMESERVER;
  181.  
  182. final String LOG_FOLDER_BASE = "log"; // Name of folder for LOGGER base file
  183. final File logFolderBase = new File(LOG_FOLDER_BASE);
  184. logFolderBase.mkdir();
  185.  
  186. // Local Constants
  187. final String LOG_FOLDER = "log/game";
  188.  
  189. // Create LOGGER folder
  190. File logFolder = new File(LOG_FOLDER);
  191. logFolder.mkdir();
  192.  
  193. // Create input stream for LOGGER file -- or store file data into memory
  194.  
  195. // check for legacy Implementation
  196. File log_conf_file = new File(FService.LOG_CONF_FILE);
  197. if (!log_conf_file.exists())
  198. {
  199. // old file position
  200. log_conf_file = new File(FService.LEGACY_LOG_CONF_FILE);
  201. }
  202.  
  203. InputStream is = new FileInputStream(log_conf_file);
  204. LogManager.getLogManager().readConfiguration(is);
  205. is.close();
  206. is = null;
  207. logFolder = null;
  208.  
  209. final long serverLoadStart = System.currentTimeMillis();
  210.  
  211. Util.printSection("Team");
  212.  
  213. // Print L2jfrozen's Logo
  214. L2Frozen.info();
  215.  
  216. // Load GameServer Configs
  217. Config.load();
  218.  
  219. Util.printSection("Database");
  220. L2DatabaseFactory.getInstance();
  221. LOGGER.info("L2DatabaseFactory: loaded.");
  222.  
  223. Util.printSection("Threads");
  224. ThreadPoolManager.getInstance();
  225. if (Config.DEADLOCKCHECK_INTIAL_TIME > 0)
  226. {
  227. ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(DeadlockDetector.getInstance(), Config.DEADLOCKCHECK_INTIAL_TIME, Config.DEADLOCKCHECK_DELAY_TIME);
  228. }
  229. new File(Config.DATAPACK_ROOT, "data/clans").mkdirs();
  230. new File(Config.DATAPACK_ROOT, "data/crests").mkdirs();
  231. new File(Config.DATAPACK_ROOT, "data/pathnode").mkdirs();
  232. new File(Config.DATAPACK_ROOT, "data/geodata").mkdirs();
  233.  
  234. HtmCache.getInstance();
  235. CrestCache.getInstance();
  236. L2ScriptEngineManager.getInstance();
  237.  
  238. nProtect.getInstance();
  239. if (nProtect.isEnabled())
  240. LOGGER.info("nProtect System Enabled");
  241.  
  242. Util.printSection("World");
  243. L2World.getInstance();
  244. MapRegionTable.getInstance();
  245. Announcements.getInstance();
  246. AutoAnnouncementHandler.getInstance();
  247. if (!IdFactory.getInstance().isInitialized())
  248. {
  249. LOGGER.info("Could not read object IDs from DB. Please Check Your Data.");
  250. throw new Exception("Could not initialize the ID factory");
  251. }
  252. StaticObjects.getInstance();
  253. TeleportLocationTable.getInstance();
  254. PartyMatchWaitingList.getInstance();
  255. PartyMatchRoomList.getInstance();
  256. GameTimeController.getInstance();
  257. CharNameTable.getInstance();
  258. ExperienceData.getInstance();
  259. DuelManager.getInstance();
  260.  
  261. if (Config.ENABLE_CLASS_DAMAGES)
  262. ClassDamageManager.loadConfig();
  263.  
  264. if (Config.AUTOSAVE_DELAY_TIME > 0)
  265. {
  266. AutoSaveManager.getInstance().startAutoSaveManager();
  267. }
  268.  
  269. Util.printSection("Skills");
  270. if (!SkillTable.getInstance().isInitialized())
  271. {
  272. LOGGER.info("Could not find the extraced files. Please Check Your Data.");
  273. throw new Exception("Could not initialize the skill table");
  274. }
  275. SkillTreeTable.getInstance();
  276. SkillSpellbookTable.getInstance();
  277. NobleSkillTable.getInstance();
  278. HeroSkillTable.getInstance();
  279. LOGGER.info("Skills: All skills loaded.");
  280.  
  281. Util.printSection("Items");
  282. if (!ItemTable.getInstance().isInitialized())
  283. {
  284. LOGGER.info("Could not find the extraced files. Please Check Your Data.");
  285. throw new Exception("Could not initialize the item table");
  286. }
  287. ArmorSetsTable.getInstance();
  288. if (Config.CUSTOM_ARMORSETS_TABLE)
  289. {
  290. CustomArmorSetsTable.getInstance();
  291. }
  292. ExtractableItemsData.getInstance();
  293. SummonItemsData.getInstance();
  294. if (Config.ALLOWFISHING)
  295. FishTable.getInstance();
  296.  
  297. Util.printSection("Npc");
  298. NpcWalkerRoutesTable.getInstance().load();
  299. if (!NpcTable.getInstance().isInitialized())
  300. {
  301. LOGGER.info("Could not find the extraced files. Please Check Your Data.");
  302. throw new Exception("Could not initialize the npc table");
  303. }
  304.  
  305. Util.printSection("Characters");
  306. if (Config.COMMUNITY_TYPE.equals("full"))
  307. {
  308. ForumsBBSManager.getInstance().initRoot();
  309. }
  310.  
  311. ClanTable.getInstance();
  312. CharTemplateTable.getInstance();
  313. LevelUpData.getInstance();
  314. if (!HennaTable.getInstance().isInitialized())
  315. {
  316. throw new Exception("Could not initialize the Henna Table");
  317. }
  318.  
  319. if (!HennaTreeTable.getInstance().isInitialized())
  320. {
  321. throw new Exception("Could not initialize the Henna Tree Table");
  322. }
  323.  
  324. if (!HelperBuffTable.getInstance().isInitialized())
  325. {
  326. throw new Exception("Could not initialize the Helper Buff Table");
  327. }
  328.  
  329. Util.printSection("Geodata");
  330. GeoData.getInstance();
  331. if (Config.GEODATA == 2)
  332. {
  333. PathFinding.getInstance();
  334. }
  335.  
  336. Util.printSection("Economy");
  337. TradeController.getInstance();
  338. L2Multisell.getInstance();
  339. LOGGER.info("Multisell: loaded.");
  340.  
  341. Util.printSection("Clan Halls");
  342. ClanHallManager.getInstance();
  343. FortressOfResistance.getInstance();
  344. DevastatedCastle.getInstance();
  345. BanditStrongholdSiege.getInstance();
  346. AuctionManager.getInstance();
  347. BalanceManager.getInstance();
  348. SkillsBalanceManager.getInstance();
  349.  
  350. Util.printSection("Zone");
  351. ZoneData.getInstance();
  352.  
  353.  
  354. Util.printSection("Spawnlist");
  355. if (!Config.ALT_DEV_NO_SPAWNS)
  356. {
  357. SpawnTable.getInstance();
  358. }
  359. else
  360. {
  361. LOGGER.info("Spawn: disable load.");
  362. }
  363. if (!Config.ALT_DEV_NO_RB)
  364. {
  365. RaidBossSpawnManager.getInstance();
  366. GrandBossManager.getInstance();
  367. RaidBossPointsManager.init();
  368. }
  369. else
  370. {
  371. LOGGER.info("RaidBoss: disable load.");
  372. }
  373. DayNightSpawnManager.getInstance().notifyChangeMode();
  374.  
  375. Util.printSection("Dimensional Rift");
  376. DimensionalRiftManager.getInstance();
  377.  
  378. Util.printSection("Misc");
  379. RecipeTable.getInstance();
  380. RecipeController.getInstance();
  381. EventDroplist.getInstance();
  382. AugmentationData.getInstance();
  383. MonsterRace.getInstance();
  384. MercTicketManager.getInstance();
  385. PetitionManager.getInstance();
  386. CursedWeaponsManager.getInstance();
  387. TaskManager.getInstance();
  388. L2PetDataTable.getInstance().loadPetsData();
  389. SQLQueue.getInstance();
  390. if (Config.ACCEPT_GEOEDITOR_CONN)
  391. {
  392. GeoEditorListener.getInstance();
  393. }
  394. if (Config.SAVE_DROPPED_ITEM)
  395. {
  396. ItemsOnGroundManager.getInstance();
  397. }
  398. if (Config.AUTODESTROY_ITEM_AFTER > 0 || Config.HERB_AUTO_DESTROY_TIME > 0)
  399. {
  400. ItemsAutoDestroy.getInstance();
  401. }
  402.  
  403. Util.printSection("Manor");
  404. L2Manor.getInstance();
  405. CastleManorManager.getInstance();
  406.  
  407. Util.printSection("Castles");
  408. CastleManager.getInstance();
  409. SiegeManager.getInstance();
  410. FortManager.getInstance();
  411. FortSiegeManager.getInstance();
  412. CrownManager.getInstance();
  413.  
  414. Util.printSection("Boat");
  415. BoatManager.getInstance();
  416.  
  417. Util.printSection("Doors");
  418. DoorTable.getInstance().parseData();
  419.  
  420. Util.printSection("Four Sepulchers");
  421. FourSepulchersManager.getInstance();
  422.  
  423. Util.printSection("Seven Signs");
  424. SevenSigns.getInstance();
  425. SevenSignsFestival.getInstance();
  426. AutoSpawn.getInstance();
  427. AutoChatHandler.getInstance();
  428.  
  429. Util.printSection("Olympiad System");
  430. Olympiad.getInstance();
  431. Hero.getInstance();
  432.  
  433. Util.printSection("Class Balancer");
  434. ClassBalanceManager.getInstance();
  435.  
  436.  
  437.  
  438. BalanceLoad.LoadEm();
  439.  
  440. if(Config.ENABLE_VOTE_SYSTEM)
  441. {
  442. AutoVoteReward.getInstance();
  443. }
  444.  
  445.  
  446. Util.printSection("Access Levels");
  447. AccessLevels.getInstance();
  448. AdminCommandAccessRights.getInstance();
  449. GmListTable.getInstance();
  450.  
  451. Util.printSection("Handlers");
  452. ItemHandler.getInstance();
  453. SkillHandler.getInstance();
  454. AdminCommandHandler.getInstance();
  455. UserCommandHandler.getInstance();
  456. VoicedCommandHandler.getInstance();
  457.  
  458. LOGGER.info("AutoChatHandler : Loaded " + AutoChatHandler.getInstance().size() + " handlers in total.");
  459. LOGGER.info("AutoSpawnHandler : Loaded " + AutoSpawn.getInstance().size() + " handlers in total.");
  460.  
  461. Runtime.getRuntime().addShutdownHook(Shutdown.getInstance());
  462.  
  463. try
  464. {
  465. DoorTable doorTable = DoorTable.getInstance();
  466.  
  467. // Opened by players like L2OFF
  468. // doorTable.getDoor(19160010).openMe();
  469. // doorTable.getDoor(19160011).openMe();
  470.  
  471. doorTable.getDoor(19160012).openMe();
  472. doorTable.getDoor(19160013).openMe();
  473. doorTable.getDoor(19160014).openMe();
  474. doorTable.getDoor(19160015).openMe();
  475. doorTable.getDoor(19160016).openMe();
  476. doorTable.getDoor(19160017).openMe();
  477. doorTable.getDoor(24190001).openMe();
  478. doorTable.getDoor(24190002).openMe();
  479. doorTable.getDoor(24190003).openMe();
  480. doorTable.getDoor(24190004).openMe();
  481. doorTable.getDoor(23180001).openMe();
  482. doorTable.getDoor(23180002).openMe();
  483. doorTable.getDoor(23180003).openMe();
  484. doorTable.getDoor(23180004).openMe();
  485. doorTable.getDoor(23180005).openMe();
  486. doorTable.getDoor(23180006).openMe();
  487. doorTable.checkAutoOpen();
  488. doorTable = null;
  489. }
  490. catch (final NullPointerException e)
  491. {
  492. LOGGER.info("There is errors in your Door.csv file. Update door.csv");
  493. if (Config.ENABLE_ALL_EXCEPTIONS)
  494. e.printStackTrace();
  495. }
  496.  
  497. Util.printSection("AI");
  498. if (!Config.ALT_DEV_NO_AI)
  499. {
  500. AILoader.init();
  501. }
  502. else
  503. {
  504. LOGGER.info("AI: disable load.");
  505. }
  506.  
  507. Util.printSection("Scripts");
  508. if (!Config.ALT_DEV_NO_SCRIPT)
  509. {
  510. final File scripts = new File(Config.DATAPACK_ROOT, "data/scripts.cfg");
  511. L2ScriptEngineManager.getInstance().executeScriptsList(scripts);
  512.  
  513. final CompiledScriptCache compiledScriptCache = L2ScriptEngineManager.getInstance().getCompiledScriptCache();
  514. if (compiledScriptCache == null)
  515. LOGGER.info("Compiled Scripts Cache is disabled.");
  516. else
  517. {
  518. compiledScriptCache.purge();
  519. if (compiledScriptCache.isModified())
  520. {
  521. compiledScriptCache.save();
  522. LOGGER.info("Compiled Scripts Cache was saved.");
  523. }
  524. else
  525. LOGGER.info("Compiled Scripts Cache is up-to-date.");
  526. }
  527. FaenorScriptEngine.getInstance();
  528. }
  529. else
  530. {
  531. LOGGER.info("Script: disable load.");
  532. }
  533.  
  534. /* QUESTS */
  535. Util.printSection("Quests");
  536. if (!Config.ALT_DEV_NO_QUESTS)
  537. {
  538.  
  539. if (QuestManager.getInstance().getQuests().size() == 0)
  540. QuestManager.getInstance().reloadAllQuests();
  541. else
  542. QuestManager.getInstance().report();
  543.  
  544. }
  545. else
  546. {
  547. QuestManager.getInstance().unloadAllQuests();
  548. }
  549.  
  550. Util.printSection("Game Server");
  551.  
  552. if (Config.IRC_ENABLED)
  553. IrcManager.getInstance().getConnection().sendChan(Config.IRC_MSG_START);
  554.  
  555. LOGGER.info("IdFactory: Free ObjectID's remaining: " + IdFactory.getInstance().size());
  556. try
  557. {
  558. DynamicExtension.getInstance();
  559. }
  560. catch (final Exception ex)
  561. {
  562. if (Config.ENABLE_ALL_EXCEPTIONS)
  563. ex.printStackTrace();
  564.  
  565. LOGGER.info("DynamicExtension could not be loaded and initialized" + ex);
  566. }
  567.  
  568. Util.printSection("Custom Mods");
  569.  
  570. if (Config.L2JMOD_ALLOW_WEDDING || Config.ALLOW_AWAY_STATUS || Config.PCB_ENABLE || Config.POWERPAK_ENABLED)
  571. {
  572. if (Config.L2JMOD_ALLOW_WEDDING)
  573. CoupleManager.getInstance();
  574.  
  575. if (Config.ALLOW_AWAY_STATUS)
  576. AwayManager.getInstance();
  577.  
  578. if (Config.PCB_ENABLE)
  579. ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(PcPoint.getInstance(), Config.PCB_INTERVAL * 1000, Config.PCB_INTERVAL * 1000);
  580.  
  581. if (Config.POWERPAK_ENABLED)
  582. PowerPak.getInstance();
  583. }
  584. else
  585. LOGGER.info("All custom mods are Disabled.");
  586.  
  587. Util.printSection("EventManager");
  588. EventManager.getInstance().startEventRegistration();
  589. if (EventManager.TVT_EVENT_ENABLED || EventManager.CTF_EVENT_ENABLED || EventManager.DM_EVENT_ENABLED)
  590. {
  591. if (EventManager.TVT_EVENT_ENABLED)
  592. LOGGER.info("TVT Event is Enabled.");
  593. if (EventManager.CTF_EVENT_ENABLED)
  594. LOGGER.info("CTF Event is Enabled.");
  595. if (EventManager.DM_EVENT_ENABLED)
  596. LOGGER.info("DM Event is Enabled.");
  597. }
  598. else
  599. LOGGER.info("All events are Disabled.");
  600.  
  601. if (Config.EVENT_MONUMENT_STATUET)
  602. {
  603. Util.printSection("Monument Statuet Event");
  604. EventMonumentStatuet.getInstance().load();
  605. EventMonumentStatuet.getInstance().ConfiguratePereiod();
  606. EventMonumentStatuet.getInstance().spawnStatuets();
  607. }
  608.  
  609.  
  610. if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
  611. OfflineTradeTable.restoreOfflineTraders();
  612.  
  613.  
  614.  
  615. Util.printSection("Protection");
  616. BanManager.Load();
  617.  
  618.  
  619. if (Config.CHECK_SKILLS_ON_ENTER)
  620. LOGGER.info("Check skills on enter actived.");
  621.  
  622. if (Config.CHECK_NAME_ON_LOGIN)
  623. LOGGER.info("Check bad name on enter actived.");
  624.  
  625. if (Config.PROTECTED_ENCHANT)
  626. LOGGER.info("Check OverEnchant items on enter actived.");
  627.  
  628. if (Config.BYPASS_VALIDATION)
  629. LOGGER.info("Bypass Validation actived.");
  630.  
  631. if (Config.L2WALKER_PROTEC)
  632. LOGGER.info("L2Walker protection actived.");
  633.  
  634. if (Config.BOT_PROTECTOR)
  635. LOGGER.info("Bot Protection actived.");
  636.  
  637. if (!NetcoreConfig.getInstance().DISABLE_FULL_PACKETS_FLOOD_PROTECTOR)
  638. LOGGER.info("Full packets flood protector actived.");
  639.  
  640. if (NetcoreConfig.ENABLE_CLIENT_FLOOD_PROTECTION)
  641. LOGGER.info("Client flood protection actived.");
  642.  
  643. Util.printSection("Restart Manager");
  644. if(Config.RESTART_BY_TIME_OF_DAY)
  645. Restart.getInstance().StartCalculationOfNextRestartTime();
  646. else
  647. LOGGER.info("# Auto Restart System is Disabled #");
  648.  
  649. System.gc();
  650.  
  651. TriviaEventManager.getInstance();
  652.  
  653. Util.printSection("Customs");
  654.  
  655. Util.printSection("Info");
  656. LOGGER.info("Operating System: " + Util.getOSName() + " " + Util.getOSVersion() + " " + Util.getOSArch());
  657. LOGGER.info("Available CPUs: " + Util.getAvailableProcessors());
  658. LOGGER.info("Maximum Numbers of Connected Players: " + Config.MAXIMUM_ONLINE_USERS);
  659. LOGGER.info("GameServer Started, free memory " + Memory.getFreeMemory() + " Mb of " + Memory.getTotalMemory() + " Mb");
  660. LOGGER.info("Used memory: " + Memory.getUsedMemory() + " MB");
  661.  
  662. Util.printSection("Java specific");
  663. LOGGER.info("JRE name: " + System.getProperty("java.vendor"));
  664. LOGGER.info("JRE specification version: " + System.getProperty("java.specification.version"));
  665. LOGGER.info("JRE version: " + System.getProperty("java.version"));
  666. LOGGER.info("--- Detecting Java Virtual Machine (JVM)");
  667. LOGGER.info("JVM installation directory: " + System.getProperty("java.home"));
  668. LOGGER.info("JVM Avaible Memory(RAM): " + Runtime.getRuntime().maxMemory() / 1048576 + " MB");
  669. LOGGER.info("JVM specification version: " + System.getProperty("java.vm.specification.version"));
  670. LOGGER.info("JVM specification vendor: " + System.getProperty("java.vm.specification.vendor"));
  671. LOGGER.info("JVM specification name: " + System.getProperty("java.vm.specification.name"));
  672. LOGGER.info("JVM implementation version: " + System.getProperty("java.vm.version"));
  673. LOGGER.info("JVM implementation vendor: " + System.getProperty("java.vm.vendor"));
  674. LOGGER.info("JVM implementation name: " + System.getProperty("java.vm.name"));
  675.  
  676. Util.printSection("Status");
  677. System.gc();
  678. LOGGER.info("Server Loaded in " + (System.currentTimeMillis() - serverLoadStart) / 1000 + " seconds");
  679. ServerStatus.getInstance();
  680.  
  681. // Load telnet status
  682. Util.printSection("Telnet");
  683. if (Config.IS_TELNET_ENABLED)
  684. {
  685. _statusServer = new Status(ServerType.serverMode);
  686. _statusServer.start();
  687. }
  688. else
  689. {
  690. LOGGER.info("Telnet server is disabled.");
  691. }
  692.  
  693. Util.printSection("Login");
  694. _loginThread = LoginServerThread.getInstance();
  695. _loginThread.start();
  696.  
  697. final SelectorConfig sc = new SelectorConfig();
  698. sc.setMaxReadPerPass(NetcoreConfig.getInstance().MMO_MAX_READ_PER_PASS);
  699. sc.setMaxSendPerPass(NetcoreConfig.getInstance().MMO_MAX_SEND_PER_PASS);
  700. sc.setSleepTime(NetcoreConfig.getInstance().MMO_SELECTOR_SLEEP_TIME);
  701. sc.setHelperBufferCount(NetcoreConfig.getInstance().MMO_HELPER_BUFFER_COUNT);
  702.  
  703. _gamePacketHandler = new L2GamePacketHandler();
  704.  
  705. _selectorThread = new SelectorThread<>(sc, _gamePacketHandler, _gamePacketHandler, _gamePacketHandler, new IPv4Filter());
  706.  
  707. InetAddress bindAddress = null;
  708. if (!Config.GAMESERVER_HOSTNAME.equals("*"))
  709. {
  710. try
  711. {
  712. bindAddress = InetAddress.getByName(Config.GAMESERVER_HOSTNAME);
  713. }
  714. catch (final UnknownHostException e1)
  715. {
  716. if (Config.ENABLE_ALL_EXCEPTIONS)
  717. e1.printStackTrace();
  718.  
  719. LOGGER.warn("The GameServer bind address is invalid, using all avaliable IPs. Reason: ", e1);
  720. }
  721. }
  722.  
  723. try
  724. {
  725. _selectorThread.openServerSocket(bindAddress, Config.PORT_GAME);
  726. }
  727. catch (final IOException e)
  728. {
  729. if (Config.ENABLE_ALL_EXCEPTIONS)
  730. e.printStackTrace();
  731.  
  732. LOGGER.fatal("Failed to open server socket. Reason: ", e);
  733. System.exit(1);
  734. }
  735. _selectorThread.start();
  736. }
  737.  
  738. public static SelectorThread<L2GameClient> getSelectorThread()
  739. {
  740. return _selectorThread;
  741. }
  742. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement