Cuberite
A lightweight, fast and extensible game server for Minecraft
|
The root of the object hierarchy. More...
#include <Root.h>
Public Member Functions | |
void | BroadcastChat (const AString &a_Message, eMessageType a_ChatPrefix=mtCustom) |
Sends a chat message to all connected clients (in all worlds) More... | |
void | BroadcastChat (const cCompositeChat &a_Message) |
void | BroadcastChatDeath (const AString &a_Message) |
void | BroadcastChatFailure (const AString &a_Message) |
void | BroadcastChatFatal (const AString &a_Message) |
void | BroadcastChatInfo (const AString &a_Message) |
void | BroadcastChatJoin (const AString &a_Message) |
void | BroadcastChatLeave (const AString &a_Message) |
void | BroadcastChatSuccess (const AString &a_Message) |
void | BroadcastChatWarning (const AString &a_Message) |
void | BroadcastPlayerListsAddPlayer (const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) |
Broadcast playerlist addition through all worlds. More... | |
void | BroadcastPlayerListsHeaderFooter (const cCompositeChat &a_Header, const cCompositeChat &a_Footer) |
Broadcast playerlist header and footer through all worlds. More... | |
void | BroadcastPlayerListsRemovePlayer (const cPlayer &a_Player, const cClientHandle *a_Exclude=nullptr) |
Broadcast playerlist removal through all worlds. More... | |
cRoot (void) | |
bool | DoWithPlayer (const AString &a_PlayerName, cPlayerListCallback a_Callback) |
Finds the player using it's complete username and calls the callback. More... | |
bool | DoWithPlayerByUUID (const cUUID &a_PlayerUUID, cPlayerListCallback a_Callback) |
Finds the player over his uuid and calls the callback. More... | |
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. More... | |
bool | ForEachPlayer (cPlayerListCallback a_Callback) |
Calls the callback for each player in all worlds. More... | |
bool | ForEachWorld (cWorldListCallback a_Callback) |
Calls the callback for each world; returns true if the callback didn't abort (return true) More... | |
cAuthenticator & | GetAuthenticator (void) |
cBrewingRecipes * | GetBrewingRecipes (void) |
cCraftingRecipes * | GetCraftingRecipes (void) |
cWorld * | GetDefaultWorld (void) |
cFurnaceRecipe * | GetFurnaceRecipe (void) |
cMojangAPI & | GetMojangAPI (void) |
cMonsterConfig * | GetMonsterConfig (void) |
AStringVector | GetPlayerTabCompletionMultiWorld (const AString &a_Text) |
Returns the completions for a player name across all worlds. More... | |
cPluginManager * | GetPluginManager (void) |
cRankManager * | GetRankManager (void) |
cRecipeMapper * | GetRecipeMapper (void) |
cServer * | GetServer (void) |
int | GetServerUpTime (void) |
Returns the up time of the server in seconds. More... | |
size_t | GetTotalChunkCount (void) |
Returns the number of chunks loaded. More... | |
cWebAdmin * | GetWebAdmin (void) |
cWorld * | GetWorld (const AString &a_WorldName) |
Returns a pointer to the world specified. More... | |
void | KickUser (int a_ClientID, const AString &a_Reason) |
Kicks the user, no matter in what world they are. More... | |
void | LogChunkStats (cCommandOutputCallback &a_Output) |
Writes chunkstats, for each world and totals, to the output callback. More... | |
void | QueueExecuteConsoleCommand (const AString &a_Cmd) |
Queues a console command for execution through the cServer class. More... | |
void | QueueExecuteConsoleCommand (const AString &a_Cmd, cCommandOutputCallback &a_Output) |
Queues a console command for execution through the cServer class. More... | |
bool | Run (cSettingsRepositoryInterface &a_OverridesRepo) |
Run the server. More... | |
void | SaveAllChunks (void) |
Saves all chunks in all worlds. More... | |
void | SaveAllChunksNow (void) |
Saves all chunks in all worlds synchronously (waits until dirty chunks have been sent to the ChunkStorage queue before returning) More... | |
void | SendPlayerLists (cPlayer *a_DestPlayer) |
Send playerlist of all worlds to player. More... | |
void | SetSavingEnabled (bool a_SavingEnabled) |
Sets whether saving chunks is enabled in all worlds (overrides however the worlds were already set) More... | |
~cRoot () | |
Static Public Member Functions | |
static cRoot * | Get () |
static int | GetFurnaceFuelBurnTime (const cItem &a_Fuel) |
Returns the (read-write) storage for registered block types. More... | |
static int | GetPhysicalRAMUsage (void) |
Returns the amount of virtual RAM used, in KiB. More... | |
static AString | GetProtocolVersionTextFromInt (int a_ProtocolVersionNum) |
Returns the textual description of the protocol version: 49 -> "1.4.4". More... | |
static int | GetVirtualRAMUsage (void) |
Returns the amount of virtual RAM used, in KiB. More... | |
static void | Restart () |
Interrupts the server and restarts it, as if "/restart" was typed in the console. More... | |
static void | Stop () |
Interrupts the server and stops it, as if "/stop" typed in the console. More... | |
Public Attributes | |
AString | m_SettingsFilename |
which ini file to load settings from, default is settings.ini More... | |
std::chrono::steady_clock::time_point | m_StartTime |
The current time where the startup of the server has been completed. More... | |
Private Types | |
enum class | NextState { Run , Restart , Stop } |
States that the global cRoot can be in. More... | |
typedef std::map< AString, cWorld > | WorldMap |
Private Member Functions | |
void | HandleInput () |
Blocking reads and processes console input. More... | |
void | LoadGlobalSettings () |
The storage for all registered block types. More... | |
void | LoadWorlds (cDeadlockDetect &a_dd, cSettingsRepositoryInterface &a_Settings, bool a_IsNewIniFile) |
Loads the worlds from settings.ini, creates the worldmap. More... | |
void | StartWorlds (cDeadlockDetect &a_DeadlockDetect) |
Starts each world's life. More... | |
void | StopWorlds (cDeadlockDetect &a_DeadlockDetect) |
Stops each world's threads, so that it's safe to unload them. More... | |
Static Private Member Functions | |
static void | TransitionNextState (NextState a_NextState) |
Performs run state transition, enforcing guarantees about state transitions. More... | |
Private Attributes | |
cAuthenticator | m_Authenticator |
std::unique_ptr< cBrewingRecipes > | m_BrewingRecipes |
cCraftingRecipes * | m_CraftingRecipes |
cFurnaceRecipe * | m_FurnaceRecipe |
cHTTPServer | m_HTTPServer |
cMojangAPI * | m_MojangAPI |
cMonsterConfig * | m_MonsterConfig |
cWorld * | m_pDefaultWorld |
cPluginManager * | m_PluginManager |
std::unique_ptr< cRankManager > | m_RankManager |
std::unique_ptr< cRecipeMapper > | m_RecipeMapper |
cServer * | m_Server |
cWebAdmin * | m_WebAdmin |
WorldMap | m_WorldsByName |
Static Private Attributes | |
static std::atomic< NextState > | s_NextState |
Indicates the next action of cRoot, whether to run, stop or restart. More... | |
static cRoot * | s_Root |
static cEvent | s_StopEvent |
|
private |
|
strongprivate |
void cRoot::BroadcastChat | ( | const AString & | a_Message, |
eMessageType | a_ChatPrefix = mtCustom |
||
) |
void cRoot::BroadcastChat | ( | const cCompositeChat & | a_Message | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void cRoot::BroadcastPlayerListsAddPlayer | ( | const cPlayer & | a_Player, |
const cClientHandle * | a_Exclude = nullptr |
||
) |
void cRoot::BroadcastPlayerListsHeaderFooter | ( | const cCompositeChat & | a_Header, |
const cCompositeChat & | a_Footer | ||
) |
void cRoot::BroadcastPlayerListsRemovePlayer | ( | const cPlayer & | a_Player, |
const cClientHandle * | a_Exclude = nullptr |
||
) |
bool cRoot::DoWithPlayer | ( | const AString & | a_PlayerName, |
cPlayerListCallback | a_Callback | ||
) |
bool cRoot::DoWithPlayerByUUID | ( | const cUUID & | a_PlayerUUID, |
cPlayerListCallback | a_Callback | ||
) |
bool cRoot::FindAndDoWithPlayer | ( | const AString & | a_PlayerName, |
cPlayerListCallback | a_Callback | ||
) |
bool cRoot::ForEachPlayer | ( | cPlayerListCallback | a_Callback | ) |
bool cRoot::ForEachWorld | ( | cWorldListCallback | a_Callback | ) |
|
inline |
|
inline |
|
inline |
|
static |
|
inline |
|
inline |
|
inline |
|
static |
AStringVector cRoot::GetPlayerTabCompletionMultiWorld | ( | const AString & | a_Text | ) |
|
inline |
|
static |
|
inline |
|
inline |
|
inline |
size_t cRoot::GetTotalChunkCount | ( | void | ) |
|
static |
|
private |
void cRoot::KickUser | ( | int | a_ClientID, |
const AString & | a_Reason | ||
) |
Kicks the user, no matter in what world they are.
Used from cAuthenticator
|
private |
|
private |
void cRoot::LogChunkStats | ( | cCommandOutputCallback & | a_Output | ) |
void cRoot::QueueExecuteConsoleCommand | ( | const AString & | a_Cmd | ) |
void cRoot::QueueExecuteConsoleCommand | ( | const AString & | a_Cmd, |
cCommandOutputCallback & | a_Output | ||
) |
|
static |
bool cRoot::Run | ( | cSettingsRepositoryInterface & | a_OverridesRepo | ) |
void cRoot::SaveAllChunks | ( | void | ) |
void cRoot::SaveAllChunksNow | ( | void | ) |
void cRoot::SendPlayerLists | ( | cPlayer * | a_DestPlayer | ) |
void cRoot::SetSavingEnabled | ( | bool | a_SavingEnabled | ) |
|
private |
|
static |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
AString cRoot::m_SettingsFilename |
std::chrono::steady_clock::time_point cRoot::m_StartTime |
|
staticprivate |