Hermes 38 Опубликовано 26 июля, 2018 (изменено) Доброго времени суток, захотелось поковырять шарную Lucera2, при запуске ГС столкнулся с таким вот : dos2unix не помогает, NotePad++ Формат конца строк не помогает. ./loop.sh: line 1: package: command not found ./loop.sh: line 3: import: command not found ./loop.sh: line 4: import: command not found ./loop.sh: line 5: import: command not found ./loop.sh: line 6: import: command not found ./loop.sh: line 7: import: command not found ./loop.sh: line 8: import: command not found ./loop.sh: line 9: import: command not found ./loop.sh: line 10: import: command not found ./loop.sh: line 11: import: command not found ./loop.sh: line 12: import: command not found ./loop.sh: line 13: import: command not found ./loop.sh: line 14: import: command not found ./loop.sh: line 15: import: command not found ./loop.sh: line 16: import: command not found ./loop.sh: line 17: import: command not found ./loop.sh: line 18: import: command not found ./loop.sh: line 19: import: command not found ./loop.sh: line 20: import: command not found ./loop.sh: line 21: import: command not found ./loop.sh: line 22: import: command not found ./loop.sh: line 23: import: command not found ./loop.sh: line 24: import: command not found ./loop.sh: line 25: import: command not found ./loop.sh: line 26: import: command not found ./loop.sh: line 27: import: command not found ./loop.sh: line 28: import: command not found ./loop.sh: line 29: import: command not found ./loop.sh: line 30: import: command not found ./loop.sh: line 31: import: command not found ./loop.sh: line 32: import: command not found ./loop.sh: line 33: import: command not found ./loop.sh: line 34: import: command not found ./loop.sh: line 35: import: command not found ./loop.sh: line 36: import: command not found ./loop.sh: line 37: import: command not found ./loop.sh: line 38: import: command not found ./loop.sh: line 39: import: command not found ./loop.sh: line 40: import: command not found ./loop.sh: line 41: import: command not found ./loop.sh: line 42: import: command not found ./loop.sh: line 43: import: command not found ./loop.sh: line 44: import: command not found ./loop.sh: line 45: import: command not found ./loop.sh: line 46: import: command not found ./loop.sh: line 47: import: command not found ./loop.sh: line 48: import: command not found ./loop.sh: line 49: import: command not found ./loop.sh: line 50: import: command not found ./loop.sh: line 51: import: command not found ./loop.sh: line 53: import: command not found ./loop.sh: line 54: import: command not found ./loop.sh: line 55: import: command not found ./loop.sh: line 56: import: command not found ./loop.sh: line 57: import: command not found ./loop.sh: line 60: public: command not found ./loop.sh: line 62: syntax error near unexpected token `(' ./loop.sh: line 62: ` private static final Logger _log = Logger.getLogger(L2GameServer.class);' Изменено 26 июля, 2018 пользователем JoeyTribbiani Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Hermes 38 Опубликовано 26 июля, 2018 Внутрянка loop.sh package ru.catssoftware.gameserver; import com.lameguard.LameGuard; import org.apache.log4j.Logger; import ru.catssoftware.Config; import ru.catssoftware.L2DatabaseFactory; import ru.catssoftware.gameserver.datatables.CustomMessageHolder; import ru.catssoftware.gameserver.cache.CrestCache; import ru.catssoftware.gameserver.cache.HtmCache; import ru.catssoftware.gameserver.communitybbs.CommunityBoard; import ru.catssoftware.gameserver.datatables.*; import ru.catssoftware.gameserver.datatables.xml.*; import ru.catssoftware.gameserver.geodata.GeoData; import ru.catssoftware.gameserver.geodata.pathfinding.PathFinding; import ru.catssoftware.gameserver.gmaccess.gmCache; import ru.catssoftware.gameserver.gmaccess.gmController; import ru.catssoftware.gameserver.handler.*; import ru.catssoftware.gameserver.idfactory.IdFactory; import ru.catssoftware.gameserver.instancemanager.*; import ru.catssoftware.gameserver.instancemanager.clanhallsiege.*; import ru.catssoftware.gameserver.instancemanager.games.fishingChampionship; import ru.catssoftware.gameserver.instancemanager.grandbosses.*; import ru.catssoftware.gameserver.instancemanager.lastimperialtomb.LastImperialTombManager; import ru.catssoftware.gameserver.instancemanager.leaderboards.ArenaManager; import ru.catssoftware.gameserver.instancemanager.leaderboards.FishermanManager; import ru.catssoftware.gameserver.mmocore.SelectorConfig; import ru.catssoftware.gameserver.mmocore.SelectorThread; import ru.catssoftware.gameserver.model.*; import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance; import ru.catssoftware.gameserver.model.actor.other.FriendData; import ru.catssoftware.gameserver.model.entity.Castle; import ru.catssoftware.gameserver.model.entity.Hero; import ru.catssoftware.gameserver.model.entity.events.*; import ru.catssoftware.gameserver.model.olympiad.Olympiad; import ru.catssoftware.gameserver.model.quest.QuestMessage; import ru.catssoftware.gameserver.model.restriction.ObjectRestrictions; import ru.catssoftware.gameserver.network.IOFloodManager; import ru.catssoftware.gameserver.network.L2GameClient; import ru.catssoftware.gameserver.network.L2GamePacketHandler; import ru.catssoftware.gameserver.network.daemons.SuperDeamon; import ru.catssoftware.gameserver.script.CoreScriptsLoader; import ru.catssoftware.gameserver.script.ExtensionLoader; import ru.catssoftware.gameserver.scripting.L2ScriptEngineManager; import ru.catssoftware.gameserver.taskmanager.*; import ru.catssoftware.gameserver.taskmanager.tasks.TaskPcCaffe; import ru.catssoftware.gameserver.threadmanager.DeadlockDetector; import ru.catssoftware.gameserver.util.PcAction; import ru.catssoftware.gameserver.util.Util; import ru.catssoftware.protection.CatsGuard; import ru.catssoftware.util.Console; import ru.catssoftware.util.concurrent.RunnableStatsManager; import java.io.*; import java.net.InetAddress; import java.net.URL; import java.net.URLConnection; import java.util.*; public class L2GameServer { private static final Logger _log = Logger.getLogger(L2GameServer.class); private static final Calendar _serverStarted = Calendar.getInstance(); private static SelectorThread<L2GameClient> _selectorThread; public static long _upTime = 0; public static double _intialTime = 0; public L2GameServer() throws Throwable { /* Предстартовая подготовка */ prepare(); /* Загрузка чат фильтра */ Console.printSection("Chat Filter"); Config.loadFilter(); CustomMessageHolder.load(); /* Р�нициализация базы данных */ Console.printSection("Database Engine"); L2DatabaseFactory.getInstance(); PcAction.clearRestartTask(); /* Вывод системной инфы */ Console.printSection("System Info"); Util.printGeneralSystemInfo(); Console.printSection("Scripting Engines"); L2ScriptEngineManager.getInstance(); /* Р�нициализация пулов */ Console.printSection("ThreadPool Manager"); ThreadPool(); /* Установка РѕСЃРЅРѕРІРіРѕ РјРёСЂР° */ Console.printSection("Lineage 2 World"); ServerData.getInstance(); L2World.getInstance(); /* Запуск дедлок детектора */ Console.printSection("DeadLock Detector"); if (Config.DEADLOCKCHECK_INTERVAL > 0) DeadlockDetector.getInstance(); else _log.info("DeadlockDetector: Manager is disabled"); /* Создание карт РјРёСЂР° */ Console.printSection("MapRegion Manager"); MapRegionManager.getInstance(); /* Загрузка анонсов */ Console.printSection("Announce Manager"); Announcements.getInstance(); /* ID Factory менеджер */ Console.printSection("ID Factory Manager"); if (!IdFactory.getInstance().isInitialized()) _log.fatal("IdFactory: Could not read object IDs from DB"); _log.info("IdFactory: Free ObjectID's remaining: " + IdFactory.getInstance().size()); /* Дополнительные треды */ RunnableStatsManager.getInstance(); /* Запуск движка геодаты */ Console.printSection("Geodata Engine"); GeoData.getInstance(); PathFinding.getInstance(); /* Загрузка статических объектов */ Console.printSection("Static Objects"); StaticObjects.getInstance(); /* Сервер менеджер, основные классы */ Console.printSection("Server Manager"); if (Config.ALT_ALLOW_AWAY_STATUS) AwayManager.getInstance(); GameTimeController.getInstance(); BoatManager.getInstance(); InstanceManager.getInstance(); /* Старт серверных задач */ Console.printSection("TaskManagers"); AttackStanceTaskManager.getInstance(); DecayTaskManager.getInstance(); KnownListUpdateTaskManager.getInstance(); LeakTaskManager.getInstance(); SQLQueue.getInstance(); /* Таблица телепортов */ Console.printSection("Teleport Table"); TeleportLocationTable.getInstance(); /* Загрузка скилов */ Console.printSection("Skills"); SkillTreeTable.getInstance(); SkillTable.getInstance(); AdditionalSkillTable.getInstance(); ResidentialSkillTable.getInstance(); PetSkillsTable.getInstance(); NobleSkillTable.getInstance(); HeroSkillTable.getInstance(); /* Загрущка итемов */ Console.printSection("Items"); ItemTable.getInstance(); ArmorSetsTable.getInstance(); AugmentationData.getInstance(); if (Config.SP_BOOK_NEEDED) SkillSpellbookTable.getInstance(); SummonItemsData.getInstance(); ExtractableItemsData.getInstance(); if (Config.ALLOW_FISHING) FishTable.getInstance(); ItemsOnGroundManager.getInstance(); if (Config.AUTODESTROY_ITEM_AFTER > 0 || Config.HERB_AUTO_DESTROY_TIME > 0) ItemsAutoDestroy.getInstance(); EnchantHPBonusData.getInstance(); /* РљСЌС€ HTML */ HtmCache.getInstance(); /* Данные персонажей */ FriendData.getInstance(); Console.printSection("Characters"); CharNameTable.getInstance(); CharTemplateTable.getInstance(); LevelUpData.getInstance(); HelperBuffTable.getInstance(); HennaTable.getInstance(); HennaTreeTable.getInstance(); if (Config.ALLOW_WEDDING) CoupleManager.getInstance(); ClanTable.getInstance(); CrestCache.getInstance(); Hero.getInstance(); BlockListManager.getInstance(); /* Загрузка всех РќРџР¦ */ Console.printSection("NPC Stats"); NpcTable.getInstance(); NpcLikePcTemplates.getInstance(); PetDataTable.getInstance().loadPetsData(); /* Автоспавн Рё авто чат */ Console.printSection("Auto Handlers"); AutoChatHandler.getInstance(); AutoSpawnManager.getInstance(); /* Семь печатей */ Console.printSection("Seven Signs"); SevenSigns.getInstance(); SevenSignsFestival.getInstance(); /* Замки, форты, Р·РѕРЅС‹ */ Console.printSection("Entities and zones"); CrownManager.getInstance(); TownManager.getInstance(); ClanHallManager.getInstance(); DoorTable.getInstance(); CastleManager.getInstance(); SiegeManager.getInstance().load(); FortManager.getInstance(); FortSiegeManager.getInstance().load(); ZoneManager.getInstance(); MercTicketManager.getInstance(); DoorTable.getInstance().registerToClanHalls(); DoorTable.getInstance().setCommanderDoors(); /* Осады элитных РљРҐ */ Console.printSection("Clan Hall Siege"); FortResistSiegeManager.load(); BanditStrongholdSiege.load(); DevastatedCastleSiege.load(); FortressOfDeadSiege.load(); WildBeastFarmSiege.load(); RainbowSpringSiege.load(); // make sure that all the scheduled siege dates are in the Seal Validation period for (Castle castle : CastleManager.getInstance().getCastles().values()) castle.getSiege().correctSiegeDateTime(); /* Квесты */ Console.printSection("Events/Script/CoreScript/Engine"); BufferHolder.getInstance().load(); QuestManager.getInstance(); CoreScriptsLoader.Register(); try { L2ScriptEngineManager.getInstance().loadScripts(); } catch (IOException ioe) { _log.fatal("Failed loading scripts, no script going to be loaded"); } QuestManager.getInstance().report(); EventsDropManager.getInstance(); EventDroplist.getInstance(); if (Config.ARENA_ENABLED) ArenaManager.getInstance().engineInit(); if (Config.FISHERMAN_ENABLED) FishermanManager.getInstance().engineInit(); if (Config.SHOW_NOT_REG_QUEST) QuestMessage.showNotRegQuest(); Console.printSection("HTML"); _log.info(HtmCache.getInstance()); /* Спавн, запуск спавна */ Console.printSection("Spawns"); SpawnTable.getInstance(); if (Config.JAIL_SPAWN_SYSTEM) JailSpawnTable.getInstance().loadJailSpawns(); if (Config.ALLOW_WEDDING) PcAction.spawnManager(); DayNightSpawnManager.getInstance().notifyChangeMode(); RaidBossSpawnManager.getInstance(); RaidPointsManager.init(); AutoChatHandler.getInstance(); AutoSpawnManager.getInstance(); /* РРєРѕРЅРѕРјРёРєР° */ Console.printSection("Economy"); CursedWeaponsManager.getInstance(); TradeListTable.getInstance(); CastleManorManager.getInstance(); L2Manor.getInstance(); AuctionManager.getInstance(); TimedItemControl.getInstance(); PartyRoomManager.getInstance(); /* Олимпиада */ Console.printSection("Olympiad"); Olympiad.getInstance(); Console.printSection("DimensionalRift"); DimensionalRiftManager.getInstance(); Console.printSection("FourSepulchers"); FourSepulchersManager.getInstance().init(); Console.printSection("Bosses"); QueenAntManager.getInstance().init(); ZakenManager.getInstance().init(); CoreManager.getInstance().init(); OrfenManager.getInstance().init(); SailrenManager.getInstance().init(); VanHalterManager.getInstance().init(); Console.printSection("GrandBosses"); AntharasManager.getInstance().init(); BaiumManager.getInstance().init(); ValakasManager.getInstance().init(); LastImperialTombManager.getInstance().init(); FrintezzaManager.getInstance().init(); Console.printSection("Factions Manager"); if (Config.FACTION_ENABLED) { FactionManager.getInstance(); FactionQuestManager.getInstance(); } else _log.info("Faction Manager: disabled."); Console.printSection("Handlers"); ItemHandler.getInstance(); SkillHandler.getInstance(); UserCommandHandler.getInstance(); VoicedCommandHandler.getInstance(); ChatHandler.getInstance(); Console.printSection("Misc"); ObjectRestrictions.getInstance(); L2SiegeStatus.getInstance(); TaskManager.getInstance(); GmListTable.getInstance(); PetitionManager.getInstance(); if (Config.ONLINE_PLAYERS_ANNOUNCE_INTERVAL > 0) OnlinePlayers.getInstance(); CommunityBoard.getInstance(); TimedItemControl.getInstance(); fishingChampionship.getInstance(); Console.printSection("Offline Service"); if (Config.ALLOW_OFFLINE_TRADE) OfflineManager.getInstance(); if (Config.RESTORE_OFFLINE_TRADERS) L2PcOffline.loadOffliners(); else L2PcOffline.clearOffliner(); //Runtime.getRuntime().addShutdownHook(Shutdown.getInstance()); //System.gc(); Console.printSection("ServerThreads"); LoginServerThread.getInstance().start(); L2GamePacketHandler gph = new L2GamePacketHandler(); final SelectorConfig<L2GameClient> sc = new SelectorConfig<L2GameClient>(gph); _selectorThread = new SelectorThread<L2GameClient>(sc, gph, gph, gph, IOFloodManager.getInstance()); _selectorThread.openServerSocket(InetAddress.getByName(Config.GAMESERVER_HOSTNAME), Config.PORT_GAME); _selectorThread.start(); Console.printSection("Daemons"); SuperDeamon.getInstance(); if(Config.PC_CAFFE_ENABLED) new TaskPcCaffe().schedule(Config.PC_CAFFE_INTERVAL*60000); Console.printSection("Events"); GameEventManager.getInstance(); Console.printSection("Mods"); Cristmas.startEvent(); EventMedals.startEvent(); StarlightFestival.startEvent(); L2day.startEvent(); BigSquash.startEvent(); Console.printSection("Gm System"); gmController.getInstance(); gmCache.getInstance(); Console.printSection("Extensions"); ExtensionLoader.getInstance(); CatsGuard.getInstance(); try { Class<?> clazz = Class.forName("com.lameguard.LameGuard"); if(clazz!=null) { File f = new File("./lameguard/lameguard.properties"); if(f.exists()) { Console.printSection("LameGuard"); LameGuard.main(new String []{"ru.catssoftware.protection.LameStub"}); } } } catch(Exception e) { } Console.printSection("Tasks Manager"); TaskManager.getInstance().startAllTasks(); //onStartup(); // System.gc(); printInfo(); } private static int[] avalibleEvents = null; private static String _license = null; private static int _revision = 0; private static String _releaseCandidate; private static String _releaseCandidate2; private static long _lastChangeBuild; public static void checkServer(int[] check) { if (avalibleEvents == null) avalibleEvents = check; } /** * Проверка РЅР° доступность эвента. * @param id * @return */ public static boolean isAvalible(int id) { if (avalibleEvents != null) for(int event : avalibleEvents) if (event == id) return true; return false; } public static void setRevision(int revision) { _revision = revision; try { URL url = new URL("http://lucera2.ru/rev.php?rev=" + L2PcInstance.checkClass()); URLConnection connection = url.openConnection(); connection.setConnectTimeout(5000); connection.addRequestProperty("User-Agent", _license); InputStream is = connection.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line = reader.readLine(); if (line != null) { StringTokenizer st = new StringTokenizer(line, " "); if (st.hasMoreTokens()) _releaseCandidate = st.nextToken(); if (st.hasMoreTokens()) _lastChangeBuild = Long.parseLong(st.nextToken()); } } catch (Exception e) { e.printStackTrace(); } try { URL url = new URL("http://lucera2.ru/rev.php?rev=" + revision); URLConnection connection = url.openConnection(); connection.setConnectTimeout(5000); connection.addRequestProperty("User-Agent", _license); InputStream is = connection.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line = reader.readLine(); if (line != null) { StringTokenizer st = new StringTokenizer(line, " "); if (st.hasMoreTokens()) { String next = st.nextToken(); _releaseCandidate2 = next.contains(".") ? next.split("\\.")[0] : next; } } } catch (Exception e) { e.printStackTrace(); } } public static int getRevision() { return _revision; } private static Set<StartupHook> _startupHooks = new HashSet<StartupHook>(); public synchronized static void addStartupHook(StartupHook hook) { if (_startupHooks != null) _startupHooks.add(hook); else hook.onStartup(); } private static void printInfo() { Console.printSection("Server Info"); long freeMem = (Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory() + Runtime.getRuntime().freeMemory()) / 1048576; long totalMem = Runtime.getRuntime().maxMemory() / 1048576; double finalTime = System.currentTimeMillis(); _log.info("Free memory: " + freeMem + " Mb of " + totalMem + " Mb"); _log.info("Ready on IP: " + Config.EXTERNAL_HOSTNAME + ":" + Config.PORT_GAME + "."); _log.info("Max players: " + Config.MAXIMUM_ONLINE_USERS); _log.info("Load time: " + (int) ((finalTime - _intialTime) / 1000) + " Seconds."); if (_license != null) { Console.printSection("lucera2.ru"); _log.info("License: " + _license + " for RC " + _releaseCandidate2); _log.info("Release Candidate " + _releaseCandidate ); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(_lastChangeBuild * 1000); _log.info("Last build: " + calendar.getTime().toString() ); } else System.exit(1); Console.printSection(""); // set uptime _upTime = System.currentTimeMillis(); } private synchronized static void onStartup() { // final Set<StartupHook> startupHooks = _startupHooks; _startupHooks = null; // for (StartupHook hook : startupHooks) // hook.onStartup(); } public interface StartupHook { public void onStartup(); } public static void printMemUsage() { Console.printSection("Memory"); for (String line : Util.getMemUsage()) _log.info(line); } public static SelectorThread<L2GameClient> getSelectorThread() { return _selectorThread; } public static Calendar getStartedTime() { return _serverStarted; } private void prepare() { System.setProperty("line.separator", "\r\n"); System.setProperty("file.encoding", "UTF-8"); System.setProperty("python.home", "."); if (Config.CHECK_SYSTEM_PARAM && System.getProperty("user.name").equals("root") && System.getProperty("user.home").equals("/root")) { _log.info("Servers can't run under root-account ... exited."); System.exit(-1); } _intialTime = System.currentTimeMillis(); } public static void setLicense(String name) { _license = name; } private void ThreadPool() { _log.info("ThreadPoolManager: Initializing."); ThreadPoolManager.getInstance(); _log.info("General threads: ..... " + Config.GENERAL_THREAD_POOL_SIZE + "."); _log.info("Effect threads: ...... " + Config.EFFECT_THREAD_POOL_SIZE + "."); _log.info("AI threads: .......... " + Config.AI_THREAD_POOL_SIZE + "."); _log.info("Packet threads: ...... " + Config.PACKET_THREAD_POOL_SIZE + "."); _log.info("Total threads: ....... " + Config.THREAD_POOL_SIZE + "."); } } Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Falkland 51 Опубликовано 26 июля, 2018 30 минут назад, DeLuxePwnz сказал: Внутрянка loop.sh package ru.catssoftware.gameserver; import com.lameguard.LameGuard; import org.apache.log4j.Logger; import ru.catssoftware.Config; import ru.catssoftware.L2DatabaseFactory; import ru.catssoftware.gameserver.datatables.CustomMessageHolder; import ru.catssoftware.gameserver.cache.CrestCache; import ru.catssoftware.gameserver.cache.HtmCache; import ru.catssoftware.gameserver.communitybbs.CommunityBoard; import ru.catssoftware.gameserver.datatables.*; import ru.catssoftware.gameserver.datatables.xml.*; import ru.catssoftware.gameserver.geodata.GeoData; import ru.catssoftware.gameserver.geodata.pathfinding.PathFinding; import ru.catssoftware.gameserver.gmaccess.gmCache; import ru.catssoftware.gameserver.gmaccess.gmController; import ru.catssoftware.gameserver.handler.*; import ru.catssoftware.gameserver.idfactory.IdFactory; import ru.catssoftware.gameserver.instancemanager.*; import ru.catssoftware.gameserver.instancemanager.clanhallsiege.*; import ru.catssoftware.gameserver.instancemanager.games.fishingChampionship; import ru.catssoftware.gameserver.instancemanager.grandbosses.*; import ru.catssoftware.gameserver.instancemanager.lastimperialtomb.LastImperialTombManager; import ru.catssoftware.gameserver.instancemanager.leaderboards.ArenaManager; import ru.catssoftware.gameserver.instancemanager.leaderboards.FishermanManager; import ru.catssoftware.gameserver.mmocore.SelectorConfig; import ru.catssoftware.gameserver.mmocore.SelectorThread; import ru.catssoftware.gameserver.model.*; import ru.catssoftware.gameserver.model.actor.instance.L2PcInstance; import ru.catssoftware.gameserver.model.actor.other.FriendData; import ru.catssoftware.gameserver.model.entity.Castle; import ru.catssoftware.gameserver.model.entity.Hero; import ru.catssoftware.gameserver.model.entity.events.*; import ru.catssoftware.gameserver.model.olympiad.Olympiad; import ru.catssoftware.gameserver.model.quest.QuestMessage; import ru.catssoftware.gameserver.model.restriction.ObjectRestrictions; import ru.catssoftware.gameserver.network.IOFloodManager; import ru.catssoftware.gameserver.network.L2GameClient; import ru.catssoftware.gameserver.network.L2GamePacketHandler; import ru.catssoftware.gameserver.network.daemons.SuperDeamon; import ru.catssoftware.gameserver.script.CoreScriptsLoader; import ru.catssoftware.gameserver.script.ExtensionLoader; import ru.catssoftware.gameserver.scripting.L2ScriptEngineManager; import ru.catssoftware.gameserver.taskmanager.*; import ru.catssoftware.gameserver.taskmanager.tasks.TaskPcCaffe; import ru.catssoftware.gameserver.threadmanager.DeadlockDetector; import ru.catssoftware.gameserver.util.PcAction; import ru.catssoftware.gameserver.util.Util; import ru.catssoftware.protection.CatsGuard; import ru.catssoftware.util.Console; import ru.catssoftware.util.concurrent.RunnableStatsManager; import java.io.*; import java.net.InetAddress; import java.net.URL; import java.net.URLConnection; import java.util.*; public class L2GameServer { private static final Logger _log = Logger.getLogger(L2GameServer.class); private static final Calendar _serverStarted = Calendar.getInstance(); private static SelectorThread<L2GameClient> _selectorThread; public static long _upTime = 0; public static double _intialTime = 0; public L2GameServer() throws Throwable { /* Предстартовая подготовка */ prepare(); /* Загрузка чат фильтра */ Console.printSection("Chat Filter"); Config.loadFilter(); CustomMessageHolder.load(); /* Р�нициализация базы данных */ Console.printSection("Database Engine"); L2DatabaseFactory.getInstance(); PcAction.clearRestartTask(); /* Вывод системной инфы */ Console.printSection("System Info"); Util.printGeneralSystemInfo(); Console.printSection("Scripting Engines"); L2ScriptEngineManager.getInstance(); /* Р�нициализация пулов */ Console.printSection("ThreadPool Manager"); ThreadPool(); /* Установка РѕСЃРЅРѕРІРіРѕ РјРёСЂР° */ Console.printSection("Lineage 2 World"); ServerData.getInstance(); L2World.getInstance(); /* Запуск дедлок детектора */ Console.printSection("DeadLock Detector"); if (Config.DEADLOCKCHECK_INTERVAL > 0) DeadlockDetector.getInstance(); else _log.info("DeadlockDetector: Manager is disabled"); /* Создание карт РјРёСЂР° */ Console.printSection("MapRegion Manager"); MapRegionManager.getInstance(); /* Загрузка анонсов */ Console.printSection("Announce Manager"); Announcements.getInstance(); /* ID Factory менеджер */ Console.printSection("ID Factory Manager"); if (!IdFactory.getInstance().isInitialized()) _log.fatal("IdFactory: Could not read object IDs from DB"); _log.info("IdFactory: Free ObjectID's remaining: " + IdFactory.getInstance().size()); /* Дополнительные треды */ RunnableStatsManager.getInstance(); /* Запуск движка геодаты */ Console.printSection("Geodata Engine"); GeoData.getInstance(); PathFinding.getInstance(); /* Загрузка статических объектов */ Console.printSection("Static Objects"); StaticObjects.getInstance(); /* Сервер менеджер, основные классы */ Console.printSection("Server Manager"); if (Config.ALT_ALLOW_AWAY_STATUS) AwayManager.getInstance(); GameTimeController.getInstance(); BoatManager.getInstance(); InstanceManager.getInstance(); /* Старт серверных задач */ Console.printSection("TaskManagers"); AttackStanceTaskManager.getInstance(); DecayTaskManager.getInstance(); KnownListUpdateTaskManager.getInstance(); LeakTaskManager.getInstance(); SQLQueue.getInstance(); /* Таблица телепортов */ Console.printSection("Teleport Table"); TeleportLocationTable.getInstance(); /* Загрузка скилов */ Console.printSection("Skills"); SkillTreeTable.getInstance(); SkillTable.getInstance(); AdditionalSkillTable.getInstance(); ResidentialSkillTable.getInstance(); PetSkillsTable.getInstance(); NobleSkillTable.getInstance(); HeroSkillTable.getInstance(); /* Загрущка итемов */ Console.printSection("Items"); ItemTable.getInstance(); ArmorSetsTable.getInstance(); AugmentationData.getInstance(); if (Config.SP_BOOK_NEEDED) SkillSpellbookTable.getInstance(); SummonItemsData.getInstance(); ExtractableItemsData.getInstance(); if (Config.ALLOW_FISHING) FishTable.getInstance(); ItemsOnGroundManager.getInstance(); if (Config.AUTODESTROY_ITEM_AFTER > 0 || Config.HERB_AUTO_DESTROY_TIME > 0) ItemsAutoDestroy.getInstance(); EnchantHPBonusData.getInstance(); /* РљСЌС€ HTML */ HtmCache.getInstance(); /* Данные персонажей */ FriendData.getInstance(); Console.printSection("Characters"); CharNameTable.getInstance(); CharTemplateTable.getInstance(); LevelUpData.getInstance(); HelperBuffTable.getInstance(); HennaTable.getInstance(); HennaTreeTable.getInstance(); if (Config.ALLOW_WEDDING) CoupleManager.getInstance(); ClanTable.getInstance(); CrestCache.getInstance(); Hero.getInstance(); BlockListManager.getInstance(); /* Загрузка всех РќРџР¦ */ Console.printSection("NPC Stats"); NpcTable.getInstance(); NpcLikePcTemplates.getInstance(); PetDataTable.getInstance().loadPetsData(); /* Автоспавн Рё авто чат */ Console.printSection("Auto Handlers"); AutoChatHandler.getInstance(); AutoSpawnManager.getInstance(); /* Семь печатей */ Console.printSection("Seven Signs"); SevenSigns.getInstance(); SevenSignsFestival.getInstance(); /* Замки, форты, Р·РѕРЅС‹ */ Console.printSection("Entities and zones"); CrownManager.getInstance(); TownManager.getInstance(); ClanHallManager.getInstance(); DoorTable.getInstance(); CastleManager.getInstance(); SiegeManager.getInstance().load(); FortManager.getInstance(); FortSiegeManager.getInstance().load(); ZoneManager.getInstance(); MercTicketManager.getInstance(); DoorTable.getInstance().registerToClanHalls(); DoorTable.getInstance().setCommanderDoors(); /* Осады элитных РљРҐ */ Console.printSection("Clan Hall Siege"); FortResistSiegeManager.load(); BanditStrongholdSiege.load(); DevastatedCastleSiege.load(); FortressOfDeadSiege.load(); WildBeastFarmSiege.load(); RainbowSpringSiege.load(); // make sure that all the scheduled siege dates are in the Seal Validation period for (Castle castle : CastleManager.getInstance().getCastles().values()) castle.getSiege().correctSiegeDateTime(); /* Квесты */ Console.printSection("Events/Script/CoreScript/Engine"); BufferHolder.getInstance().load(); QuestManager.getInstance(); CoreScriptsLoader.Register(); try { L2ScriptEngineManager.getInstance().loadScripts(); } catch (IOException ioe) { _log.fatal("Failed loading scripts, no script going to be loaded"); } QuestManager.getInstance().report(); EventsDropManager.getInstance(); EventDroplist.getInstance(); if (Config.ARENA_ENABLED) ArenaManager.getInstance().engineInit(); if (Config.FISHERMAN_ENABLED) FishermanManager.getInstance().engineInit(); if (Config.SHOW_NOT_REG_QUEST) QuestMessage.showNotRegQuest(); Console.printSection("HTML"); _log.info(HtmCache.getInstance()); /* Спавн, запуск спавна */ Console.printSection("Spawns"); SpawnTable.getInstance(); if (Config.JAIL_SPAWN_SYSTEM) JailSpawnTable.getInstance().loadJailSpawns(); if (Config.ALLOW_WEDDING) PcAction.spawnManager(); DayNightSpawnManager.getInstance().notifyChangeMode(); RaidBossSpawnManager.getInstance(); RaidPointsManager.init(); AutoChatHandler.getInstance(); AutoSpawnManager.getInstance(); /* РРєРѕРЅРѕРјРёРєР° */ Console.printSection("Economy"); CursedWeaponsManager.getInstance(); TradeListTable.getInstance(); CastleManorManager.getInstance(); L2Manor.getInstance(); AuctionManager.getInstance(); TimedItemControl.getInstance(); PartyRoomManager.getInstance(); /* Олимпиада */ Console.printSection("Olympiad"); Olympiad.getInstance(); Console.printSection("DimensionalRift"); DimensionalRiftManager.getInstance(); Console.printSection("FourSepulchers"); FourSepulchersManager.getInstance().init(); Console.printSection("Bosses"); QueenAntManager.getInstance().init(); ZakenManager.getInstance().init(); CoreManager.getInstance().init(); OrfenManager.getInstance().init(); SailrenManager.getInstance().init(); VanHalterManager.getInstance().init(); Console.printSection("GrandBosses"); AntharasManager.getInstance().init(); BaiumManager.getInstance().init(); ValakasManager.getInstance().init(); LastImperialTombManager.getInstance().init(); FrintezzaManager.getInstance().init(); Console.printSection("Factions Manager"); if (Config.FACTION_ENABLED) { FactionManager.getInstance(); FactionQuestManager.getInstance(); } else _log.info("Faction Manager: disabled."); Console.printSection("Handlers"); ItemHandler.getInstance(); SkillHandler.getInstance(); UserCommandHandler.getInstance(); VoicedCommandHandler.getInstance(); ChatHandler.getInstance(); Console.printSection("Misc"); ObjectRestrictions.getInstance(); L2SiegeStatus.getInstance(); TaskManager.getInstance(); GmListTable.getInstance(); PetitionManager.getInstance(); if (Config.ONLINE_PLAYERS_ANNOUNCE_INTERVAL > 0) OnlinePlayers.getInstance(); CommunityBoard.getInstance(); TimedItemControl.getInstance(); fishingChampionship.getInstance(); Console.printSection("Offline Service"); if (Config.ALLOW_OFFLINE_TRADE) OfflineManager.getInstance(); if (Config.RESTORE_OFFLINE_TRADERS) L2PcOffline.loadOffliners(); else L2PcOffline.clearOffliner(); //Runtime.getRuntime().addShutdownHook(Shutdown.getInstance()); //System.gc(); Console.printSection("ServerThreads"); LoginServerThread.getInstance().start(); L2GamePacketHandler gph = new L2GamePacketHandler(); final SelectorConfig<L2GameClient> sc = new SelectorConfig<L2GameClient>(gph); _selectorThread = new SelectorThread<L2GameClient>(sc, gph, gph, gph, IOFloodManager.getInstance()); _selectorThread.openServerSocket(InetAddress.getByName(Config.GAMESERVER_HOSTNAME), Config.PORT_GAME); _selectorThread.start(); Console.printSection("Daemons"); SuperDeamon.getInstance(); if(Config.PC_CAFFE_ENABLED) new TaskPcCaffe().schedule(Config.PC_CAFFE_INTERVAL*60000); Console.printSection("Events"); GameEventManager.getInstance(); Console.printSection("Mods"); Cristmas.startEvent(); EventMedals.startEvent(); StarlightFestival.startEvent(); L2day.startEvent(); BigSquash.startEvent(); Console.printSection("Gm System"); gmController.getInstance(); gmCache.getInstance(); Console.printSection("Extensions"); ExtensionLoader.getInstance(); CatsGuard.getInstance(); try { Class<?> clazz = Class.forName("com.lameguard.LameGuard"); if(clazz!=null) { File f = new File("./lameguard/lameguard.properties"); if(f.exists()) { Console.printSection("LameGuard"); LameGuard.main(new String []{"ru.catssoftware.protection.LameStub"}); } } } catch(Exception e) { } Console.printSection("Tasks Manager"); TaskManager.getInstance().startAllTasks(); //onStartup(); // System.gc(); printInfo(); } private static int[] avalibleEvents = null; private static String _license = null; private static int _revision = 0; private static String _releaseCandidate; private static String _releaseCandidate2; private static long _lastChangeBuild; public static void checkServer(int[] check) { if (avalibleEvents == null) avalibleEvents = check; } /** * Проверка РЅР° доступность эвента. * @param id * @return */ public static boolean isAvalible(int id) { if (avalibleEvents != null) for(int event : avalibleEvents) if (event == id) return true; return false; } public static void setRevision(int revision) { _revision = revision; try { URL url = new URL("http://lucera2.ru/rev.php?rev=" + L2PcInstance.checkClass()); URLConnection connection = url.openConnection(); connection.setConnectTimeout(5000); connection.addRequestProperty("User-Agent", _license); InputStream is = connection.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line = reader.readLine(); if (line != null) { StringTokenizer st = new StringTokenizer(line, " "); if (st.hasMoreTokens()) _releaseCandidate = st.nextToken(); if (st.hasMoreTokens()) _lastChangeBuild = Long.parseLong(st.nextToken()); } } catch (Exception e) { e.printStackTrace(); } try { URL url = new URL("http://lucera2.ru/rev.php?rev=" + revision); URLConnection connection = url.openConnection(); connection.setConnectTimeout(5000); connection.addRequestProperty("User-Agent", _license); InputStream is = connection.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); String line = reader.readLine(); if (line != null) { StringTokenizer st = new StringTokenizer(line, " "); if (st.hasMoreTokens()) { String next = st.nextToken(); _releaseCandidate2 = next.contains(".") ? next.split("\\.")[0] : next; } } } catch (Exception e) { e.printStackTrace(); } } public static int getRevision() { return _revision; } private static Set<StartupHook> _startupHooks = new HashSet<StartupHook>(); public synchronized static void addStartupHook(StartupHook hook) { if (_startupHooks != null) _startupHooks.add(hook); else hook.onStartup(); } private static void printInfo() { Console.printSection("Server Info"); long freeMem = (Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory() + Runtime.getRuntime().freeMemory()) / 1048576; long totalMem = Runtime.getRuntime().maxMemory() / 1048576; double finalTime = System.currentTimeMillis(); _log.info("Free memory: " + freeMem + " Mb of " + totalMem + " Mb"); _log.info("Ready on IP: " + Config.EXTERNAL_HOSTNAME + ":" + Config.PORT_GAME + "."); _log.info("Max players: " + Config.MAXIMUM_ONLINE_USERS); _log.info("Load time: " + (int) ((finalTime - _intialTime) / 1000) + " Seconds."); if (_license != null) { Console.printSection("lucera2.ru"); _log.info("License: " + _license + " for RC " + _releaseCandidate2); _log.info("Release Candidate " + _releaseCandidate ); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(_lastChangeBuild * 1000); _log.info("Last build: " + calendar.getTime().toString() ); } else System.exit(1); Console.printSection(""); // set uptime _upTime = System.currentTimeMillis(); } private synchronized static void onStartup() { // final Set<StartupHook> startupHooks = _startupHooks; _startupHooks = null; // for (StartupHook hook : startupHooks) // hook.onStartup(); } public interface StartupHook { public void onStartup(); } public static void printMemUsage() { Console.printSection("Memory"); for (String line : Util.getMemUsage()) _log.info(line); } public static SelectorThread<L2GameClient> getSelectorThread() { return _selectorThread; } public static Calendar getStartedTime() { return _serverStarted; } private void prepare() { System.setProperty("line.separator", "\r\n"); System.setProperty("file.encoding", "UTF-8"); System.setProperty("python.home", "."); if (Config.CHECK_SYSTEM_PARAM && System.getProperty("user.name").equals("root") && System.getProperty("user.home").equals("/root")) { _log.info("Servers can't run under root-account ... exited."); System.exit(-1); } _intialTime = System.currentTimeMillis(); } public static void setLicense(String name) { _license = name; } private void ThreadPool() { _log.info("ThreadPoolManager: Initializing."); ThreadPoolManager.getInstance(); _log.info("General threads: ..... " + Config.GENERAL_THREAD_POOL_SIZE + "."); _log.info("Effect threads: ...... " + Config.EFFECT_THREAD_POOL_SIZE + "."); _log.info("AI threads: .......... " + Config.AI_THREAD_POOL_SIZE + "."); _log.info("Packet threads: ...... " + Config.PACKET_THREAD_POOL_SIZE + "."); _log.info("Total threads: ....... " + Config.THREAD_POOL_SIZE + "."); } } Очень советую загуглить: 1. Что такое Java. 2. Что такое sh. Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты