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 |
|
|
Broadcasts a message to all players, with its message type set to MessageType (default: mtCustom). |
BroadcastChat |
|
|
Broadcasts a composite chat message to all players. |
BroadcastChatDeath |
|
|
Broadcasts the specified message to all players, with its message type set to mtDeath. Use for when a player has died. |
BroadcastChatFailure |
|
|
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 |
|
|
Broadcasts the specified message to all players, with its message type set to mtFatal. Use for a plugin that crashed, or similar. |
BroadcastChatInfo |
|
|
Broadcasts the specified message to all players, with its message type set to mtInfo. Use for informational messages, such as command usage. |
BroadcastChatJoin |
|
|
Broadcasts the specified message to all players, with its message type set to mtJoin. Use for players joining the server. |
BroadcastChatLeave |
|
|
Broadcasts the specified message to all players, with its message type set to mtLeave. Use for players leaving the server. |
BroadcastChatSuccess |
|
|
Broadcasts the specified message to all players, with its message type set to mtSuccess. Use for success messages. |
BroadcastChatWarning |
|
|
Broadcasts the specified message to all players, with its message type set to mtWarning. Use for concerning events, such as plugin reload etc. |
|
|
(undocumented) |
DoWithPlayerByUUID |
PlayerUUID | cUUID | CallbackFunction | function |
|
|
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 | string | CallbackFunction | function |
|
|
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 |
|
|
Calls the given callback function for each player. The callback function has the following signature: function Callback(cPlayer) |
ForEachWorld |
|
|
Calls the given callback function for each world. The callback function has the following signature: function Callback(cWorld) . Returns false if a callback aborts, otherwise true. |
Get |
|
|
(STATIC) Returns the one and only cRoot object. |
GetBrewingRecipe |
|
|
(STATIC) Returns the result item, if a recipe has been found to brew the Ingredient into Bottle. If no recipe is found, returns no value. |
GetBuildCommitID |
|
|
(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 |
|
|
(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 |
|
|
(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 |
|
|
(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 |
|
|
Returns the CraftingRecipes object |
GetDefaultWorld |
|
|
Returns the world object from the default world. |
GetFurnaceFuelBurnTime |
|
|
(STATIC) Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel. |
GetFurnaceRecipe |
|
|
(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 |
|
|
(STATIC) 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 |
|
|
Returns the cPluginManager object. |
GetProtocolVersionTextFromInt |
ProtocolVersionNumber | number |
|
|
(STATIC) Returns the Minecraft client version from the given Protocol version number. If there is no version found, it returns 'Unknown protocol (Number)' |
GetServer |
|
|
Returns the cServer object. |
GetServerUpTime |
|
|
Returns the uptime of the server in seconds. |
GetTotalChunkCount |
|
|
Returns the amount of loaded chunks. |
GetVirtualRAMUsage |
|
|
(STATIC) 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 |
|
|
Returns the cWebAdmin object. |
GetWorld |
|
|
Returns the cWorld object of the given world. It returns nil if there is no world with the given name. |
QueueExecuteConsoleCommand |
|
|
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. |
SetSavingEnabled |
|
|
Sets whether saving chunk data is enabled for all worlds. If disabled, dirty chunks will stay in memory forever, which can cause performance and stability issues. |