summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/APIDump
diff options
context:
space:
mode:
authorx12xx12x <44411062+12xx12@users.noreply.github.com>2022-05-07 01:26:13 +0200
committerGitHub <noreply@github.com>2022-05-07 01:26:13 +0200
commit63b63c5d844e8702fce2ae0181ee4397b8954d92 (patch)
tree53bcb25743271beb6b5e51b2346847ed50c6f925 /Server/Plugins/APIDump
parentImplement ranged attack for snow golems. Fix failed assertion (#5417) (diff)
downloadcuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar
cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar.gz
cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar.bz2
cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar.lz
cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar.xz
cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar.zst
cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.zip
Diffstat (limited to 'Server/Plugins/APIDump')
-rw-r--r--Server/Plugins/APIDump/APIDesc.lua54
-rw-r--r--Server/Plugins/APIDump/Classes/Geometry.lua57
-rw-r--r--Server/Plugins/APIDump/Classes/Projectiles.lua10
-rw-r--r--Server/Plugins/APIDump/main_APIDump.lua62
4 files changed, 62 insertions, 121 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua
index 531e11ac1..227e4a6fa 100644
--- a/Server/Plugins/APIDump/APIDesc.lua
+++ b/Server/Plugins/APIDump/APIDesc.lua
@@ -908,16 +908,6 @@ return
},
Notes = "Returns true if the chunk is set to use default height generator",
},
- IsUsingDefaultStructures =
- {
- Returns =
- {
- {
- Type = "boolean",
- },
- },
- Notes = "Returns true if the chunk is set to use default structures",
- },
RandomFillRelCuboid =
{
{
@@ -1258,17 +1248,6 @@ return
},
Notes = "Sets the chunk to use default height generator or not",
},
- SetUseDefaultStructures =
- {
- Params =
- {
- {
- Name = "ShouldUseDefaultStructures",
- Type = "boolean",
- },
- },
- Notes = "Sets the chunk to use default structures or not",
- },
UpdateHeightmap =
{
Notes = "Updates the heightmap to match current contents. The plugins should do that if they modify the contents and don't modify the heightmap accordingly; Cuberite expects (and checks in Debug mode) that the heightmap matches the contents when the cChunkDesc is returned from a plugin.",
@@ -8707,10 +8686,6 @@ a_Player:OpenWindow(Window);
]],
Functions =
{
- EraseData =
- {
- Notes = "Erases all pixel data.",
- },
GetCenterX =
{
Returns =
@@ -8999,16 +8974,6 @@ a_Player:OpenWindow(Window);
},
Notes = "If a map with the specified ID exists, calls the CallbackFunction for that map. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cMap|Map}})</pre> Returns true if the map was found and the callback called, false if map not found.",
},
- GetNumMaps =
- {
- Returns =
- {
- {
- Type = "number",
- },
- },
- Notes = "Returns the number of registered maps.",
- },
},
},
cMojangAPI =
@@ -11442,17 +11407,6 @@ a_Player:OpenWindow(Window);
},
Notes = "Sets the dominant hand of the player.",
},
- SetName =
- {
- Params =
- {
- {
- Name = "Name",
- Type = "string",
- },
- },
- Notes = "Sets the player name. This rename will NOT be visible to any players already in the server who are close enough to see this player.",
- },
SetNormalMaxSpeed =
{
Params =
@@ -13227,14 +13181,6 @@ end
},
},
},
- cWebPlugin =
- {
- Desc = "",
- Functions =
- {
-
- },
- },
cWindow =
{
Desc = [[
diff --git a/Server/Plugins/APIDump/Classes/Geometry.lua b/Server/Plugins/APIDump/Classes/Geometry.lua
index 9d289632c..1fe9090ac 100644
--- a/Server/Plugins/APIDump/Classes/Geometry.lua
+++ b/Server/Plugins/APIDump/Classes/Geometry.lua
@@ -1192,10 +1192,6 @@ end
{
Notes = "Updates each coord to its absolute value.",
},
- abs =
- {
- Notes = "<b>OBSOLETE</b>, use Abs() instead.",
- },
addedX =
{
Params =
@@ -1293,21 +1289,6 @@ end
},
Notes = "Clamps each coord into the specified range.",
},
- clamp =
- {
- Params =
- {
- {
- Name = "min",
- Type = "number",
- },
- {
- Name = "max",
- Type = "number",
- },
- },
- Notes = "<b>OBSOLETE</b>, use Clamp() instead.",
- },
constructor =
{
{
@@ -1772,10 +1753,6 @@ end
{
Notes = "Updates each coord to its absolute value.",
},
- abs =
- {
- Notes = "<b>OBSOLETE</b>, use Abs() instead.",
- },
addedX =
{
Params =
@@ -1873,21 +1850,6 @@ end
},
Notes = "Clamps each coord into the specified range.",
},
- clamp =
- {
- Params =
- {
- {
- Name = "min",
- Type = "number",
- },
- {
- Name = "max",
- Type = "number",
- },
- },
- Notes = "<b>OBSOLETE</b>, use Clamp() instead.",
- },
constructor =
{
{
@@ -2384,10 +2346,6 @@ end
{
Notes = "Updates each coord to its absolute value.",
},
- abs =
- {
- Notes = "<b>OBSOLETE</b>, use Abs() instead.",
- },
addedX =
{
Params =
@@ -2485,21 +2443,6 @@ end
},
Notes = "Clamps each coord into the specified range.",
},
- clamp =
- {
- Params =
- {
- {
- Name = "min",
- Type = "number",
- },
- {
- Name = "max",
- Type = "number",
- },
- },
- Notes = "<b>OBSOLETE</b>, use Clamp() instead.",
- },
constructor =
{
{
diff --git a/Server/Plugins/APIDump/Classes/Projectiles.lua b/Server/Plugins/APIDump/Classes/Projectiles.lua
index f74b92136..b3bf7fbed 100644
--- a/Server/Plugins/APIDump/Classes/Projectiles.lua
+++ b/Server/Plugins/APIDump/Classes/Projectiles.lua
@@ -215,16 +215,6 @@ return
Desc = "Base class for all projectiles, such as arrows and fireballs.",
Functions =
{
- GetCreator =
- {
- Returns =
- {
- {
- Type = "cEntity",
- },
- },
- Notes = "Returns the entity who created this projectile. May return nil.",
- },
GetCreatorName =
{
Returns =
diff --git a/Server/Plugins/APIDump/main_APIDump.lua b/Server/Plugins/APIDump/main_APIDump.lua
index b1277ca0b..735a6ec05 100644
--- a/Server/Plugins/APIDump/main_APIDump.lua
+++ b/Server/Plugins/APIDump/main_APIDump.lua
@@ -2041,6 +2041,56 @@ end
+--- Checks if any functions that are documented are present in the API
+-- Returns an array-table of strings representing the unexported symbol names
+-- If no unexported are found, returns no value.
+-- If an error occurs, returns true and error message.
+local function CheckUnexportedFunctions()
+ local res = {}
+
+ local API, Globals, Desc = PrepareApi()
+ for clsname, cls in pairs(Desc.Classes) do
+ if not(cls.IsExported) then
+ -- The whole class is not exported
+ table.insert(res, "class\t" .. clsname .. "\n");
+ else
+ if (cls.Functions ~= nil) then
+ for fnname, fnapi in pairs(cls.Functions) do
+ if not(fnapi.IsExported) then
+ table.insert(res, "func\t" .. clsname .. "." .. fnname);
+ end
+ end -- for j, fn - cls.Functions[]
+ end
+ if (cls.Constants ~= nil) then
+ for cnname, cnapi in pairs(cls.Constants) do
+ if not(cnapi.IsExported) then
+ table.insert(res, "const\t" .. clsname .. "." .. cnname);
+ end
+ end -- for j, fn - cls.Functions[]
+ end
+ end
+ end -- for i, cls - a_APIDesc.Classes[]
+
+ table.sort(res)
+
+ -- Bail out if no items found:
+ if not(res[1]) then
+ return
+ end
+
+ -- Save any found items to a file:
+ local f = io.open("Unexported.lua", "w")
+ f:write(table.concat(res, "\n"))
+ f:write("\n")
+ f:close()
+
+ return res
+end
+
+
+
+
+
local function HandleWebAdminDump(a_Request)
if (a_Request.PostParams["Dump"] ~= nil) then
@@ -2101,6 +2151,18 @@ local function HandleCmdApiCheck(a_Split, a_EntireCmd)
end
end
+ LOG("Checking for unexported Objects...")
+ local unexported, msg = CheckUnexportedFunctions()
+ if (unexported) then
+ if (unexported == true) then
+ LOGERROR("Cannot check for unexported symbols: " .. (msg or "<no message>"))
+ return true
+ else
+ LOGERROR("Found unexported symbols:\n" .. table.concat(unexported, "\n"))
+ return true
+ end
+ end
+
-- The check completed successfully, remove the "test failed" flag from the filesystem:
cFile:DeleteFile("apiCheckFailed.flag")