This class represents the root of Cuberite's object hierarchy. There is always only one cRoot
object. It manages and allows querying all the other objects, such as cServer,
cPluginManager, individual worlds etc.
To get the singleton instance of this object, you call the cRoot:Get() function. Then you can call
the individual functions on this object. Note that some of the functions are static and don't need
the instance, they are to be called directly on the cRoot class, such as cRoot:GetPhysicalRAMUsage()
Name | Parameters | Return value | Notes |
BroadcastChat |
MessageText, MessageType |
|
Broadcasts a message to all players, with its message type set to MessageType (default: mtCustom). |
BroadcastChat |
CompositeChat |
|
Broadcasts a composite chat message to all players. |
BroadcastChatDeath |
MessageText |
|
Broadcasts the specified message to all players, with its message type set to mtDeath. Use for when a player has died. |
BroadcastChatFailure |
MessageText |
|
Broadcasts the specified message to all players, with its message type set to mtFailure. Use for a command that failed to run because of insufficient permissions, etc. |
BroadcastChatFatal |
MessageText |
|
Broadcasts the specified message to all players, with its message type set to mtFatal. Use for a plugin that crashed, or similar. |
BroadcastChatInfo |
MessageText |
|
Broadcasts the specified message to all players, with its message type set to mtInfo. Use for informational messages, such as command usage. |
BroadcastChatJoin |
MessageText |
|
Broadcasts the specified message to all players, with its message type set to mtJoin. Use for players joining the server. |
BroadcastChatLeave |
MessageText |
|
Broadcasts the specified message to all players, with its message type set to mtLeave. Use for players leaving the server. |
BroadcastChatSuccess |
MessageText |
|
Broadcasts the specified message to all players, with its message type set to mtSuccess. Use for success messages. |
BroadcastChatWarning |
MessageText |
|
Broadcasts the specified message to all players, with its message type set to mtWarning. Use for concerning events, such as plugin reload etc. |
DoWithPlayerByUUID |
PlayerUUID, CallbackFunction |
bool |
If there is the player with the uuid, calls the CallbackFunction with the cPlayer parameter representing the player. The CallbackFunction has the following signature: function Callback(Player) The function returns false if the player was not found, or whatever bool value the callback returned if the player was found. |
FindAndDoWithPlayer |
PlayerName, CallbackFunction |
bool |
Calls the given callback function for the player with the name best matching the name string provided. This function is case-insensitive and will match partial names. Returns false if player not found or there is ambiguity, true otherwise. The CallbackFunction has the following signature: function Callback(Player) |
ForEachPlayer |
CallbackFunction |
|
Calls the given callback function for each player. The callback function has the following signature: function Callback(cPlayer) |
ForEachWorld |
CallbackFunction |
|
Calls the given callback function for each world. The callback function has the following signature: function Callback(cWorld) |
Get |
|
Root object |
(STATIC) This function returns the cRoot object. |
GetBrewingRecipe |
cItem, cItem |
cItem |
(STATIC) Returns the result item, if a recipe has been found. If no recipe is found, returns no value. |
GetBuildCommitID |
|
string |
(STATIC) For official builds (Travis CI / Jenkins) it returns the exact commit hash used for the build. For unofficial local builds, returns the approximate commit hash (since the true one cannot be determined), formatted as "approx: <CommitHash>". |
GetBuildDateTime |
|
string |
(STATIC) For official builds (Travic CI / Jenkins) it returns the date and time of the build. For unofficial local builds, returns the approximate datetime of the commit (since the true one cannot be determined), formatted as "approx: <DateTime-iso8601>". |
GetBuildID |
|
string |
(STATIC) For official builds (Travis CI / Jenkins) it returns the unique ID of the build, as recognized by the build system. For unofficial local builds, returns the string "Unknown". |
GetBuildSeriesName |
|
string |
(STATIC) For official builds (Travis CI / Jenkins) it returns the series name of the build (for example "Cuberite Windows x64 Master"). For unofficial local builds, returns the string "local build". |
GetCraftingRecipes |
|
cCraftingRecipe |
Returns the CraftingRecipes object |
GetDefaultWorld |
|
cWorld |
Returns the world object from the default world. |
GetFurnaceFuelBurnTime |
Fuel |
number |
(STATIC) Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel. |
GetFurnaceRecipe |
InItem |
OutItem, NumTicks, InItem |
(STATIC) Returns the furnace recipe for smelting the specified input. If a recipe is found, returns the smelted result, the number of ticks required for the smelting operation, and the input consumed (note that Cuberite supports smelting M items into N items and different smelting rates). If no recipe is found, returns no value. |
GetPhysicalRAMUsage |
|
number |
Returns the amount of physical RAM that the entire Cuberite process is using, in KiB. Negative if the OS doesn't support this query. |
GetPluginManager |
|
cPluginManager |
Returns the cPluginManager object. |
GetProtocolVersionTextFromInt |
Protocol Version |
string |
Returns the Minecraft version from the given Protocol. If there is no version found, it returns 'Unknown protocol(Parameter)' |
GetServer |
|
cServer |
Returns the cServer object. |
GetServerUpTime |
|
number |
Returns the uptime of the server in seconds. |
GetTotalChunkCount |
|
number |
Returns the amount of loaded chunks. |
GetVirtualRAMUsage |
|
number |
Returns the amount of virtual RAM that the entire Cuberite process is using, in KiB. Negative if the OS doesn't support this query. |
GetWebAdmin |
|
cWebAdmin |
Returns the cWebAdmin object. |
GetWorld |
WorldName |
cWorld |
Returns the cWorld object of the given world. It returns nil if there is no world with the given name. |
QueueExecuteConsoleCommand |
Message |
|
Queues a console command for execution through the cServer class. The command will be executed in the tick thread. The command's output will be sent to console. |
SaveAllChunks |
|
|
Saves all the chunks in all the worlds. Note that the saving is queued on each world's tick thread and this functions returns before the chunks are actually saved. |