RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.RuneHive Class Reference
Collaboration diagram for com.runehive.RuneHive:

Public Member Functions

LoginExecutorService getLoginExecutorService ()
void start () throws Exception

Static Public Member Functions

static DateTime currentDateTime ()
static RuneHive getInstance ()
static void main (String[] args)
static DateTimeZone timeZone ()

Static Public Attributes

static final AtomicBoolean serverStarted = new AtomicBoolean(false)
static final Stopwatch UPTIME = Stopwatch.start()

Private Member Functions

void onStart ()
 Called when the game engine is running and all the startup tasks have finished loading.
void processParallelStartupTasks ()
 Called after the sequential startup tasks, use this for faster startup.
void processSequentialStartupTasks ()
 RuneHive ()

Private Attributes

final LoginExecutorService loginExecutorService

Static Private Attributes

static final GameEngine gameService = new GameEngine()
static final RuneHive INSTANCE = new RuneHive()
static final Logger logger = LogManager.getLogger(RuneHive.class)
static final NetworkService networkService = new NetworkService()
static final StartupService startupService = new StartupService()

Detailed Description

Definition at line 55 of file RuneHive.java.

Constructor & Destructor Documentation

◆ RuneHive()

com.runehive.RuneHive.RuneHive ( )
private

Definition at line 71 of file RuneHive.java.

71 {
72 loginExecutorService = new LoginExecutorService(Runtime.getRuntime().availableProcessors());
73 }
final LoginExecutorService loginExecutorService
Definition RuneHive.java:69

References loginExecutorService.

Referenced by getInstance().

Here is the caller graph for this function:

Member Function Documentation

◆ currentDateTime()

DateTime com.runehive.RuneHive.currentDateTime ( )
static

Definition at line 204 of file RuneHive.java.

204 {
205 return new DateTime(timeZone());
206 }
static DateTimeZone timeZone()

References timeZone().

Referenced by com.runehive.game.world.cronjobs.impl.DoubleExperienceJob.execute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInstance()

RuneHive com.runehive.RuneHive.getInstance ( )
static

Definition at line 200 of file RuneHive.java.

200 {
201 return INSTANCE;
202 }
static final RuneHive INSTANCE
Definition RuneHive.java:67

References INSTANCE, and RuneHive().

Referenced by com.runehive.net.session.LoginSession.handleClientPacket().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLoginExecutorService()

LoginExecutorService com.runehive.RuneHive.getLoginExecutorService ( )

Definition at line 212 of file RuneHive.java.

212 {
213 return this.loginExecutorService;
214 }

Referenced by com.runehive.net.session.LoginSession.handleClientPacket().

Here is the caller graph for this function:

◆ main()

void com.runehive.RuneHive.main ( String[] args)
static

Definition at line 185 of file RuneHive.java.

185 {
186 Runtime.getRuntime().addShutdownHook(new Thread(() -> {
187 logger.info("shutting down server, initializing shutdown hook");
188 World.save();
189 com.runehive.content.ai.LazyAIManager.shutdown();
190 }));
191
192 try {
193 INSTANCE.start();
194 } catch (Throwable t) {
195 logger.error("A problem has been encountered while starting the server.", t);
196 }
197
198 }
static final Logger logger
Definition RuneHive.java:57

References INSTANCE, logger, and com.runehive.game.world.World.save().

Here is the call graph for this function:

◆ onStart()

void com.runehive.RuneHive.onStart ( )
private

Called when the game engine is running and all the startup tasks have finished loading.

Definition at line 131 of file RuneHive.java.

131 {
132 if (WellOfGoodwill.isActive()) {
133 World.schedule(new DoubleExperienceEvent());
134 }
135
136 World.schedule(new MessageEvent());
137 World.schedule(new ClanUpdateEvent());
138 World.schedule(new SkotizoEvent());
139 World.schedule(new PlayerSaveEvent());
140// World.schedule(new BotStartupEvent());
141 World.schedule(new BloodChestEvent());
142 // World.schedule(new LMSLobbyEvent()); // Disabled - causes deadlock
143 // World.schedule(new LMSGameEvent()); // Disabled - related to LMS
144 logger.info("Events have been scheduled");
145 }

References com.runehive.content.WellOfGoodwill.isActive(), logger, and com.runehive.game.world.World.schedule().

Referenced by start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processParallelStartupTasks()

