summaryrefslogtreecommitdiffstats
path: root/MCServer
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer')
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua112
-rw-r--r--MCServer/Plugins/APIDump/main.lua1
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua4
3 files changed, 87 insertions, 30 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index b7a5b7e47..8b007101a 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -1968,11 +1968,18 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
cRoot =
{
- Desc = [[There is always only one cRoot object in MCServer. cRoot manages all the important objects such as {{cServer|cServer}}
-]],
+ Desc = [[
+ This class represents the root of MCServer's object hierarchy. There is always only one cRoot
+ object. It manages and allows querying all the other objects, such as {{cServer}},
+ {{cPluginManager}}, individual {{cWorld|worlds}} etc.</p>
+ <p>
+ 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()
+ ]],
Functions =
{
- Get = { Params = "", Return = "Root object", Notes = "This function returns the cRoot object." },
+ Get = { Params = "", Return = "Root object", Notes = "(STATIC)This function returns the cRoot object." },
BroadcastChat = { Params = "Message", Return = "", Notes = "Broadcasts a message to every player in the server." },
FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "", Notes = "Calls the given callback function for the given player." },
ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|cPlayer}})</pre>" },
@@ -1981,11 +1988,13 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
GetDefaultWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world object from the default world." },
GetFurnaceRecipe = { Params = "", Return = "{{cFurnaceRecipe|cFurnaceRecipe}}", Notes = "Returns the cFurnaceRecipes object." },
GetGroupManager = { Params = "", Return = "{{cGroupManager|cGroupManager}}", Notes = "Returns the cGroupManager object." },
+ GetPhysicalRAMUsage = { Params = "", Return = "number", Notes = "Returns the amount of physical RAM that the entire MCServer process is using, in KiB. Negative if the OS doesn't support this query." },
GetPluginManager = { Params = "", Return = "{{cPluginManager|cPluginManager}}", Notes = "Returns the cPluginManager object." },
GetPrimaryServerVersion = { Params = "", Return = "number", Notes = "Returns the servers primary server version." },
GetProtocolVersionTextFromInt = { Params = "Protocol Version", Return = "string", Notes = "Returns the Minecraft version from the given Protocol. If there is no version found, it returns 'Unknown protocol(Parameter)'" },
GetServer = { Params = "", Return = "{{cServer|cServer}}", Notes = "Returns the cServer object." },
GetTotalChunkCount = { Params = "", Return = "number", Notes = "Returns the amount of loaded chunks." },
+ GetVirtualRAMUsage = { Params = "", Return = "number", Notes = "Returns the amount of virtual RAM that the entire MCServer process is using, in KiB. Negative if the OS doesn't support this query." },
GetWebAdmin = { Params = "", Return = "{{cWebAdmin|cWebAdmin}}", Notes = "Returns the cWebAdmin object." },
GetWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Returns the cWorld object of the given world. It returns nil if there is no world with the given name." },
QueueExecuteConsoleCommand = { Params = "Message", Return = "", Notes = "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 " .. '"stop" and "restart" commands have special handling.' },
@@ -2099,36 +2108,48 @@ Sign entities are saved and loaded from disk when the chunk they reside in is sa
cWindow =
{
- Desc = [[This class is the common ancestor for all window classes used by MCServer. It is inherited by the {{cLuaWindow|cLuaWindow}} class that plugins use for opening custom windows. It is planned to be used for window-related hooks in the future. It implements the basic functionality of any window.
-</p>
- <p>Note that one cWindow object can be used for multiple players at the same time, and therefore the slot contents are player-specific (e. g. crafting grid, or player inventory). Thus the GetSlot() and SetSlot() functions need to have the {{cPlayer|cPlayer}} parameter that specifies the player for which the contents are to be queried.
-]],
+ Desc = [[
+ This class is the common ancestor for all window classes used by MCServer. It is inherited by the
+ {{cLuaWindow|cLuaWindow}} class that plugins use for opening custom windows. It is planned to be
+ used for window-related hooks in the future. It implements the basic functionality of any
+ window.</p>
+ <p>
+ Note that one cWindow object can be used for multiple players at the same time, and therefore the
+ slot contents are player-specific (e. g. crafting grid, or player inventory). Thus the GetSlot() and
+ SetSlot() functions need to have the {{cPlayer|cPlayer}} parameter that specifies the player for
+ whom the contents are to be queried.</p>
+ <p>
+ Windows also have numeric properties, these are used to set the progressbars for furnaces or the XP
+ costs for enchantment tables.
+ ]],
Functions =
{
+ GetSlot = { Params = "{{cPlayer|Player}}, SlotNumber", Return = "{{cItem}}", Notes = "Returns the item at the specified slot for the specified player. Returns nil and logs to server console on error." },
GetWindowID = { Params = "", Return = "number", Notes = "Returns the ID of the window, as used by the network protocol" },
GetWindowTitle = { Params = "", Return = "string", Notes = "Returns the window title that will be displayed to the player" },
GetWindowType = { Params = "", Return = "number", Notes = "Returns the type of the window, one of the constants in the table above" },
- IsSlotInPlayerHotbar = { Params = "number", Return = "bool", Notes = "Returns true if the specified slot number is in the player hotbar" },
- IsSlotInPlayerInventory = { Params = "number", Return = "bool", Notes = "Returns true if the specified slot number is in the player's main inventory or in the hotbar. Note that this returns false for armor slots!" },
- IsSlotInPlayerMainInventory = { Params = "number", Return = "bool", Notes = "Returns true if the specified slot number is in the player's main inventory" },
- SetSlot = { Params = "{{cItem|cItem}}", Return = "", Notes = "Sets the contents of the specified slot for the specified player. Ignored if the slot number is invalid" },
+ IsSlotInPlayerHotbar = { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot number is in the player hotbar" },
+ IsSlotInPlayerInventory = { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot number is in the player's main inventory or in the hotbar. Note that this returns false for armor slots!" },
+ IsSlotInPlayerMainInventory = { Params = "SlotNum", Return = "bool", Notes = "Returns true if the specified slot number is in the player's main inventory" },
+ SetProperty = { Params = "PropertyID, PropartyValue, {{cPlayer|Player}}", Return = "", Notes = "Sends the UpdateWindowProperty (0x69) packet to the specified player; or to all players who are viewing this window if Player is not specified or nil." },
+ SetSlot = { Params = "{{cPlayer|Player}}, SlotNum, {{cItem|cItem}}", Return = "", Notes = "Sets the contents of the specified slot for the specified player. Ignored if the slot number is invalid" },
SetWindowTitle = { Params = "string", Return = "", Notes = "Sets the window title that will be displayed to the player" },
},
Constants =
{
- Inventory = { Notes = "" },
- Chest = { Notes = "0" },
- Workbench = { Notes = "1" },
- Furnace = { Notes = "2" },
- DropSpenser = { Notes = "3" },
- Enchantment = { Notes = "4" },
- Brewery = { Notes = "5" },
- NPCTrade = { Notes = "6" },
- Beacon = { Notes = "7" },
- Anvil = { Notes = "8" },
- Hopper = { Notes = "9" },
+ wtInventory = { Notes = "An inventory window" },
+ wtChest = { Notes = "A {{cChestEntity|chest}} or doublechest window" },
+ wtWorkbench = { Notes = "A workbench (crafting table) window" },
+ wtFurnace = { Notes = "A {{cFurnaceEntity|furnace}} window" },
+ wtDropSpenser = { Notes = "A {{cDropperEntity|dropper}} or a {{cDispenserEntity|dispenser}} window" },
+ wtEnchantment = { Notes = "An enchantment table window" },
+ wtBrewery = { Notes = "A brewing stand window" },
+ wtNPCTrade = { Notes = "A villager trade window" },
+ wtBeacon = { Notes = "A beacon window" },
+ wtAnvil = { Notes = "An anvil window" },
+ wtHopper = { Notes = "A {{cHopperEntity|hopper}} window" },
},
- },
+ }, -- cWindow
cWorld =
{
@@ -2248,6 +2269,7 @@ Sign entities are saved and loaded from disk when the chunk they reside in is sa
QueueBlockForTick = { Params = "BlockX, BlockY, BlockZ, TicksToWait", Return = "", Notes = "Queues the specified block to be ticked after the specified number of gameticks." },
QueueSaveAllChunks = { Params = "", Return = "", Notes = "Queues all chunks to be saved in the world storage thread" },
QueueSetBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta, TickDelay", Return = "", Notes = "Queues the block to be set to the specified blocktype and meta after the specified amount of game ticks. Uses SetBlock() for the actual setting, so simulators are woken up and block entities are handled correctly." },
+ QueueTask = { Params = "TaskFunction", Return = "", Notes = "Queues the specified function to be executed in the tick thread. This is the primary means of interaction with a cWorld from the WebAdmin page handlers (see {{WebWorldThreads}}). The function signature is <pre class=\"pretty-print lang-lua\">function()</pre>All return values from the function are ignored. Note that this function is actually called *after* the QueueTask() function returns." },
RegenerateChunk = { Params = "ChunkX, ChunkZ", Return = "", Notes = "Queues the specified chunk to be re-generated, overwriting the current data. To queue a chunk for generating only if it doesn't exist, use the GenerateChunk() instead." },
SendBlockTo = { Params = "BlockX, BlockY, BlockZ, {{cPlayer|Player}}", Return = "", Notes = "Sends the block at the specified coords to the specified player's client, as an UpdateBlock packet." },
SetBlock = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sets the block at the specified coords, replaces the block entities for the previous block type, creates a new block entity for the new block, if appropriate, and wakes up the simulators. This is the preferred way to set blocks, as opposed to FastSetBlock(), which is only to be used under special circumstances." },
@@ -2338,7 +2360,40 @@ World:ForEachEntity(
]],
},
}, -- AdditionalInfo
- },
+ }, -- cWorld
+
+ HTTPFormData =
+ {
+ Desc = "This class stores data for one form element for a {{HTTPRequest|HTTP request}}.",
+ Variables =
+ {
+ Name = { Type = "string", Notes = "Name of the form element" },
+ Type = { Type = "string", Notes = "Type of the data (usually empty)" },
+ Value = { Type = "string", Notes = "Value of the form element. Contains the raw data as sent by the browser." },
+ },
+ }, -- HTTPFormData
+
+ HTTPRequest =
+ {
+ Desc = [[
+ This class encapsulates all the data that is sent to the WebAdmin through one HTTP request. Plugins
+ receive this class as a parameter to the function handling the web requests, as registered in the
+ FIXME: {{cPluginLua}}:AddWebPage().
+ ]],
+ Constants =
+ {
+ FormData = { Notes = "Array-table of {{HTTPFormData}}, contains the values of individual form elements submitted by the client" },
+ Params = { Notes = "Map-table of parameters given to the request in the URL (?param=value); if a form uses GET method, this is the same as FormData. For each parameter given as \"param=value\", there is an entry in the table with \"param\" as its key and \"value\" as its value." },
+ PostParams = { Notes = "Map-table of data posted through a FORM - either a GET or POST method. Logically the same as FormData, but in a map-table format (for each parameter given as \"param=value\", there is an entry in the table with \"param\" as its key and \"value\" as its value)." },
+ },
+
+ Variables =
+ {
+ Method = { Type = "string", Notes = "The HTTP method used to make the request. Usually GET or POST." },
+ Path = { Type = "string", Notes = "The Path part of the URL (excluding the parameters)" },
+ Username = { Type = "string", Notes = "Name of the logged-in user." },
+ },
+ }, -- HTTPRequest
TakeDamageInfo =
{
@@ -2350,7 +2405,7 @@ World:ForEachEntity(
Constants =
{
},
- },
+ }, -- TakeDamageInfo
Vector3d =
{
@@ -2363,7 +2418,7 @@ World:ForEachEntity(
Constants =
{
},
- },
+ }, -- Vector3d
Vector3f =
{
@@ -2375,7 +2430,7 @@ World:ForEachEntity(
Constants =
{
},
- },
+ }, -- Vector3f
Vector3i =
{
@@ -2387,7 +2442,8 @@ World:ForEachEntity(
Constants =
{
},
- },
+ }, -- Vector3i
+
Globals =
{
Desc = [[These functions are available directly, without a class instance. Any plugin cal call them at any time.]],
diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua
index 2db8b4b1b..a9cdf143b 100644
--- a/MCServer/Plugins/APIDump/main.lua
+++ b/MCServer/Plugins/APIDump/main.lua
@@ -499,6 +499,7 @@ function ReadDescriptions(a_API)
cls.Functions = DoxyFunctions;
else -- if (APIDesc.Functions ~= nil)
for j, func in ipairs(cls.Functions) do
+ local FnName = func.DocID or func.Name;
if not(IsFunctionIgnored(cls.Name .. "." .. FnName)) then
table.insert(cls.UndocumentedFunctions, FnName);
end
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index b895da05e..04a15a002 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -606,7 +606,7 @@ end
function HandleTestWndCmd(a_Split, a_Player)
- local WindowType = cWindow.Hopper;
+ local WindowType = cWindow.wtHopper;
local WindowSizeX = 5;
local WindowSizeY = 1;
if (#a_Split == 4) then
@@ -789,7 +789,7 @@ end
function HandleEnchCmd(a_Split, a_Player)
- local Wnd = cLuaWindow(cWindow.Enchantment, 1, 1, "Ench");
+ local Wnd = cLuaWindow(cWindow.wtEnchantment, 1, 1, "Ench");
a_Player:OpenWindow(Wnd);
Wnd:SetProperty(0, 10);
Wnd:SetProperty(1, 15);