![]() |
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
The root of the object hierarchy. More...
#include <Root.h>
Classes | |
class | cCommand |
Public Member Functions | |
void | AuthenticateUser (int a_ClientID, const AString &a_Name, const cUUID &a_UUID, const Json::Value &a_Properties) |
Called by cAuthenticator to auth the specified user. More... | |
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 | 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... | |
void | ExecuteConsoleCommand (const AString &a_Cmd, cCommandOutputCallback &a_Output) |
Executes a console command through the cServer class; does special handling for "stop" and "restart". 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) |
BlockTypeRegistry & | GetBlockTypeRegistry () |
Returns the (read-write) storage for registered block types. More... | |
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) |
ProtocolPalettes & | GetProtocolPalettes () const |
Returns the per-protocol palettes manager. More... | |
cRankManager * | GetRankManager (void) |
cServer * | GetServer (void) |
int | GetServerUpTime (void) |
Returns the up time of the server in seconds. More... | |
int | GetTotalChunkCount (void) |
Returns the number of chunks loaded. More... | |
const BlockTypePalette & | GetUpgradeBlockTypePalette () const |
Returns the block type palette used for upgrading blocks from pre-1.13 data. 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, cCommandOutputCallback &a_Output) |
Queues a console command for execution through the cServer class. More... | |
void | QueueExecuteConsoleCommand (const AString &a_Cmd) |
Queues a console command for execution through the cServer class. More... | |
void | SaveAllChunks (void) |
Saves all chunks in all worlds. 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... | |
void | Start (std::unique_ptr< cSettingsRepositoryInterface > a_OverridesRepo) |
void | StopServer () |
Stops the server, as if "/stop" was typed in the console. More... | |
void | TickCommands (void) |
Executes commands queued in the command queue. More... | |
~cRoot () | |
Static Public Member Functions | |
static cRoot * | Get () |
static int | GetFurnaceFuelBurnTime (const cItem &a_Fuel) |
Returns the number of ticks for how long the item would fuel a furnace. 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... | |
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... | |
Static Public Attributes | |
static bool | m_RunAsService = false |
If set to true, binary will attempt to run as a service on Windows. More... | |
static bool | m_TerminateEventRaised = false |
If something has told the server to stop; checked periodically in cRoot. More... | |
Private Types | |
typedef std::vector< cCommand > | cCommandQueue |
typedef std::map< AString, cWorld * > | WorldMap |
Private Member Functions | |
void | DoExecuteConsoleCommand (const AString &a_Cmd) |
Does the actual work of executing a command. More... | |
void | LoadGlobalSettings () |
void | LoadPalettes (const AString &aProtocolFolder) |
Loads the upgrade palette and the per-protocol palettes. 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... | |
void | UnloadWorlds (void) |
Unloads all worlds from memory. More... | |
Static Private Member Functions | |
static void | InputThread (cRoot &a_Params) |
Private Attributes | |
cAuthenticator | m_Authenticator |
BlockTypeRegistry | m_BlockTypeRegistry |
The storage for all registered block types. More... | |
std::unique_ptr< cBrewingRecipes > | m_BrewingRecipes |
cCraftingRecipes * | m_CraftingRecipes |
cCriticalSection | m_CSPendingCommands |
cFurnaceRecipe * | m_FurnaceRecipe |
cHTTPServer | m_HTTPServer |
std::thread | m_InputThread |
std::atomic_flag | m_InputThreadRunFlag |
cMojangAPI * | m_MojangAPI |
cMonsterConfig * | m_MonsterConfig |
cWorld * | m_pDefaultWorld |
cCommandQueue | m_PendingCommands |
cPluginManager * | m_PluginManager |
std::unique_ptr< ProtocolPalettes > | m_ProtocolPalettes |
The per-protocol palettes manager. More... | |
std::unique_ptr< cRankManager > | m_RankManager |
cServer * | m_Server |
cEvent | m_StopEvent |
std::unique_ptr< BlockTypePalette > | m_UpgradeBlockTypePalette |
The upgrade palette for pre-1.13 blocks. More... | |
cWebAdmin * | m_WebAdmin |
WorldMap | m_WorldsByName |
Static Private Attributes | |
static cRoot * | s_Root = nullptr |
|
private |
|
private |
void cRoot::AuthenticateUser | ( | int | a_ClientID, |
const AString & | a_Name, | ||
const cUUID & | a_UUID, | ||
const Json::Value & | a_Properties | ||
) |
Called by cAuthenticator to auth the specified user.
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::BroadcastPlayerListsRemovePlayer | ( | const cPlayer & | a_Player, |
const cClientHandle * | a_Exclude = nullptr |
||
) |
|
private |
Does the actual work of executing a command.
bool cRoot::DoWithPlayer | ( | const AString & | a_PlayerName, |
cPlayerListCallback | a_Callback | ||
) |
bool cRoot::DoWithPlayerByUUID | ( | const cUUID & | a_PlayerUUID, |
cPlayerListCallback | a_Callback | ||
) |
void cRoot::ExecuteConsoleCommand | ( | const AString & | a_Cmd, |
cCommandOutputCallback & | a_Output | ||
) |
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 |
|
inline |
|
static |
|
inline |
|
inline |
|
inline |
|
static |
AStringVector cRoot::GetPlayerTabCompletionMultiWorld | ( | const AString & | a_Text | ) |
|
inline |
|
inline |
|
static |
|
inline |
|
inline |
int cRoot::GetTotalChunkCount | ( | void | ) |
|
inline |
|
static |
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, |
cCommandOutputCallback & | a_Output | ||
) |
void cRoot::QueueExecuteConsoleCommand | ( | const AString & | a_Cmd | ) |
void cRoot::SaveAllChunks | ( | void | ) |
void cRoot::SendPlayerLists | ( | cPlayer * | a_DestPlayer | ) |
void cRoot::SetSavingEnabled | ( | bool | a_SavingEnabled | ) |
void cRoot::Start | ( | std::unique_ptr< cSettingsRepositoryInterface > | a_OverridesRepo | ) |
|
private |
void cRoot::StopServer | ( | ) |
|
private |
void cRoot::TickCommands | ( | void | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |
AString cRoot::m_SettingsFilename |
std::chrono::steady_clock::time_point cRoot::m_StartTime |
|
static |
|
private |