33 class ProtocolPalettes;
80 return static_cast<int>(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() -
m_StartTime).count());
std::vector< AString > AStringVector
Holds a palette that maps between block type + state and numbers.
Interface for a callback that receives command output The Out() function is called for any output the...
Container for a single chat message composed of multiple functional parts.
The crafting recipes are the configurations to build a result item out of a set of ingredient items.
The RecipeMapper handles the translation of crafting recipes into protocol specific recipe Ids.
The root of the object hierarchy.
cMonsterConfig * m_MonsterConfig
void BroadcastChatFatal(const AString &a_Message)
AString m_SettingsFilename
which ini file to load settings from, default is settings.ini
std::unique_ptr< cRecipeMapper > m_RecipeMapper
cServer * GetServer(void)
void BroadcastChatDeath(const AString &a_Message)
void SetSavingEnabled(bool a_SavingEnabled)
Sets whether saving chunks is enabled in all worlds (overrides however the worlds were already set)
void BroadcastPlayerListsHeaderFooter(const cCompositeChat &a_Header, const cCompositeChat &a_Footer)
Broadcast playerlist header and footer through all worlds.
static int GetPhysicalRAMUsage(void)
Returns the amount of virtual RAM used, in KiB.
void BroadcastChat(const AString &a_Message, eMessageType a_ChatPrefix=mtCustom)
Sends a chat message to all connected clients (in all worlds)
void BroadcastChatWarning(const AString &a_Message)
bool ForEachWorld(cWorldListCallback a_Callback)
Calls the callback for each world; returns true if the callback didn't abort (return true)
bool FindAndDoWithPlayer(const AString &a_PlayerName, cPlayerListCallback a_Callback)
Finds a player from a partial or complete player name and calls the callback - case-insensitive.
cPluginManager * m_PluginManager
void SaveAllChunksNow(void)
Saves all chunks in all worlds synchronously (waits until dirty chunks have been sent to the ChunkSto...
cFurnaceRecipe * GetFurnaceRecipe(void)
void KickUser(int a_ClientID, const AString &a_Reason)
Kicks the user, no matter in what world they are.
AStringVector GetPlayerTabCompletionMultiWorld(const AString &a_Text)
Returns the completions for a player name across all worlds.
int GetServerUpTime(void)
Returns the up time of the server in seconds.
void SendPlayerLists(cPlayer *a_DestPlayer)
Send playerlist of all worlds to player.
void StartWorlds(cDeadlockDetect &a_DeadlockDetect)
Starts each world's life.
cBrewingRecipes * GetBrewingRecipes(void)
cCraftingRecipes * m_CraftingRecipes
bool DoWithPlayerByUUID(const cUUID &a_PlayerUUID, cPlayerListCallback a_Callback)
Finds the player over his uuid and calls the callback.
std::chrono::steady_clock::time_point m_StartTime
The current time where the startup of the server has been completed.
cAuthenticator & GetAuthenticator(void)
void HandleInput()
Blocking reads and processes console input.
void SaveAllChunks(void)
Saves all chunks in all worlds.
cMojangAPI & GetMojangAPI(void)
cWorld * GetDefaultWorld(void)
cRecipeMapper * GetRecipeMapper(void)
NextState
States that the global cRoot can be in.
void BroadcastChatLeave(const AString &a_Message)
cCraftingRecipes * GetCraftingRecipes(void)
static void Restart()
Interrupts the server and restarts it, as if "/restart" was typed in the console.
static void Stop()
Interrupts the server and stops it, as if "/stop" typed in the console.
static int GetVirtualRAMUsage(void)
Returns the amount of virtual RAM used, in KiB.
void BroadcastChatInfo(const AString &a_Message)
static int GetFurnaceFuelBurnTime(const cItem &a_Fuel)
Returns the (read-write) storage for registered block types.
cPluginManager * GetPluginManager(void)
std::unique_ptr< cBrewingRecipes > m_BrewingRecipes
static cEvent s_StopEvent
void BroadcastChatJoin(const AString &a_Message)
bool DoWithPlayer(const AString &a_PlayerName, cPlayerListCallback a_Callback)
Finds the player using it's complete username and calls the callback.
void QueueExecuteConsoleCommand(const AString &a_Cmd, cCommandOutputCallback &a_Output)
Queues a console command for execution through the cServer class.
size_t GetTotalChunkCount(void)
Returns the number of chunks loaded.
static AString GetProtocolVersionTextFromInt(int a_ProtocolVersionNum)
Returns the textual description of the protocol version: 49 -> "1.4.4".
void StopWorlds(cDeadlockDetect &a_DeadlockDetect)
Stops each world's threads, so that it's safe to unload them.
void BroadcastChatFailure(const AString &a_Message)
cWorld * GetWorld(const AString &a_WorldName)
Returns a pointer to the world specified.
std::map< AString, cWorld > WorldMap
static void TransitionNextState(NextState a_NextState)
Performs run state transition, enforcing guarantees about state transitions.
void BroadcastPlayerListsAddPlayer(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr)
Broadcast playerlist addition through all worlds.
void LoadGlobalSettings()
The storage for all registered block types.
cAuthenticator m_Authenticator
void BroadcastPlayerListsRemovePlayer(const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr)
Broadcast playerlist removal through all worlds.
void BroadcastChatSuccess(const AString &a_Message)
cWebAdmin * GetWebAdmin(void)
void LogChunkStats(cCommandOutputCallback &a_Output)
Writes chunkstats, for each world and totals, to the output callback.
cRankManager * GetRankManager(void)
cFurnaceRecipe * m_FurnaceRecipe
bool ForEachPlayer(cPlayerListCallback a_Callback)
Calls the callback for each player in all worlds.
static std::atomic< NextState > s_NextState
Indicates the next action of cRoot, whether to run, stop or restart.
void LoadWorlds(cDeadlockDetect &a_dd, cSettingsRepositoryInterface &a_Settings, bool a_IsNewIniFile)
Loads the worlds from settings.ini, creates the worldmap.
std::unique_ptr< cRankManager > m_RankManager
bool Run(cSettingsRepositoryInterface &a_OverridesRepo)
Run the server.
cMonsterConfig * GetMonsterConfig(void)