void com.runehive.RuneHive.processParallelStartupTasks ( )
private

Called after the sequential startup tasks, use this for faster startup.

Try not to use this method for tasks that rely on other tasks you'll run into issues.

Definition at line 108 of file RuneHive.java.

108 {
109 startupService.submit(new PacketSizeParser());
110 startupService.submit(new PacketListenerLoader());
111 startupService.submit(TriviaBot::declare);
112// startupService.submit(PersonalStoreSaver::loadPayments);
113 startupService.submit(ClanRepository::loadChannels);
114 // startupService.submit(GlobalRecords::load);
115 startupService.submit(SkillRepository::load);
116 startupService.submit(ProfileRepository::load);
117 startupService.submit(ItemActionRepository::declare);
118 startupService.submit(ClueScrollPlugin::declare);
119 startupService.submit(MysteryBox::load);
120 startupService.submit(GameSaver::load);
121 startupService.submit(PreloadRepository::declare);
122 startupService.submit(TradingPost::loadAllListings);
123 startupService.submit(TradingPost::loadItemHistory);
124 startupService.submit(TradingPost::loadRecentItemHistory);
125 startupService.shutdown();
126 }
static final StartupService startupService
Definition RuneHive.java:63

References com.runehive.content.itemaction.ItemActionRepository.declare(), com.runehive.content.preloads.PreloadRepository.declare(), com.runehive.content.triviabot.TriviaBot.declare(), com.runehive.content.mysterybox.MysteryBox.load(), com.runehive.content.skill.SkillRepository.load(), com.runehive.game.world.entity.mob.player.profile.ProfileRepository.load(), com.runehive.util.GameSaver.load(), com.runehive.content.tradingpost.TradingPost.loadAllListings(), com.runehive.content.clanchannel.ClanRepository.loadChannels(), com.runehive.content.tradingpost.TradingPost.loadItemHistory(), com.runehive.content.tradingpost.TradingPost.loadRecentItemHistory(), and startupService.

Referenced by start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processSequentialStartupTasks()

void com.runehive.RuneHive.processSequentialStartupTasks ( )
private

Definition at line 75 of file RuneHive.java.

75 {
76 OldToNew.load();
77 try {
78 //object/region decoding must be done before parallel.
79 new ObjectRemovalParser().run();
80 final FileSystem fs = FileSystem.create("data/cache");
81 new ObjectDefinitionDecoder(fs).run();
82 new MapDefinitionDecoder(fs).run();
83 new RegionDecoder(fs).run();
84 new AnimationDefinitionDecoder(fs).run();
85 CacheNpcDefinition.unpackConfig(fs.getArchive(FileSystem.CONFIG_ARCHIVE));
86 } catch (IOException e) {
87 e.printStackTrace();
88 }
89 ItemDefinition.createParser().run();
90 NpcDefinition.createParser().run();
91 ObjectExamines.loadObjectExamines();
92 new CombatProjectileParser().run();
93 CombatListenerManager.load();
94 new NpcSpawnParser().run();
95 new NpcDropParser().run();
96 new NpcForceChatParser().run();
97 new StoreParser().run();
98 new GlobalObjectParser().run();
99 // ShootingStar.init(); // Disabled - causes deadlock
100 Wintertodt.init();
101 }
Archive getArchive(int id)
Gets an Archive for the specified id, this method fails-fast if no archive can be found.

References com.runehive.fs.cache.FileSystem.CONFIG_ARCHIVE, com.runehive.fs.cache.FileSystem.create(), com.runehive.game.world.entity.mob.npc.definition.NpcDefinition.createParser(), com.runehive.game.world.items.ItemDefinition.createParser(), com.runehive.content.wintertodt.Wintertodt.init(), com.runehive.game.world.entity.combat.attack.listener.CombatListenerManager.load(), com.runehive.fs.cache.decoder.AnimationDefinitionDecoder.run(), com.runehive.fs.cache.decoder.MapDefinitionDecoder.run(), com.runehive.fs.cache.decoder.ObjectDefinitionDecoder.run(), com.runehive.fs.cache.decoder.RegionDecoder.run(), com.runehive.util.parser.GenericParser.run(), and com.runehive.fs.cache.decoder.CacheNpcDefinition.unpackConfig().

Referenced by start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void com.runehive.RuneHive.start ( ) throws Exception

Definition at line 147 of file RuneHive.java.

