summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/APIDump
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-30 13:44:03 +0200
committermadmaxoft <github@xoft.cz>2014-07-30 13:56:29 +0200
commit6476bd0e2ee7e128e3eaa56159f169f0a53736ff (patch)
treef98c5f99fc6155ea460b03791206bf0d6d16a332 /MCServer/Plugins/APIDump
parentAdded a cMojangAPI class for PlayerName -> UUID lookups, with cache. (diff)
downloadcuberite-6476bd0e2ee7e128e3eaa56159f169f0a53736ff.tar
cuberite-6476bd0e2ee7e128e3eaa56159f169f0a53736ff.tar.gz
cuberite-6476bd0e2ee7e128e3eaa56159f169f0a53736ff.tar.bz2
cuberite-6476bd0e2ee7e128e3eaa56159f169f0a53736ff.tar.lz
cuberite-6476bd0e2ee7e128e3eaa56159f169f0a53736ff.tar.xz
cuberite-6476bd0e2ee7e128e3eaa56159f169f0a53736ff.tar.zst
cuberite-6476bd0e2ee7e128e3eaa56159f169f0a53736ff.zip
Diffstat (limited to 'MCServer/Plugins/APIDump')
-rw-r--r--MCServer/Plugins/APIDump/APIDesc.lua27
1 files changed, 26 insertions, 1 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index f29c47338..e5114784e 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -529,7 +529,6 @@ end
GetPlayer = { Params = "", Return = "{{cPlayer|cPlayer}}", Notes = "Returns the player object connected to this client. Note that this may be nil, for example if the player object is not yet spawned." },
GetUniqueID = { Params = "", Return = "number", Notes = "Returns the UniqueID of the client used to identify the client in the server" },
GetUUID = { Params = "", Return = "string", Notes = "Returns the authentication-based UUID of the client. This UUID should be used to identify the player when persisting any player-related data." },
- GetUUIDsFromPlayerNames = { Params = "PlayerNames", Return = "table", Notes = "(STATIC) Returns a table that contains the map, 'PlayerName' -> 'UUID', for all valid playernames in the input array-table. PlayerNames not recognized will not be set in the returned map. Queries the Mojang servers for the results. <b>WARNING</b>: Do NOT use this function while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely. <b>NOTE</b>: Mojang API has a limit of 100 names per query and 600 queries per 10 minutes (may change)" },
GetUsername = { Params = "", Return = "string", Notes = "Returns the username that the client has provided" },
GetViewDistance = { Params = "", Return = "number", Notes = "Returns the viewdistance (number of chunks loaded for the player in each direction)" },
HasPluginChannel = { Params = "ChannelName", Return = "bool", Notes = "Returns true if the client has registered to receive messages on the specified plugin channel." },
@@ -1607,6 +1606,31 @@ a_Player:OpenWindow(Window);
}, -- cMapManager
+ cMojangAPI =
+ {
+ Desc = [[
+ Provides interface to various API functions that Mojang provides through their servers. Note that
+ some of these calls will wait for a response from the network, and so shouldn't be used while the
+ server is fully running (or at least when there are players connected) to avoid percepted lag.</p>
+ <p>
+ Some functions are static and do not require an instance to be called. For others, you need to get
+ the singleton instance of this class using {{cRoot}}'s GetMojangAPI() function.</p>
+ <p>
+ Mojang uses two formats for UUIDs, short and dashed. MCServer works with short UUIDs internally, but
+ will convert to dashed UUIDs where needed - in the protocol login for example. The MakeUUIDShort()
+ and MakeUUIDDashed() functions are provided for plugins to use for conversion between the two
+ formats.
+ ]],
+ Functions =
+ {
+ AddPlayerNameToUUIDMapping = { Params = "PlayerName, UUID", Return = "", Notes = "Adds the specified PlayerName-to-UUID mapping into the cache, with current timestamp." },
+ GetUUIDsFromPlayerNames = { Params = "PlayerNames", Return = "table", Notes = "Returns a table that contains the map, 'PlayerName' -> 'UUID', for all valid playernames in the input array-table. PlayerNames not recognized will not be set in the returned map. Queries the Mojang servers for the results. <b>WARNING</b>: Do NOT use this function while the server is running. Only use it when the server is starting up (inside the Initialize() method), otherwise you will lag the server severely." },
+ MakeUUIDDashed = { Params = "UUID", Return = "DashedUUID", Notes = "(STATIC) Converts the UUID to a dashed format (\"01234567-8901-2345-6789-012345678901\"). Accepts both dashed and short UUIDs. Logs a warning and returns an empty string if UUID format not recognized." },
+ MakeUUIDShort = { Params = "UUID", Return = "ShortUUID", Notes = "(STATIC) Converts the UUID to a short format (without dashes, \"01234567890123456789012345678901\"). Accepts both dashed and short UUIDs. Logs a warning and returns an empty string if UUID format not recognized." },
+ },
+
+ },
+
cMonster =
{
Desc = [[
@@ -2002,6 +2026,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
GetFurnaceFuelBurnTime = { Params = "{{cItem|Fuel}}", Return = "number", Notes = "(STATIC) Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel." },
GetFurnaceRecipe = { Params = "{{cItem|InItem}}", Return = "{{cItem|OutItem}}, NumTicks, {{cItem|InItem}}", Notes = "(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 MCServer supports smelting M items into N items and different smelting rates). If no recipe is found, returns no value." },
GetGroupManager = { Params = "", Return = "{{cGroupManager|cGroupManager}}", Notes = "Returns the cGroupManager object." },
+ GetMojangAPI = { Params = "", Return = "{{cMojangAPI}}", Notes = "Returns the {{cMojangAPI}} 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." },