147 {
148 if (Config.FORUM_INTEGRATION) {
149 ForumService.start(); // used to check users logging in with website credentials
150
151 if (Config.WORLD_TYPE == WorldType.LIVE) {
152 PostgreService.start(); // used to start the postgres connection pool
153 WebsitePlayerCountService.getInstance().startAsync(); // used to display player count on website
154 }
155 }
156
157 new FileServer().start();
158
159 logger.info("RuneHive is running (client version " + Config.CLIENT_VERSION + ")");
160 logger.info(String.format("Game Engine=%s", Config.PARALLEL_GAME_ENGINE ? "Parallel" : "Sequential"));
163
164 startupService.awaitUntilFinished(5, TimeUnit.MINUTES);
165 logger.info("Startup service finished");
166
167 LMSLoadoutManager.load();
168
169 PluginManager.load("plugin");
170
171 gameService.startAsync().awaitRunning();
172 logger.info("Game service started");
173
174 onStart();
175
176 Jobs.load();
177
178 BannedPlayers.load();
179 IPBannedPlayers.load();
180 IPMutedPlayers.load();
181
182 networkService.start(Config.SERVER_PORT);
183 }
void processSequentialStartupTasks()
Definition RuneHive.java:75
void processParallelStartupTasks()
Called after the sequential startup tasks, use this for faster startup.
void onStart()
Called when the game engine is running and all the startup tasks have finished loading.
static final NetworkService networkService
Definition RuneHive.java:65
static final GameEngine gameService
Definition RuneHive.java:64

References com.runehive.Config.CLIENT_VERSION, com.runehive.Config.FORUM_INTEGRATION, gameService, com.runehive.game.service.WebsitePlayerCountService.getInstance(), com.runehive.game.world.WorldType.LIVE, com.runehive.content.lms.loadouts.LMSLoadoutManager.load(), com.runehive.game.plugin.PluginManager.load(), com.runehive.game.world.cronjobs.Jobs.load(), com.runehive.game.world.entity.mob.player.BannedPlayers.load(), com.runehive.game.world.entity.mob.player.IPBannedPlayers.load(), com.runehive.game.world.entity.mob.player.IPMutedPlayers.load(), logger, networkService, onStart(), com.runehive.Config.PARALLEL_GAME_ENGINE, processParallelStartupTasks(), processSequentialStartupTasks(), com.runehive.Config.SERVER_PORT, com.runehive.game.service.ForumService.start(), com.runehive.game.service.PostgreService.start(), dev.advo.fs.FileServer.start(), startupService, and com.runehive.Config.WORLD_TYPE.

Here is the call graph for this function:

◆ timeZone()

DateTimeZone com.runehive.RuneHive.timeZone ( )
static

Definition at line 208 of file RuneHive.java.

208 {
209 return DateTimeZone.UTC;
210 }

Referenced by currentDateTime().

Here is the caller graph for this function:

Member Data Documentation

◆ gameService

final GameEngine com.runehive.RuneHive.gameService = new GameEngine()
staticprivate

Definition at line 64 of file RuneHive.java.

Referenced by start().

◆ INSTANCE

final RuneHive com.runehive.RuneHive.INSTANCE = new RuneHive()
staticprivate

Definition at line 67 of file RuneHive.java.

Referenced by getInstance(), and main().

◆ logger

final Logger com.runehive.RuneHive.logger = LogManager.getLogger(RuneHive.class)
staticprivate

Definition at line 57 of file RuneHive.java.

Referenced by main(), onStart(), and start().

◆ loginExecutorService

final LoginExecutorService com.runehive.RuneHive.loginExecutorService
private

Definition at line 69 of file RuneHive.java.

Referenced by RuneHive().

◆ networkService

final NetworkService com.runehive.RuneHive.networkService = new NetworkService()
staticprivate

Definition at line 65 of file RuneHive.java.

Referenced by start().

◆ serverStarted

final AtomicBoolean com.runehive.RuneHive.serverStarted = new AtomicBoolean(false)
static

◆ startupService

final StartupService com.runehive.RuneHive.startupService = new StartupService()
staticprivate

Definition at line 63 of file RuneHive.java.

Referenced by processParallelStartupTasks(), and start().

◆ UPTIME

final Stopwatch com.runehive.RuneHive.UPTIME = Stopwatch.start()
static

The documentation for this class was generated from the following file: