From 1acd03f96f9b1133e1f76d76004f5fcddd0c4788 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 28 Jul 2014 17:09:39 +0200 Subject: Added cClientHandle:GetUUIDsFromPlayerNames() to Lua API. --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index e65da1d16..f29c47338 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -529,6 +529,7 @@ 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. WARNING: 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. NOTE: 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." }, -- cgit v1.2.3 From b6677efecdd026a7eb8d652a067e4770182cd7c1 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 28 Jul 2014 17:14:23 +0200 Subject: Debuggers: Added an example for cClientHandle:GetUUIDsFromPlayerNames(). --- MCServer/Plugins/Debuggers/Debuggers.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index b402c1867..80416acc7 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -80,6 +80,7 @@ function Initialize(Plugin) TestBlockAreasString() TestStringBase64() + TestUUIDFromName() --[[ -- Test cCompositeChat usage in console-logging: @@ -275,6 +276,36 @@ end +function TestUUIDFromName() + LOG("Testing UUID-from-Name resolution...") + + -- Test by querying a few existing names, along with a non-existent one: + local PlayerNames = + { + "xoft", + "aloe_vera", + "nonexistent_player", + } + -- WARNING: Blocking operation! DO NOT USE IN TICK THREAD! + local UUIDs = cClientHandle:GetUUIDsFromPlayerNames(PlayerNames) + + -- Log the results: + for _, name in ipairs(PlayerNames) do + local UUID = UUIDs[name] + if (UUID == nil) then + LOG(" UUID(" .. name .. ") not found.") + else + LOG(" UUID(" .. name .. ") = \"" .. UUID .. "\"") + end + end + + LOG("UUID-from-Name resolution test finished.") +end + + + + + function TestSQLiteBindings() LOG("Testing SQLite bindings..."); -- cgit v1.2.3 From 6476bd0e2ee7e128e3eaa56159f169f0a53736ff Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 30 Jul 2014 13:44:03 +0200 Subject: Exported cMojangAPI to Lua. --- MCServer/Plugins/APIDump/APIDesc.lua | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'MCServer/Plugins') 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. WARNING: 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. NOTE: 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.

+

+ 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.

+

+ 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. WARNING: 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." }, -- cgit v1.2.3 From afef7a79d7a214eec66e427da589172a40a18fef Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 30 Jul 2014 13:53:23 +0200 Subject: Debuggers: Updated for the new cMojangAPI changes. --- MCServer/Plugins/Debuggers/Debuggers.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 80416acc7..575d696cb 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -287,7 +287,7 @@ function TestUUIDFromName() "nonexistent_player", } -- WARNING: Blocking operation! DO NOT USE IN TICK THREAD! - local UUIDs = cClientHandle:GetUUIDsFromPlayerNames(PlayerNames) + local UUIDs = cMojangAPI:GetUUIDsFromPlayerNames(PlayerNames) -- Log the results: for _, name in ipairs(PlayerNames) do @@ -299,6 +299,15 @@ function TestUUIDFromName() end end + -- Test once more with the same players, valid-only. This should go directly from cache, so fast. + LOG("Testing again with the same valid players...") + local ValidPlayerNames = + { + "xoft", + "aloe_vera", + } + UUIDs = cMojangAPI:GetUUIDsFromPlayerNames(ValidPlayerNames); + LOG("UUID-from-Name resolution test finished.") end -- cgit v1.2.3 From 1793644feff66b076980c669ede94d7b03eceafe Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 30 Jul 2014 14:02:36 +0200 Subject: APIDump: Fixed UUID-related documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index e5114784e..692ca80ac 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -523,12 +523,12 @@ end Functions = { - GenerateOfflineUUID = { Params = "Username", Return = "string", Notes = "(STATIC) Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. Returns a 36-char UUID (with dashes)." }, + GenerateOfflineUUID = { Params = "Username", Return = "string", Notes = "(STATIC) Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. Returns a 32-char UUID (no dashes)." }, GetLocale = { Params = "", Return = "Locale", Notes = "Returns the locale string that the client sends as part of the protocol handshake. Can be used to provide localized strings." }, GetPing = { Params = "", Return = "number", Notes = "Returns the ping time, in ms" }, 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." }, + 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. Returns a 32-char UUID (no dashes)" }, 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." }, -- cgit v1.2.3 From a71c2da3f8ee329977902a36274d720908a77c48 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 30 Jul 2014 17:07:57 +0200 Subject: APIDump: Added notes about cache to cMojangAPI. --- MCServer/Plugins/APIDump/APIDesc.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 692ca80ac..2a8ae90f9 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1619,7 +1619,13 @@ a_Player:OpenWindow(Window); 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. + formats.

+

+ This class will cache values returned by the API service. The cache will hold the values for 7 days + by default, after that, they will no longer be available. This is in order to not let the server get + banned from using the API service, since they are rate-limited to 600 queries per 10 minutes. The + cache contents also gets updated whenever a player successfully joins, since that makes the server + contact the API service, too, and retrieve the relevant data.

]], Functions = { -- cgit v1.2.3 From 66d34b83d27a72ed4cc2598527c25dfb8c1a873c Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 30 Jul 2014 22:31:43 +0200 Subject: Added beacon documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + MCServer/Plugins/APIDump/Classes/BlockEntities.lua | 26 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index e65da1d16..2a592e1e1 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2244,6 +2244,7 @@ end DigBlock = { Params = "X, Y, Z", Return = "", Notes = "Replaces the specified block with air, without dropping the usual pickups for the block. Wakes up the simulators for the block and its neighbors." }, DoExplosionAt = { Params = "Force, X, Y, Z, CanCauseFire, Source, SourceData", Return = "", Notes = "Creates an explosion of the specified relative force in the specified position. If CanCauseFire is set, the explosion will set blocks on fire, too. The Source parameter specifies the source of the explosion, one of the esXXX constants. The SourceData parameter is specific to each source type, usually it provides more info about the source." }, DoWithBlockEntityAt = { Params = "X, Y, Z, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If there is a block entity at the specified coords, calls the CallbackFunction with the {{cBlockEntity}} parameter representing the block entity. The CallbackFunction has the following signature:
function Callback({{cBlockEntity|BlockEntity}}, [CallbackData])
The function returns false if there is no block entity, or if there is, it returns the bool value that the callback has returned. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." }, + DoWithBeaconAt = { Params = "X, Y, Z, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If there is a beacon at the specified coords, calls the CallbackFunction with the {{cBeaconEntity}} parameter representing the beacon. The CallbackFunction has the following signature:
function Callback({{cBeaconEntity|BeaconEntity}}, [CallbackData])
The function returns false if there is no beacon, or if there is, it returns the bool value that the callback has returned." }, DoWithChestAt = { Params = "X, Y, Z, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If there is a chest at the specified coords, calls the CallbackFunction with the {{cChestEntity}} parameter representing the chest. The CallbackFunction has the following signature:
function Callback({{cChestEntity|ChestEntity}}, [CallbackData])
The function returns false if there is no chest, or if there is, it returns the bool value that the callback has returned." }, DoWithCommandBlockAt = { Params = "X, Y, Z, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If there is a command block at the specified coords, calls the CallbackFunction with the {{cCommandBlockEntity}} parameter representing the command block. The CallbackFunction has the following signature:
function Callback({{cCommandBlockEntity|CommandBlockEntity}}, [CallbackData])
The function returns false if there is no command block, or if there is, it returns the bool value that the callback has returned." }, DoWithDispenserAt = { Params = "X, Y, Z, CallbackFunction, [CallbackData]", Return = "bool", Notes = "If there is a dispenser at the specified coords, calls the CallbackFunction with the {{cDispenserEntity}} parameter representing the dispenser. The CallbackFunction has the following signature:
function Callback({{cDispenserEntity|DispenserEntity}}, [CallbackData])
The function returns false if there is no dispenser, or if there is, it returns the bool value that the callback has returned." }, diff --git a/MCServer/Plugins/APIDump/Classes/BlockEntities.lua b/MCServer/Plugins/APIDump/Classes/BlockEntities.lua index de42f66df..294d47295 100644 --- a/MCServer/Plugins/APIDump/Classes/BlockEntities.lua +++ b/MCServer/Plugins/APIDump/Classes/BlockEntities.lua @@ -50,6 +50,32 @@ return }, }, + cBeaconEntity = + { + Desc = [[ + A beacon entity is a {{cBlockEntityWithItems|cBlockEntityWithItems}} descendant that represents a beacon + in the world. + ]], + + Inherits = "cBlockEntityWithItems", + + Functions = + { + IsActive = { Params = "", Return = "bool", Notes = "Is the beacon active?" }, + GetBeaconLevel = { Params = "", Return = "number", Notes = "Returns the beacon level. (0 - 4)" }, + GetPrimaryPotion = { Params = "", Return = "EffectType", Notes = "Returns the primary potion." }, + GetSecondaryPotion = { Params = "", Return = "EffectType", Notes = "Returns the secondary potion." }, + SelectPrimaryPotion = { Params = "EffectType", Return = "bool", Notes = "Select the primary potion. Returns false when the potion is invalid." }, + SelectSecondaryPotion = { Params = "EffectType", Return = "bool", Notes = "Select the secondary potion. Returns false when the potion is invalid." }, + CalculatePyramidLevel = { Params = "", Return = "number", Notes = "Calculate the amount of layers the pyramid below the beacon has." }, + IsBeaconBlocked = { Params = "", Return = "bool", Notes = "Is the beacon blocked by non-transparent blocks that are higher than the beacon?" }, + UpdateBeacon = { Params = "", Return = "", Notes = "Update the beacon." }, + GiveEffects = { Params = "", Return = "", Notes = "Give the near-players the effects." }, + IsMineralBlock = { Params = "BLOCKTYPE", Return = "bool", Notes = "Returns true if the block is a diamond block, a golden block, an iron block or an emerald block." }, + IsValidPotion = { Params = "EffectType", Return = "bool", Notes = "Returns true if the potion can be used." }, + }, + }, + cChestEntity = { Desc = [[ -- cgit v1.2.3 From 8b519bf6e20a987c9544ef11f0df6467831cc069 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 31 Jul 2014 10:02:50 +0200 Subject: MojangAPI: Added a UseCachedOnly param to GetUUIDsFromPlayerNames(). --- MCServer/Plugins/APIDump/APIDesc.lua | 2 +- MCServer/Plugins/Debuggers/Debuggers.lua | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 2a8ae90f9..9d0e90999 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1630,7 +1630,7 @@ a_Player:OpenWindow(Window); 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. WARNING: 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." }, + GetUUIDsFromPlayerNames = { Params = "PlayerNames, [UseOnlyCached]", 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. If UseOnlyCached is false (the default), queries the Mojang servers for the results that are not in the cache.
WARNING: Do NOT use this function with UseOnlyCached set to false 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." }, }, diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 575d696cb..075cfa40c 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -307,8 +307,38 @@ function TestUUIDFromName() "aloe_vera", } UUIDs = cMojangAPI:GetUUIDsFromPlayerNames(ValidPlayerNames); + + -- Log the results: + for _, name in ipairs(ValidPlayerNames) do + local UUID = UUIDs[name] + if (UUID == nil) then + LOG(" UUID(" .. name .. ") not found.") + else + LOG(" UUID(" .. name .. ") = \"" .. UUID .. "\"") + end + end + + -- Test yet again, cache-only: + LOG("Testing once more, cache only...") + local PlayerNames3 = + { + "xoft", + "aloe_vera", + "notch", -- Valid player name, but not cached (most likely :) + } + UUIDs = cMojangAPI:GetUUIDsFromPlayerNames(PlayerNames3, true) - LOG("UUID-from-Name resolution test finished.") + -- Log the results: + for _, name in ipairs(PlayerNames3) do + local UUID = UUIDs[name] + if (UUID == nil) then + LOG(" UUID(" .. name .. ") not found.") + else + LOG(" UUID(" .. name .. ") = \"" .. UUID .. "\"") + end + end + + LOG("UUID-from-Name resolution tests finished.") end -- cgit v1.2.3 From c49d4fd215170da29b5c285cc6a344ec102764c6 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 31 Jul 2014 12:15:18 +0200 Subject: Updated documentation. --- MCServer/Plugins/APIDump/Classes/BlockEntities.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Classes/BlockEntities.lua b/MCServer/Plugins/APIDump/Classes/BlockEntities.lua index 294d47295..524087a8e 100644 --- a/MCServer/Plugins/APIDump/Classes/BlockEntities.lua +++ b/MCServer/Plugins/APIDump/Classes/BlockEntities.lua @@ -63,16 +63,16 @@ return { IsActive = { Params = "", Return = "bool", Notes = "Is the beacon active?" }, GetBeaconLevel = { Params = "", Return = "number", Notes = "Returns the beacon level. (0 - 4)" }, - GetPrimaryPotion = { Params = "", Return = "EffectType", Notes = "Returns the primary potion." }, - GetSecondaryPotion = { Params = "", Return = "EffectType", Notes = "Returns the secondary potion." }, - SelectPrimaryPotion = { Params = "EffectType", Return = "bool", Notes = "Select the primary potion. Returns false when the potion is invalid." }, - SelectSecondaryPotion = { Params = "EffectType", Return = "bool", Notes = "Select the secondary potion. Returns false when the potion is invalid." }, + GetPrimaryEffect = { Params = "", Return = "EffectType", Notes = "Returns the primary potion." }, + GetSecondaryEffect = { Params = "", Return = "EffectType", Notes = "Returns the secondary potion." }, + SelectPrimaryEffect = { Params = "EffectType", Return = "bool", Notes = "Select the primary effect. Returns false when the effect is invalid." }, + SelectSecondaryEffect = { Params = "EffectType", Return = "bool", Notes = "Select the secondary effect. Returns false when the effect is invalid." }, CalculatePyramidLevel = { Params = "", Return = "number", Notes = "Calculate the amount of layers the pyramid below the beacon has." }, IsBeaconBlocked = { Params = "", Return = "bool", Notes = "Is the beacon blocked by non-transparent blocks that are higher than the beacon?" }, UpdateBeacon = { Params = "", Return = "", Notes = "Update the beacon." }, GiveEffects = { Params = "", Return = "", Notes = "Give the near-players the effects." }, IsMineralBlock = { Params = "BLOCKTYPE", Return = "bool", Notes = "Returns true if the block is a diamond block, a golden block, an iron block or an emerald block." }, - IsValidPotion = { Params = "EffectType", Return = "bool", Notes = "Returns true if the potion can be used." }, + IsValidEffect = { Params = "EffectType", Return = "bool", Notes = "Returns true if the effect can be used." }, }, }, -- cgit v1.2.3 From c138d19c31ee85a38fe758bc2c69591bcfe42230 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 31 Jul 2014 18:16:52 +0200 Subject: Updated documentation again. --- MCServer/Plugins/APIDump/Classes/BlockEntities.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Classes/BlockEntities.lua b/MCServer/Plugins/APIDump/Classes/BlockEntities.lua index 524087a8e..90ebf12e6 100644 --- a/MCServer/Plugins/APIDump/Classes/BlockEntities.lua +++ b/MCServer/Plugins/APIDump/Classes/BlockEntities.lua @@ -63,10 +63,10 @@ return { IsActive = { Params = "", Return = "bool", Notes = "Is the beacon active?" }, GetBeaconLevel = { Params = "", Return = "number", Notes = "Returns the beacon level. (0 - 4)" }, - GetPrimaryEffect = { Params = "", Return = "EffectType", Notes = "Returns the primary potion." }, - GetSecondaryEffect = { Params = "", Return = "EffectType", Notes = "Returns the secondary potion." }, - SelectPrimaryEffect = { Params = "EffectType", Return = "bool", Notes = "Select the primary effect. Returns false when the effect is invalid." }, - SelectSecondaryEffect = { Params = "EffectType", Return = "bool", Notes = "Select the secondary effect. Returns false when the effect is invalid." }, + GetPrimaryEffect = { Params = "", Return = "EffectType", Notes = "Returns the primary effect." }, + GetSecondaryEffect = { Params = "", Return = "EffectType", Notes = "Returns the secondary effect." }, + SetPrimaryEffect = { Params = "EffectType", Return = "bool", Notes = "Select the primary effect. Returns false when the effect is invalid." }, + SetSecondaryEffect = { Params = "EffectType", Return = "bool", Notes = "Select the secondary effect. Returns false when the effect is invalid." }, CalculatePyramidLevel = { Params = "", Return = "number", Notes = "Calculate the amount of layers the pyramid below the beacon has." }, IsBeaconBlocked = { Params = "", Return = "bool", Notes = "Is the beacon blocked by non-transparent blocks that are higher than the beacon?" }, UpdateBeacon = { Params = "", Return = "", Notes = "Update the beacon." }, -- cgit v1.2.3 From 003f18bd0f7593bddf5c6af89e3f6fc13632300d Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 3 Aug 2014 12:12:28 +0200 Subject: Added cMojangAPI:GetUUIDFromPlayerName(). This is a simpler way to ask for a single name -> uuid conversion. --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 1fa2608b3..4f8567530 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1630,6 +1630,7 @@ a_Player:OpenWindow(Window); Functions = { AddPlayerNameToUUIDMapping = { Params = "PlayerName, UUID", Return = "", Notes = "Adds the specified PlayerName-to-UUID mapping into the cache, with current timestamp." }, + GetUUIDFromPlayerName = { Params = "PlayerName, [UseOnlyCached]", Return = "UUID", Notes = "Returns the UUID that corresponds to the given playername, or an empty string on error. If UseOnlyCached is false (the default), queries the Mojang servers if the playername is not in the cache.
WARNING: Do NOT use this function with UseOnlyCached set to false 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." }, GetUUIDsFromPlayerNames = { Params = "PlayerNames, [UseOnlyCached]", 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. If UseOnlyCached is false (the default), queries the Mojang servers for the results that are not in the cache.
WARNING: Do NOT use this function with UseOnlyCached set to false 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." }, -- cgit v1.2.3 From 21f52676f3848d58ff1e4eb511c691d4a4ed824b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 3 Aug 2014 21:32:20 +0200 Subject: cMojangAPI: Added UUID-to-Name lookup. Also fixed the bindings, now all functions are static-like. --- MCServer/Plugins/APIDump/APIDesc.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 4f8567530..ad3b24ca5 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1613,8 +1613,7 @@ a_Player:OpenWindow(Window); 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.

- 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.

+ All the functions are static, call them using the cMojangAPI:Function() convention.

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() @@ -1629,11 +1628,12 @@ a_Player:OpenWindow(Window); ]], Functions = { - AddPlayerNameToUUIDMapping = { Params = "PlayerName, UUID", Return = "", Notes = "Adds the specified PlayerName-to-UUID mapping into the cache, with current timestamp." }, - GetUUIDFromPlayerName = { Params = "PlayerName, [UseOnlyCached]", Return = "UUID", Notes = "Returns the UUID that corresponds to the given playername, or an empty string on error. If UseOnlyCached is false (the default), queries the Mojang servers if the playername is not in the cache.
WARNING: Do NOT use this function with UseOnlyCached set to false 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." }, - GetUUIDsFromPlayerNames = { Params = "PlayerNames, [UseOnlyCached]", 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. If UseOnlyCached is false (the default), queries the Mojang servers for the results that are not in the cache.
WARNING: Do NOT use this function with UseOnlyCached set to false 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." }, + AddPlayerNameToUUIDMapping = { Params = "PlayerName, UUID", Return = "", Notes = "(STATIC) Adds the specified PlayerName-to-UUID mapping into the cache, with current timestamp. Accepts both short or dashed UUIDs. " }, + GetPlayerNameFromUUID = { Params = "UUID, [UseOnlyCached]", Return = "PlayerName", Notes = "(STATIC) Returns the playername that corresponds to the given UUID, or an empty string on error. If UseOnlyCached is false (the default), queries the Mojang servers if the UUID is not in the cache. The UUID can be either short or dashed.
WARNING: Do NOT use this function with UseOnlyCached set to false 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." }, + GetUUIDFromPlayerName = { Params = "PlayerName, [UseOnlyCached]", Return = "UUID", Notes = "(STATIC) Returns the (short) UUID that corresponds to the given playername, or an empty string on error. If UseOnlyCached is false (the default), queries the Mojang servers if the playername is not in the cache.
WARNING: Do NOT use this function with UseOnlyCached set to false 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." }, + GetUUIDsFromPlayerNames = { Params = "PlayerNames, [UseOnlyCached]", Return = "table", Notes = "(STATIC) Returns a table that contains the map, 'PlayerName' -> '(short) UUID', for all valid playernames in the input array-table. PlayerNames not recognized will not be set in the returned map. If UseOnlyCached is false (the default), queries the Mojang servers for the results that are not in the cache.
WARNING: Do NOT use this function with UseOnlyCached set to false 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 or 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 or short UUIDs. Logs a warning and returns an empty string if UUID format not recognized." }, }, }, @@ -2017,7 +2017,6 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); ]], Functions = { - 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. No formatting is done by the server." }, BroadcastChatFailure = { Params = "Message", Return = "", Notes = "Prepends Rose [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For a command that failed to run because of insufficient permissions, etc." }, BroadcastChatFatal = { Params = "Message", Return = "", Notes = "Prepends Red [FATAL] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For a plugin that crashed, or similar." }, @@ -2028,12 +2027,12 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "", Notes = "Calls the given callback function for all players with names partially (or fully) matching the name string provided." }, ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature:

function Callback({{cPlayer|cPlayer}})
" }, ForEachWorld = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each world. The callback function has the following signature:
function Callback({{cWorld|cWorld}})
" }, + Get = { Params = "", Return = "Root object", Notes = "(STATIC)This function returns the cRoot object." }, GetCraftingRecipes = { Params = "", Return = "{{cCraftingRecipe|cCraftingRecipe}}", Notes = "Returns the CraftingRecipes object" }, GetDefaultWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world object from the default world." }, 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." }, -- cgit v1.2.3 From f5aaf52210369862a045c074429428012607c445 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 3 Aug 2014 21:32:53 +0200 Subject: Debuggers: Added a Name-from-UUID cMojangAPI test. --- MCServer/Plugins/Debuggers/Debuggers.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 075cfa40c..7e220952e 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -339,6 +339,13 @@ function TestUUIDFromName() end LOG("UUID-from-Name resolution tests finished.") + + LOG("Performing a Name-from-UUID test...") + -- local NameToTest = "aloe_vera" + local NameToTest = "xoft" + local Name = cMojangAPI:GetPlayerNameFromUUID(UUIDs[NameToTest]) + LOG("Name(" .. UUIDs[NameToTest] .. ") = '" .. Name .. "', expected '" .. NameToTest .. "'.") + LOG("Name-from-UUID test finished.") end -- cgit v1.2.3 From 01e9d6311a4c27af044e8c9be3c67000124321e9 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 4 Aug 2014 14:24:46 +0100 Subject: Updated submodules --- MCServer/Plugins/Core | 2 +- MCServer/Plugins/ProtectionAreas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 3790f78d3..1b16c23c2 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 3790f78d3f7503ff33a423b8e73e81a275562783 +Subproject commit 1b16c23c216d359e9fe0334c63deeecc347e69bd diff --git a/MCServer/Plugins/ProtectionAreas b/MCServer/Plugins/ProtectionAreas index 9edfee930..7765048fa 160000 --- a/MCServer/Plugins/ProtectionAreas +++ b/MCServer/Plugins/ProtectionAreas @@ -1 +1 @@ -Subproject commit 9edfee93048f214175cbed7eb2a3f77f7ac4abb2 +Subproject commit 7765048fa740b8f119db72a4ccc546504f86b2ab -- cgit v1.2.3 From 43de9af8786243c90832b78f8c19ec92fb218392 Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 5 Aug 2014 13:54:04 +0200 Subject: Added api documentation for Clamp() --- MCServer/Plugins/APIDump/APIDesc.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index ad3b24ca5..64ba80c5f 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2760,15 +2760,16 @@ end Functions = { AddFaceDirection = {Params = "BlockX, BlockY, BlockZ, BlockFace, [IsInverse]", Return = "BlockX, BlockY, BlockZ", Notes = "Returns the coords of a block adjacent to the specified block through the specified {{Globals#BlockFaces|face}}"}, - BlockFaceToString = { Params = "{{Globals#BlockFaces|eBlockFace}}", Return = "string", Notes = "Returns the string representation of the {{Globals#BlockFaces|eBlockFace}} constant. Uses the axis-direction-based names, such as BLOCK_FACE_XP." }, + BlockFaceToString = {Params = "{{Globals#BlockFaces|eBlockFace}}", Return = "string", Notes = "Returns the string representation of the {{Globals#BlockFaces|eBlockFace}} constant. Uses the axis-direction-based names, such as BLOCK_FACE_XP." }, BlockStringToType = {Params = "BlockTypeString", Return = "BLOCKTYPE", Notes = "Returns the block type parsed from the given string"}, + Clamp = {Params = "Number, Min, Max", Return = "number", Notes = "Clamp the number to the specified range."}, ClickActionToString = {Params = "{{Globals#ClickAction|ClickAction}}", Return = "string", Notes = "Returns a string description of the ClickAction enumerated value"}, DamageTypeToString = {Params = "{{Globals#DamageType|DamageType}}", Return = "string", Notes = "Converts the {{Globals#DamageType|DamageType}} enumerated value to a string representation "}, EscapeString = {Params = "string", Return = "string", Notes = "Returns a copy of the string with all quotes and backslashes escaped by a backslash"}, GetChar = {Params = "String, Pos", Return = "string", Notes = "Returns one character from the string, specified by position "}, GetIniItemSet = { Params = "IniFile, SectionName, KeyName, DefaultValue", Return = "{{cItem}}", Notes = "Returns the item that has been read from the specified INI file value. If the value is not present in the INI file, the DefaultValue is stored in the file and parsed as the result. Returns empty item if the value cannot be parsed. " }, GetTime = {Return = "number", Notes = "Returns the current OS time, as a unix time stamp (number of seconds since Jan 1, 1970)"}, - IsBiomeNoDownfall = { Params = "Biome", Return = "bool", Notes = "Returns true if the biome is 'dry', that is, there is no precipitation during rains and storms." }, + IsBiomeNoDownfall = {Params = "Biome", Return = "bool", Notes = "Returns true if the biome is 'dry', that is, there is no precipitation during rains and storms." }, IsValidBlock = {Params = "BlockType", Return = "bool", Notes = "Returns true if BlockType is a known block type"}, IsValidItem = {Params = "ItemType", Return = "bool", Notes = "Returns true if ItemType is a known item type"}, ItemToFullString = {Params = "{{cItem|cItem}}", Return = "string", Notes = "Returns the string representation of the item, in the format 'ItemTypeText:ItemDamage * Count'"}, -- cgit v1.2.3 From 251f0d5b97bc36fa3c335bf6a1b03aa22503fa47 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 8 Aug 2014 23:13:43 +0200 Subject: Debuggers: Simple cRankManager test case. --- MCServer/Plugins/Debuggers/Debuggers.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 7e220952e..a87511fb9 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -81,6 +81,7 @@ function Initialize(Plugin) TestBlockAreasString() TestStringBase64() TestUUIDFromName() + TestRankMgr() --[[ -- Test cCompositeChat usage in console-logging: @@ -352,6 +353,18 @@ end +function TestRankMgr() + LOG("Testing the rank manager") + cRankManager:AddRank("LuaRank") + cRankManager:AddGroup("LuaTestGroup") + cRankManager:AddGroupToRank("LuaTestGroup", "LuaRank") + cRankManager:AddPermissionToGroup("luaperm", "LuaTestGroup") +end + + + + + function TestSQLiteBindings() LOG("Testing SQLite bindings..."); -- cgit v1.2.3 From af202c2363131d343d38a1f04850cfd711aef61e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 9 Aug 2014 22:55:38 +0200 Subject: Debuggers: Disabled UUID and RankMgr tests. --- MCServer/Plugins/Debuggers/Debuggers.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index a87511fb9..81cf02f3c 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -80,8 +80,8 @@ function Initialize(Plugin) TestBlockAreasString() TestStringBase64() - TestUUIDFromName() - TestRankMgr() + -- TestUUIDFromName() + -- TestRankMgr() --[[ -- Test cCompositeChat usage in console-logging: -- cgit v1.2.3 From 6c8baf66c81e043710e70d8de584ab93d1cbbfc8 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 16 Aug 2014 18:49:24 +0200 Subject: Updated HOOK_PLAYER_MOVING documentation. --- MCServer/Plugins/APIDump/Hooks/OnPlayerMoving.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Hooks/OnPlayerMoving.lua b/MCServer/Plugins/APIDump/Hooks/OnPlayerMoving.lua index 2756529ef..4385bf94d 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnPlayerMoving.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnPlayerMoving.lua @@ -11,9 +11,11 @@ return Params = { { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who has moved. The object already has the new position stored in it." }, + { Name = "OldPosition", Type = "{{Vector3d}}", Notes = "The old position." }, + { Name = "NewPosition", Type = "{{Vector3d}}", Notes = "The new position." }, }, Returns = [[ - If the function returns true, movement is prohibited. FIXME: The player's client is not informed.

+ If the function returns true, movement is prohibited.

If the function returns false or no value, other plugins' callbacks are called and finally the new position is permanently stored in the cPlayer object.

-- cgit v1.2.3 From 9f8eee578cf2834de8221cecb2c753a06a912739 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 20 Aug 2014 19:09:45 +0200 Subject: APIDump: Added cRankManager documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 64ba80c5f..ce3303087 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2004,6 +2004,62 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); }, }, -- cPluginManager + cRankManager = + { + Desc = [[ + Manages the players' permissions. The players are assigned a single rank, which contains groups of + permissions. The functions in this class query or modify these.

+

+ All the functions are static, call them using the cRankManager:Function() convention.

+

+ The players are identified by their UUID, to support player renaming.

+

+ The rank also contains specific "mesage visuals" - bits that are used for formatting messages from the + players. There's a message prefix, which is put in front of every message the player sends, and the + message suffix that is appended to each message. There's also a PlayerNameColorCode, which holds the + color that is used for the player's name in the messages.

+

+ Each rank can contain any number of permission groups. These groups allow for an easier setup of the + permissions - you can share groups among ranks, so the usual approach is to group similar permissions + together and add that group to any rank that should use those permissions.

+

+ Permissions are added to individual groups. Each group can support unlimited permissions. Note that + adding a permission to a group will make the permission available to all the ranks that contain that + permission group. + ]], + Functions = + { + AddGroup = { Params = "GroupName", Return = "", Notes = "Adds the group of the specified name. Logs a warning and does nothing if the group already exists." }, + AddGroupToRank = { Params = "GroupName, RankName", Return = "bool", Notes = "Adds the specified group to the specified rank. Returns true on success, false on failure - if the group name or the rank name is not found." }, + AddPermissionToGroup = { Params = "Permission, GroupName", Return = "bool", Notes = "Adds the specified permission to the specified group. Returns true on success, false on failure - if the group name is not found." }, + AddRank = { Params = "RankName, MsgPrefix, MsgSuffix, MsgNameColorCode", Return = "", Notes = "Adds a new rank of the specified name and with the specified message visuals. Logs an info message and does nothing if the rank already exists." }, + GetAllGroups = { Params = "", Return = "array-table of groups' names", Notes = "Returns an array-table containing the names of all the groups that are known to the manager." }, + GetAllPermissions = { Params = "", Return = "array-table of permissions", Notes = "Returns an array-table containing all the permissions that are known to the manager." }, + GetAllRanks = { Params = "", Return = "array-table of ranks' names", Notes = "Returns an array-table containing the names of all the ranks that are known to the manager." }, + GetGroupPermissions = { Params = "GroupName", Return = "array-table of permissions", Notes = "Returns an array-table containing the permissions that the specified group contains." }, + GetPlayerGroups = { Params = "PlayerUUID", Return = "array-table of groups' names", Notes = "Returns an array-table of the names of the groups that are assigned to the specified player through their rank. Returns an empty table if the player is not known or has no rank or groups assigned to them." }, + GetPlayerMsgVisuals = { Params = "PlayerUUID", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals assigned to the player. If the player is not known or has no rank assigned, doesn't return any value." }, + GetPlayerPermissions = { Params = "PlayerUUID", Return = "array-table of permissions", Notes = "Returns the permissions that the specified player is assigned through their rank. Returns an empty table if the player is not known." }, + GetPlayerRankName = { Params = "PlayerUUID", Return = "RankName", Notes = "Returns the name of the rank that is assigned to the specified player. An empty string is returned if the player has no rank assigned to them." }, + GetRankGroups = { Params = "RankName", Return = "array-table of groups' names", Notes = "Returns an array-table of the names of all the groups that are assigned to the specified rank. Returns an empty table if there is no such rank." }, + GetRankPermissions = { Params = "RankName", Return = "array-table of permissions", Notes = "Returns an array-table of all the permissions that are assigned to the specified rank through its groups. Returns an empty table if there is no such rank." }, + GetRankVisuals = { Params = "RankName", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals for the specified rank. Returns no value if the specified rank does not exist." }, + GroupExists = { Params = "GroupName", Return = "bool", Notes = "Returns true iff the specified group exists." }, + IsGroupInRank = { Params = "GroupName, RankName", Return = "bool", Notes = "Returns true iff the specified group is assigned to the specified rank." }, + IsPermissionInGroup = { Params = "Permission, GroupName", Return = "bool", Notes = "Returns true iff the specified permission is assigned to the specified group." }, + IsPlayerRankSet = { Params = "PlayerUUID", Return = "bool", Notes = "Returns true iff the specified player has a rank assigned to them." }, + RankExists = { Params = "RankName", Return = "bool", Notes = "Returns true iff the specified rank exists." }, + RemoveGroup = { Params = "GroupName", Return = "", Notes = "Removes the specified group completely. The group will be removed from all the ranks using it and then erased from the manager. Logs an info message and does nothing if the group doesn't exist." }, + RemoveGroupFromRank = { Params = "GroupName, RankName", Return = "", Notes = "Removes the specified group from the specified rank. The group will still exist, even if it isn't assigned to any rank. Logs an info message and does nothing if the group or rank doesn't exist." }, + RemovePermissionFromGroup = { Params = "Permission, GroupName", Return = "", Notes = "Removes the specified permission from the specified group. Logs an info message and does nothing if the group doesn't exist." }, + RemoveRank = { Params = "RankName, [ReplacementRankName]", Return = "", Notes = "Removes the specified rank. If ReplacementRankName is given, the players that have RankName will get their rank set to ReplacementRankName. If it isn't given, or is an invalid rank, the players will be removed from the manager, their ranks will be unset completely. Logs an info message and does nothing if the rank is not found." }, + RenameGroup = { Params = "OldName, NewName", Return = "", Notes = "Renames the specified group. Logs an info message and does nothing if the group is not found." }, + RenameRank = { Params = "OldName, NewName", Return = "", Notes = "Renames the specified rank. Logs an info message and does nothing if the rank is not found." }, + SetPlayerRank = { Params = "PlayerUUID, PlayerName, RankName", Return = "", Notes = "Updates the rank for the specified player. The player name is provided for reference, the UUID is used for identification. Logs a warning and does nothing if the rank is not found." }, + SetRankVisuals = { Params = "RankName, MsgPrefix, MsgSuffix, MsgNameColorCode", Return = "", Notes = "Updates the rank's message visuals. Logs an info message and does nothing if rank not found." }, + }, + }, -- cRankManager + cRoot = { Desc = [[ -- cgit v1.2.3 From 2218f31cde5d04157469de0d5164059ffb8a6bca Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 20 Aug 2014 22:21:41 +0200 Subject: Exported cServer:ShouldAuthenticate to Lua API. --- MCServer/Plugins/APIDump/APIDesc.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index ce3303087..90d95bba2 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2172,10 +2172,11 @@ end { GetDescription = { Return = "string", Notes = "Returns the server description set in the settings.ini." }, GetMaxPlayers = { Return = "number", Notes = "Returns the max amount of players who can join the server." }, - SetMaxPlayers = { Params = "number", Notes = "Sets the max amount of players who can join." }, GetNumPlayers = { Return = "number", Notes = "Returns the amount of players online." }, GetServerID = { Return = "string", Notes = "Returns the ID of the server?" }, IsHardcore = { Params = "", Return = "bool", Notes = "Returns true if the server is hardcore (players get banned on death)." }, + SetMaxPlayers = { Params = "number", Notes = "Sets the max amount of players who can join." }, + ShouldAuthenticate = { Params = "", Return = "bool", Notes = "Returns true iff the server is set to authenticate players (\"online mode\")." }, }, }, -- cServer -- cgit v1.2.3 From b7ec75add6c0904b3950ce13ebe16888fd237c05 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 20 Aug 2014 22:27:58 +0200 Subject: Updated the Core. --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 1b16c23c2..6627e570a 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 1b16c23c216d359e9fe0334c63deeecc347e69bd +Subproject commit 6627e570a5265ae270aae978a1cad80dfb8a2b18 -- cgit v1.2.3 From 011ff52407fc3eee80319f7f3bd22558824763a1 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 21 Aug 2014 15:46:43 +0200 Subject: APIDump: Removed the cGroup and cGroupManager classes. --- MCServer/Plugins/APIDump/APIDesc.lua | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 90d95bba2..c474b5eb0 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -942,24 +942,6 @@ cFile:Delete("/usr/bin/virus.exe"); Inherits = "cEntity", }, - cGroup = - { - Desc = [[ - This class represents a group {{cPlayer|players}} can be in. Groups define the permissions players - have, and optionally the color of their name in the chat. - ]], - Functions = - { - SetName = { Return = "" }, - GetName = { Return = "string" }, - SetColor = { Return = "" }, - GetColor = { Return = "string" }, - AddCommand = { Return = "" }, - AddPermission = { Return = "" }, - InheritFrom = { Return = "" }, - }, - }, -- cGroup - cIniFile = { Desc = [[ @@ -1760,7 +1742,6 @@ a_Player:OpenWindow(Window); Functions = { AddFoodExhaustion = { Params = "Exhaustion", Return = "", Notes = "Adds the specified number to the food exhaustion. Only positive numbers expected." }, - AddToGroup = { Params = "GroupName", Return = "", Notes = "Temporarily adds the player to the specified group. The assignment is lost when the player disconnects." }, CalcLevelFromXp = { Params = "XPAmount", Return = "number", Notes = "(STATIC) Returns the level which is reached with the specified amount of XP. Inverse of XpForLevel()." }, CanFly = { Return = "bool", Notes = "Returns if the player is able to fly." }, CloseWindow = { Params = "[CanRefuse]", Return = "", Notes = "Closes the currently open UI window. If CanRefuse is true (default), the window may refuse the closing." }, @@ -1770,7 +1751,7 @@ a_Player:OpenWindow(Window); FoodPoison = { Params = "NumTicks", Return = "", Notes = "Starts the food poisoning for the specified amount of ticks; if already foodpoisoned, sets FoodPoisonedTicksRemaining to the larger of the two" }, ForceSetSpeed = { Params = "{{Vector3d|Direction}}", Notes = "Forces the player to move to the given direction." }, GetClientHandle = { Params = "", Return = "{{cClientHandle}}", Notes = "Returns the client handle representing the player's connection. May be nil (AI players)." }, - GetColor = { Return = "string", Notes = "Returns the full color code to be used for this player (based on the first group). Prefix player messages with this code." }, + GetColor = { Return = "string", Notes = "Returns the full color code to be used for this player's messages (based on their rank). Prefix player messages with this code." }, GetCurrentXp = { Params = "", Return = "number", Notes = "Returns the current amount of XP" }, GetEffectiveGameMode = { Params = "", Return = "{{Globals#GameMode|GameMode}}", Notes = "(OBSOLETE) Returns the current resolved game mode of the player. If the player is set to inherit the world's gamemode, returns that instead. See also GetGameMode() and IsGameModeXXX() functions. Note that this function is the same as GetGameMode(), use that function instead." }, GetEquippedItem = { Params = "", Return = "{{cItem}}", Notes = "Returns the item that the player is currently holding; empty item if holding nothing." }, @@ -1784,7 +1765,6 @@ a_Player:OpenWindow(Window); GetFoodSaturationLevel = { Params = "", Return = "number", Notes = "Returns the food saturation (overcharge of the food level, is depleted before food level)" }, GetFoodTickTimer = { Params = "", Return = "", Notes = "Returns the number of ticks past the last food-based heal or damage action; when this timer reaches 80, a new heal / damage is applied." }, GetGameMode = { Return = "{{Globals#GameMode|GameMode}}", Notes = "Returns the player's gamemode. The player may have their gamemode unassigned, in which case they inherit the gamemode from the current {{cWorld|world}}.
NOTE: Instead of comparing the value returned by this function to the gmXXX constants, use the IsGameModeXXX() functions. These functions handle the gamemode inheritance automatically."}, - GetGroups = { Return = "array-table of {{cGroup}}", Notes = "Returns all the groups that this player is member of, as a table. The groups are stored in the array part of the table, beginning with index 1."}, GetIP = { Return = "string", Notes = "Returns the IP address of the player, if available. Returns an empty string if there's no IP to report."}, GetInventory = { Return = "{{cInventory|Inventory}}", Notes = "Returns the player's inventory"}, GetMaxSpeed = { Params = "", Return = "number", Notes = "Returns the player's current maximum speed, relative to the game default speed. Takes into account the sprinting / flying status." }, @@ -1807,15 +1787,13 @@ a_Player:OpenWindow(Window); IsGameModeAdventure = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmAdventure gamemode, or has their gamemode unset and the world is a gmAdventure world." }, IsGameModeCreative = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmCreative gamemode, or has their gamemode unset and the world is a gmCreative world." }, IsGameModeSurvival = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmSurvival gamemode, or has their gamemode unset and the world is a gmSurvival world." }, - IsInGroup = { Params = "GroupNameString", Return = "bool", Notes = "Returns true if the player is a member of the specified group." }, IsOnGround = { Params = "", Return = "bool", Notes = "Returns true if the player is on ground (not falling, not jumping, not flying)" }, IsSatiated = { Params = "", Return = "bool", Notes = "Returns true if the player is satiated (cannot eat)." }, IsVisible = { Params = "", Return = "bool", Notes = "Returns true if the player is visible to other players" }, - LoadPermissionsFromDisk = { Params = "", Return = "", Notes = "Reloads the player's permissions from the disk. This loses any temporary changes made to the player's groups." }, + LoadRank = { Params = "", Return = "", Notes = "Reloads the player's rank, message visuals and permissions from the {{cRankManager}}, based on the player's current rank." }, MoveTo = { Params = "{{Vector3d|NewPosition}}", Return = "Tries to move the player into the specified position." }, MoveToWorld = { Params = "WorldName", Return = "bool", Return = "Moves the player to the specified world. Returns true if successful." }, OpenWindow = { Params = "{{cWindow|Window}}", Return = "", Notes = "Opens the specified UI window for the player." }, - RemoveFromGroup = { Params = "GroupName", Return = "", Notes = "Temporarily removes the player from the specified group. This change is lost when the player disconnects." }, Respawn = { Params = "", Return = "", Notes = "Restores the health, extinguishes fire, makes visible and sends the Respawn packet." }, SendMessage = { Params = "Message", Return = "", Notes = "Sends the specified message to the player." }, SendMessageFailure = { Params = "Message", Return = "", Notes = "Prepends Rose [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. For a command that failed to run because of insufficient permissions, etc." }, @@ -2088,7 +2066,6 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); GetDefaultWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world object from the default world." }, 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." }, 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." }, -- cgit v1.2.3 From 326dd7e4c6baa6070d35a2a46ca20404c623c8e1 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 21 Aug 2014 16:55:39 +0200 Subject: RankMgr: Added cRankManager::RemovePlayerRank(). --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index c474b5eb0..6138f945a 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2030,6 +2030,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); RemoveGroup = { Params = "GroupName", Return = "", Notes = "Removes the specified group completely. The group will be removed from all the ranks using it and then erased from the manager. Logs an info message and does nothing if the group doesn't exist." }, RemoveGroupFromRank = { Params = "GroupName, RankName", Return = "", Notes = "Removes the specified group from the specified rank. The group will still exist, even if it isn't assigned to any rank. Logs an info message and does nothing if the group or rank doesn't exist." }, RemovePermissionFromGroup = { Params = "Permission, GroupName", Return = "", Notes = "Removes the specified permission from the specified group. Logs an info message and does nothing if the group doesn't exist." }, + RemovePlayerRank = { Params = "PlayerUUID", Return = "", Notes = "Removes the player's rank; the player's left without a rank. Note that this doesn't change the {{cPlayer}} instances for the already connected players, you need to update all the instances manually. No action if the player has no rank assigned to them already." }, RemoveRank = { Params = "RankName, [ReplacementRankName]", Return = "", Notes = "Removes the specified rank. If ReplacementRankName is given, the players that have RankName will get their rank set to ReplacementRankName. If it isn't given, or is an invalid rank, the players will be removed from the manager, their ranks will be unset completely. Logs an info message and does nothing if the rank is not found." }, RenameGroup = { Params = "OldName, NewName", Return = "", Notes = "Renames the specified group. Logs an info message and does nothing if the group is not found." }, RenameRank = { Params = "OldName, NewName", Return = "", Notes = "Renames the specified rank. Logs an info message and does nothing if the rank is not found." }, -- cgit v1.2.3 From 0daacd14d9ab678c08c45a1a1562d5ec160a3ff3 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 23 Aug 2014 03:44:04 +0200 Subject: RankMgr: Implemented default rank, added defaults. --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 6627e570a..7cc99285a 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 6627e570a5265ae270aae978a1cad80dfb8a2b18 +Subproject commit 7cc99285ae5117418f657c3b295ca71f2b75b4f4 -- cgit v1.2.3 From 3977d53b8301108c4b121467647ddd6e2f2ddaea Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 24 Aug 2014 20:05:28 +0200 Subject: RankMgr: Exported the default-rank functions. --- MCServer/Plugins/APIDump/APIDesc.lua | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 6138f945a..fe56ecee8 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2003,7 +2003,13 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);

Permissions are added to individual groups. Each group can support unlimited permissions. Note that adding a permission to a group will make the permission available to all the ranks that contain that - permission group. + permission group.

+

+ One rank is reserved as the Default rank. All players that don't have an explicit rank assigned to them + will behave as if assigned to this rank. The default rank can be changed to any other rank at any time. + Note that the default rank cannot be removed from the RankManager - RemoveRank() will change the default + rank to the replacement rank, if specified, and fail if no replacement rank is specified. Renaming the + default rank using RenameRank() will change the default rank to the new name. ]], Functions = { @@ -2014,11 +2020,12 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); GetAllGroups = { Params = "", Return = "array-table of groups' names", Notes = "Returns an array-table containing the names of all the groups that are known to the manager." }, GetAllPermissions = { Params = "", Return = "array-table of permissions", Notes = "Returns an array-table containing all the permissions that are known to the manager." }, GetAllRanks = { Params = "", Return = "array-table of ranks' names", Notes = "Returns an array-table containing the names of all the ranks that are known to the manager." }, + GetDefaultRank = { Params = "", Return = "string", Notes = "Returns the name of the default rank. " }, GetGroupPermissions = { Params = "GroupName", Return = "array-table of permissions", Notes = "Returns an array-table containing the permissions that the specified group contains." }, GetPlayerGroups = { Params = "PlayerUUID", Return = "array-table of groups' names", Notes = "Returns an array-table of the names of the groups that are assigned to the specified player through their rank. Returns an empty table if the player is not known or has no rank or groups assigned to them." }, - GetPlayerMsgVisuals = { Params = "PlayerUUID", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals assigned to the player. If the player is not known or has no rank assigned, doesn't return any value." }, - GetPlayerPermissions = { Params = "PlayerUUID", Return = "array-table of permissions", Notes = "Returns the permissions that the specified player is assigned through their rank. Returns an empty table if the player is not known." }, - GetPlayerRankName = { Params = "PlayerUUID", Return = "RankName", Notes = "Returns the name of the rank that is assigned to the specified player. An empty string is returned if the player has no rank assigned to them." }, + GetPlayerMsgVisuals = { Params = "PlayerUUID", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals assigned to the player. If the player is not explicitly assigned a rank, the default rank's visuals are returned. If there is an error, no value is returned at all." }, + GetPlayerPermissions = { Params = "PlayerUUID", Return = "array-table of permissions", Notes = "Returns the permissions that the specified player is assigned through their rank. Returns the default rank's permissions if the player has no explicit rank assigned to them. Returns an empty array on error." }, + GetPlayerRankName = { Params = "PlayerUUID", Return = "RankName", Notes = "Returns the name of the rank that is assigned to the specified player. An empty string (NOT the default rank) is returned if the player has no rank assigned to them." }, GetRankGroups = { Params = "RankName", Return = "array-table of groups' names", Notes = "Returns an array-table of the names of all the groups that are assigned to the specified rank. Returns an empty table if there is no such rank." }, GetRankPermissions = { Params = "RankName", Return = "array-table of permissions", Notes = "Returns an array-table of all the permissions that are assigned to the specified rank through its groups. Returns an empty table if there is no such rank." }, GetRankVisuals = { Params = "RankName", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals for the specified rank. Returns no value if the specified rank does not exist." }, @@ -2032,8 +2039,9 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); RemovePermissionFromGroup = { Params = "Permission, GroupName", Return = "", Notes = "Removes the specified permission from the specified group. Logs an info message and does nothing if the group doesn't exist." }, RemovePlayerRank = { Params = "PlayerUUID", Return = "", Notes = "Removes the player's rank; the player's left without a rank. Note that this doesn't change the {{cPlayer}} instances for the already connected players, you need to update all the instances manually. No action if the player has no rank assigned to them already." }, RemoveRank = { Params = "RankName, [ReplacementRankName]", Return = "", Notes = "Removes the specified rank. If ReplacementRankName is given, the players that have RankName will get their rank set to ReplacementRankName. If it isn't given, or is an invalid rank, the players will be removed from the manager, their ranks will be unset completely. Logs an info message and does nothing if the rank is not found." }, - RenameGroup = { Params = "OldName, NewName", Return = "", Notes = "Renames the specified group. Logs an info message and does nothing if the group is not found." }, - RenameRank = { Params = "OldName, NewName", Return = "", Notes = "Renames the specified rank. Logs an info message and does nothing if the rank is not found." }, + RenameGroup = { Params = "OldName, NewName", Return = "", Notes = "Renames the specified group. Logs an info message and does nothing if the group is not found or the new name is already used." }, + RenameRank = { Params = "OldName, NewName", Return = "", Notes = "Renames the specified rank. Logs an info message and does nothing if the rank is not found or the new name is already used." }, + SetDefaultRank = { Params = "RankName", Return = "bool", Notes = "Sets the specified rank as the default rank. Returns true on success, false on failure (rank doesn't exist)." }, SetPlayerRank = { Params = "PlayerUUID, PlayerName, RankName", Return = "", Notes = "Updates the rank for the specified player. The player name is provided for reference, the UUID is used for identification. Logs a warning and does nothing if the rank is not found." }, SetRankVisuals = { Params = "RankName, MsgPrefix, MsgSuffix, MsgNameColorCode", Return = "", Notes = "Updates the rank's message visuals. Logs an info message and does nothing if rank not found." }, }, -- cgit v1.2.3 From fe3d8fd8100ed93a35fe5a7f4080cbab1f913490 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 27 Aug 2014 15:41:29 +0300 Subject: Debuggers: Added a testcase for OnProjectileHitBlock. This is a test for #1326. --- MCServer/Plugins/Debuggers/Debuggers.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 81cf02f3c..179935c08 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -33,6 +33,7 @@ function Initialize(Plugin) PM:AddHook(cPluginManager.HOOK_PROJECTILE_HIT_BLOCK, OnProjectileHitBlock); PM:AddHook(cPluginManager.HOOK_CHUNK_UNLOADING, OnChunkUnloading); PM:AddHook(cPluginManager.HOOK_WORLD_STARTED, OnWorldStarted); + PM:AddHook(cPluginManager.HOOK_PROJECTILE_HIT_BLOCK, OnProjectileHitBlock); -- _X: Disabled so that the normal operation doesn't interfere with anything -- PM:AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated); @@ -1545,3 +1546,15 @@ end + +function OnProjectileHitBlock(a_ProjectileEntity, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockHitPos) + -- This simple test is for testing issue #1326 - simply declaring this hook would crash the server upon call + LOG("Projectile hit block") + LOG(" Projectile EntityID: " .. a_ProjectileEntity:GetUniqueID()) + LOG(" Block: {" .. a_BlockX .. ", " .. a_BlockY .. ", " .. a_BlockZ .. "}, face " .. a_BlockFace) + LOG(" HitPos: {" .. a_BlockHitPos.x .. ", " .. a_BlockHitPos.y .. ", " .. a_BlockHitPos.z .. "}") +end + + + + -- cgit v1.2.3 From e555cb4ab3a783f9dc8980bd5f7e4523bd6711ce Mon Sep 17 00:00:00 2001 From: Hownaer Date: Thu, 28 Aug 2014 00:05:11 +0200 Subject: Fixed ItemCategory code example. --- MCServer/Plugins/APIDump/APIDesc.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index fe56ecee8..3e1a6e3bb 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2570,8 +2570,8 @@ World:ForEachEntity( The following code snippet checks if the player holds a shovel.

 -- a_Player is a {{cPlayer}} object, possibly received as a hook param
-local HeldItem = a_Player:GetEquippedItem();
-if (cItemCategory:IsShovel(HeldItem.m_ItemType)) then
+local HeldItem = a_Player:GetEquippedItem()
+if (ItemCategory.IsShovel(HeldItem.m_ItemType)) then
 	-- It's a shovel
 end
 
-- cgit v1.2.3 From 4ff34b9f10368587b7d7ade58977fb8ec7692d73 Mon Sep 17 00:00:00 2001 From: Hownaer Date: Thu, 28 Aug 2014 18:18:21 +0200 Subject: APIDump: Added missing cItem things. --- MCServer/Plugins/APIDump/APIDesc.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 3e1a6e3bb..d75911666 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1188,7 +1188,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins, constructor = { { Params = "", Return = "cItem", Notes = "Creates a new empty cItem object" }, - { Params = "ItemType, Count, Damage, EnchantmentString", Return = "cItem", Notes = "Creates a new cItem object of the specified type, count (1 by default), damage (0 by default) and enchantments (non-enchanted by default)" }, + { Params = "ItemType, Count, Damage, EnchantmentString, CustomName, Lore", Return = "cItem", Notes = "Creates a new cItem object of the specified type, count (1 by default), damage (0 by default), enchantments (non-enchanted by default), CustomName (empty by default) and Lore (string, empty by default)" }, { Params = "cItem", Return = "cItem", Notes = "Creates an exact copy of the cItem object in the parameter" }, } , AddCount = { Params = "AmountToAdd", Return = "cItem", Notes = "Adds the specified amount to the item count. Returns self (useful for chaining)." }, @@ -1207,6 +1207,9 @@ These ItemGrids are available in the API and can be manipulated by the plugins, IsBothNameAndLoreEmpty = { Params = "", Return = "bool", Notes = "Returns if both the custom name and lore are not set." }, IsCustomNameEmpty = { Params = "", Return = "bool", Notes = "Returns if the custom name of the cItem is empty." }, IsLoreEmpty = { Params = "", Return = "", Notes = "Returns if the lore of the cItem is empty." }, + GetEnchantability = { Params = "", Return = "number", Notes = "Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0" }, + EnchantByXPLevels = { Params = "NumXPLevels", Return = "bool", Notes = "Enchants the item using the specified number of XP levels. Returns true if item enchanted, false if not." }, + IsEnchantable = { Params = "ItemType, WithBook", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is enchantable." }, }, Variables = { @@ -1214,8 +1217,10 @@ These ItemGrids are available in the API and can be manipulated by the plugins, m_ItemCount = { Type = "number", Notes = "Number of items in this stack" }, m_ItemDamage = { Type = "number", Notes = "The damage of the item. Zero means no damage. Maximum damage can be queried with GetMaxDamage()" }, m_ItemType = { Type = "number", Notes = "The item type. One of E_ITEM_ or E_BLOCK_ constants" }, - m_CustomName = { Type = "string", Notes = "The custom name for an item." }, - m_Lore = { Type = "string", Notes = "The lore for an item. Line breaks are represented by the ` character." }, + m_CustomName = { Type = "string", Notes = "The custom name for an item." }, + m_Lore = { Type = "string", Notes = "The lore for an item. Line breaks are represented by the ` character." }, + m_RepairCost = { Type = "number", Notes = "The repair cost of the item. The anvil need this value" }, + m_Enchantments = { Type = "{{cEnchantments|cEnchantments}}}", Notes = "The enchantments of the item." }, }, AdditionalInfo = { -- cgit v1.2.3 From 9c1fadd50cc935615bb776919ef1ff0587f2590b Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 29 Aug 2014 15:13:47 +0100 Subject: Updated Core --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 7cc99285a..bd23915df 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 7cc99285ae5117418f657c3b295ca71f2b75b4f4 +Subproject commit bd23915df763b182610c6163c5ff2d64a0756560 -- cgit v1.2.3 From 04653b45394a9e95fddcae274cca0c422f21cfdc Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 30 Aug 2014 12:53:19 +0200 Subject: Added GetWalkSpeed() and SetWalkSpeed() documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 2 ++ MCServer/Plugins/SexyMotd | 1 + 2 files changed, 3 insertions(+) create mode 120000 MCServer/Plugins/SexyMotd (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 3e1a6e3bb..434dd8a90 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1636,6 +1636,8 @@ a_Player:OpenWindow(Window); MobTypeToString = { Params = "{{cMonster#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the string representing the given mob type ({{cMonster#MobType|mtXXX}} constant), or empty string if unknown type." }, MoveToPosition = { Params = "Position", Return = "", Notes = "Moves mob to the specified position" }, StringToMobType = { Params = "string", Return = "{{cMonster#MobType|MobType}}", Notes = "(STATIC) Returns the mob type ({{cMonster#MobType|mtXXX}} constant) parsed from the string type (\"creeper\"), or mtInvalidType if unrecognized." }, + GetWalkSpeed = { Params = "", Return = "number", Notes = "Returns the walk speed of this mob. Standard is 1.0" }, + SetWalkSpeed = { Params = "number", Return = "", Notes = "Sets the walk speed of this mob. Standard is 1.0" }, }, Constants = { diff --git a/MCServer/Plugins/SexyMotd b/MCServer/Plugins/SexyMotd new file mode 120000 index 000000000..b6af08265 --- /dev/null +++ b/MCServer/Plugins/SexyMotd @@ -0,0 +1 @@ +/home/franz/Schreibtisch/MCServer Plugins/SexyMotd/ \ No newline at end of file -- cgit v1.2.3 From c5be3e0b6673c03c9a4dba109454af8bcaefc4e5 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 30 Aug 2014 12:55:43 +0200 Subject: Removed SexyMotd link --- MCServer/Plugins/SexyMotd | 1 - 1 file changed, 1 deletion(-) delete mode 120000 MCServer/Plugins/SexyMotd (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/SexyMotd b/MCServer/Plugins/SexyMotd deleted file mode 120000 index b6af08265..000000000 --- a/MCServer/Plugins/SexyMotd +++ /dev/null @@ -1 +0,0 @@ -/home/franz/Schreibtisch/MCServer Plugins/SexyMotd/ \ No newline at end of file -- cgit v1.2.3 From 3ee3a59e75ac1e6eb9284983a05a459aab5be1fd Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 30 Aug 2014 15:06:43 +0200 Subject: Changed the IsEnchantable() comment. --- MCServer/Plugins/APIDump/APIDesc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index d75911666..da8f9cd74 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1209,7 +1209,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins, IsLoreEmpty = { Params = "", Return = "", Notes = "Returns if the lore of the cItem is empty." }, GetEnchantability = { Params = "", Return = "number", Notes = "Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0" }, EnchantByXPLevels = { Params = "NumXPLevels", Return = "bool", Notes = "Enchants the item using the specified number of XP levels. Returns true if item enchanted, false if not." }, - IsEnchantable = { Params = "ItemType, WithBook", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is enchantable." }, + IsEnchantable = { Params = "ItemType, WithBook", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is enchantable. If WithBook is true, the function checks the enchantments with a book too." }, }, Variables = { -- cgit v1.2.3 From 959f89f5bc59538c6047a1dcee8c8d283768f1b6 Mon Sep 17 00:00:00 2001 From: Howaner Date: Mon, 1 Sep 2014 00:42:40 +0200 Subject: Fixed ReplaceString() documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 3e1a6e3bb..e7f9e9b18 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2846,7 +2846,7 @@ end MirrorBlockFaceY = { Params = "{{Globals#BlockFaces|eBlockFace}}", Return = "{{Globals#BlockFaces|eBlockFace}}", Notes = "Returns the {{Globals#BlockFaces|eBlockFace}} that corresponds to the given {{Globals#BlockFaces|eBlockFace}} after mirroring it around the Y axis (or rotating 180 degrees around it)." }, NoCaseCompare = {Params = "string, string", Return = "number", Notes = "Case-insensitive string comparison; returns 0 if the strings are the same"}, NormalizeAngleDegrees = { Params = "AngleDegrees", Return = "AngleDegrees", Notes = "Returns the angle, wrapped into the [-180, +180) range." }, - ReplaceString = {Params = "full-string, to-be-replaced-string, to-replace-string", Notes = "Replaces *each* occurence of to-be-replaced-string in full-string with to-replace-string"}, + ReplaceString = {Params = "full-string, to-be-replaced-string, to-replace-string", Return = "string", Notes = "Replaces *each* occurence of to-be-replaced-string in full-string with to-replace-string"}, RotateBlockFaceCCW = { Params = "{{Globals#BlockFaces|eBlockFace}}", Return = "{{Globals#BlockFaces|eBlockFace}}", Notes = "Returns the {{Globals#BlockFaces|eBlockFace}} that corresponds to the given {{Globals#BlockFaces|eBlockFace}} after rotating it around the Y axis 90 degrees counter-clockwise." }, RotateBlockFaceCW = { Params = "{{Globals#BlockFaces|eBlockFace}}", Return = "{{Globals#BlockFaces|eBlockFace}}", Notes = "Returns the {{Globals#BlockFaces|eBlockFace}} that corresponds to the given {{Globals#BlockFaces|eBlockFace}} after rotating it around the Y axis 90 degrees clockwise." }, StringSplit = {Params = "string, SeperatorsString", Return = "array table of strings", Notes = "Seperates string into multiple by splitting every time any of the characters in SeperatorsString is encountered."}, -- cgit v1.2.3 From 7fb9cbcfb2fb0b042861b98bb93dc38d4a8c73b2 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 2 Sep 2014 08:34:23 +0200 Subject: Re-updated the Core. --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 7cc99285a..bd23915df 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 7cc99285ae5117418f657c3b295ca71f2b75b4f4 +Subproject commit bd23915df763b182610c6163c5ff2d64a0756560 -- cgit v1.2.3 From c8953d165c037684b1373e090dea56daddc6e636 Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 2 Sep 2014 19:13:36 +0200 Subject: Added a custom name test to the debuggers plugin. --- MCServer/Plugins/Debuggers/Debuggers.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 179935c08..65ce0993a 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -38,6 +38,7 @@ function Initialize(Plugin) -- _X: Disabled so that the normal operation doesn't interfere with anything -- PM:AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated); + PM:BindCommand("/cm", "debuggers", HandleCustomNameCmd, "- Gives you a custom name"); PM:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities"); PM:BindCommand("/ke", "debuggers", HandleKillEntitiesCmd, "- Kills all the loaded entities"); PM:BindCommand("/wool", "debuggers", HandleWoolCmd, "- Sets all your armor to blue wool"); @@ -768,6 +769,22 @@ end +function HandleCustomNameCmd(Split, Player) + if (Split[2] == nil) then + Player:SendMessage("Usage: /cm [CustomName]"); + return true; + end + + local NewName = Split[2] + Player:SetCustomName(NewName); + Player:SendMessageSuccess("Custom name setted to " .. Player:GetCustomName() .. "!") + return true +end + + + + + function HandleListEntitiesCmd(Split, Player) local NumEntities = 0; -- cgit v1.2.3 From 079634d18cf63abad05db0fda9a4510aa75c0522 Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 2 Sep 2014 19:20:59 +0200 Subject: Added the new functions to APIDump. --- MCServer/Plugins/APIDump/APIDesc.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index e7f9e9b18..f109638e9 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1629,6 +1629,11 @@ a_Player:OpenWindow(Window); ]], Functions = { + HasCustomName = { Params = "", Return = "bool", Notes = "Returns true if the monster has a custom name." }, + GetCustomName = { Params = "", Return = "string", Notes = "Gets the custom name of the monster. If no custom name is set, the function returns an empty string." }, + SetCustomName = { Params = "string", Return = "", Notes = "Sets the custom name of the monster. You see the name over the monster. If you want to disable the custom name, simply set an empty string." }, + IsCustomNameAlwaysVisible = { Params = "", Return = "bool", Notes = "Is the custom name of this monster always visible? If not, you only see the name when you sight the mob." }, + SetCustomNameAlwaysVisible = { Params = "bool", Return = "", Notes = "Sets the custom name visiblity of this monster. If it's false, you only see the name when you sight the mob. If it's true, you always see the custom name." }, FamilyFromType = { Params = "{{cMonster#MobType|MobType}}", Return = "{{cMonster#MobFamily|MobFamily}}", Notes = "(STATIC) Returns the mob family ({{cMonster#MobFamily|mfXXX}} constants) based on the mob type ({{cMonster#MobType|mtXXX}} constants)" }, GetMobFamily = { Params = "", Return = "{{cMonster#MobFamily|MobFamily}}", Notes = "Returns this mob's family ({{cMonster#MobFamily|mfXXX}} constant)" }, GetMobType = { Params = "", Return = "{{cMonster#MobType|MobType}}", Notes = "Returns the type of this mob ({{cMonster#MobType|mtXXX}} constant)" }, @@ -1752,6 +1757,7 @@ a_Player:OpenWindow(Window); ForceSetSpeed = { Params = "{{Vector3d|Direction}}", Notes = "Forces the player to move to the given direction." }, GetClientHandle = { Params = "", Return = "{{cClientHandle}}", Notes = "Returns the client handle representing the player's connection. May be nil (AI players)." }, GetColor = { Return = "string", Notes = "Returns the full color code to be used for this player's messages (based on their rank). Prefix player messages with this code." }, + GetTabListName = { Return = "string", Notes = "Returns the name that is used in the tablist." }, GetCurrentXp = { Params = "", Return = "number", Notes = "Returns the current amount of XP" }, GetEffectiveGameMode = { Params = "", Return = "{{Globals#GameMode|GameMode}}", Notes = "(OBSOLETE) Returns the current resolved game mode of the player. If the player is set to inherit the world's gamemode, returns that instead. See also GetGameMode() and IsGameModeXXX() functions. Note that this function is the same as GetGameMode(), use that function instead." }, GetEquippedItem = { Params = "", Return = "{{cItem}}", Notes = "Returns the item that the player is currently holding; empty item if holding nothing." }, @@ -1802,6 +1808,9 @@ a_Player:OpenWindow(Window); SendMessagePrivateMsg = { Params = "Message, SenderName", Return = "", Notes = "Prepends Light Blue [MSG: *SenderName*] / prepends SenderName and colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. For private messaging." }, SendMessageSuccess = { Params = "Message", Return = "", Notes = "Prepends Green [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Success notification." }, SendMessageWarning = { Params = "Message, Sender", Return = "", Notes = "Prepends Rose [WARN] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Denotes that something concerning, such as plugin reload, is about to happen." }, + HasCustomName = { Params = "", Return = "bool", Notes = "Returns true if the player has a custom name." }, + GetCustomName = { Params = "", Return = "string", Notes = "Returns the custom name of this player. If the player hasn't a custom name, it will return an empty string." }, + SetCustomName = { Params = "string", Return = "", Notes = "Sets the custom name of this player. If you want to disable the custom name, simply set an empty string. The custom name will be used in the tab-list, in the player nametag and in the tab-completion." }, SetCanFly = { Params = "CanFly", Notes = "Sets if the player can fly or not." }, SetCrouch = { Params = "IsCrouched", Return = "", Notes = "Sets the crouch state, broadcasts the change to other players." }, SetCurrentExperience = { Params = "XPAmount", Return = "", Notes = "Sets the current amount of experience (and indirectly, the XP level)." }, -- cgit v1.2.3 From 38e824dbcfa66ee63670f6e8aa708e7a4aa58f5e Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 2 Sep 2014 20:10:41 +0200 Subject: Renamed SetWalkSpeed() to SetRelativeWalkSpeed() --- MCServer/Plugins/APIDump/APIDesc.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 337ce47c3..18fb7acad 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1636,8 +1636,8 @@ a_Player:OpenWindow(Window); MobTypeToString = { Params = "{{cMonster#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the string representing the given mob type ({{cMonster#MobType|mtXXX}} constant), or empty string if unknown type." }, MoveToPosition = { Params = "Position", Return = "", Notes = "Moves mob to the specified position" }, StringToMobType = { Params = "string", Return = "{{cMonster#MobType|MobType}}", Notes = "(STATIC) Returns the mob type ({{cMonster#MobType|mtXXX}} constant) parsed from the string type (\"creeper\"), or mtInvalidType if unrecognized." }, - GetWalkSpeed = { Params = "", Return = "number", Notes = "Returns the walk speed of this mob. Standard is 1.0" }, - SetWalkSpeed = { Params = "number", Return = "", Notes = "Sets the walk speed of this mob. Standard is 1.0" }, + GetRelativeWalkSpeed = { Params = "", Return = "number", Notes = "Returns the relative walk speed of this mob. Standard is 1.0" }, + SetRelativeWalkSpeed = { Params = "number", Return = "", Notes = "Sets the relative walk speed of this mob. Standard is 1.0" }, }, Constants = { -- cgit v1.2.3 From c19b2befa88bfe5549a3630c997070d5e1d37941 Mon Sep 17 00:00:00 2001 From: Howaner Date: Tue, 2 Sep 2014 20:17:31 +0200 Subject: Changed the IsEnchantable() comment again. --- MCServer/Plugins/APIDump/APIDesc.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index eec731c34..ffd228d1a 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1201,7 +1201,6 @@ These ItemGrids are available in the API and can be manipulated by the plugins, IsDamageable = { Params = "", Return = "bool", Notes = "Returns true if this item does account for its damage" }, IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if this object represents an empty item (zero count or invalid ID)" }, IsEqual = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is the same as the one stored in the object (type, damage, lore, name and enchantments)" }, - IsEnchantable = { Params = "", Return = "bool", Notes = "Returns true if the item is enchantable" }, IsFullStack = { Params = "", Return = "bool", Notes = "Returns true if the item is stacked up to its maximum stacking" }, IsSameType = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is of the same ItemType as the one stored in the object. This is true even if the two items have different enchantments" }, IsBothNameAndLoreEmpty = { Params = "", Return = "bool", Notes = "Returns if both the custom name and lore are not set." }, @@ -1209,7 +1208,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins, IsLoreEmpty = { Params = "", Return = "", Notes = "Returns if the lore of the cItem is empty." }, GetEnchantability = { Params = "", Return = "number", Notes = "Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0" }, EnchantByXPLevels = { Params = "NumXPLevels", Return = "bool", Notes = "Enchants the item using the specified number of XP levels. Returns true if item enchanted, false if not." }, - IsEnchantable = { Params = "ItemType, WithBook", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is enchantable. If WithBook is true, the function checks the enchantments with a book too." }, + IsEnchantable = { Params = "ItemType, WithBook", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is enchantable. If WithBook is true, the function is used in the anvil inventory with book enchantments. So it checks the \"only book enchantments\" too. Example: You can only enchant a hoe with a book." }, }, Variables = { -- cgit v1.2.3 From a9ed5baba35b012f577ca6c6cca970042fc4edf0 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 3 Sep 2014 17:01:23 +0200 Subject: Exported ForEachEntityInBox() to Lua API. --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index ffd228d1a..718cb4e98 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2344,6 +2344,7 @@ end ForEachBlockEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each block entity in the chunk. Returns true if all block entities in the chunk have been processed (including when there are zero block entities), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature:
function Callback({{cBlockEntity|BlockEntity}}, [CallbackData])
The callback should return false or no value to continue with the next block entity, or true to abort the enumeration. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." }, ForEachChestInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each chest in the chunk. Returns true if all chests in the chunk have been processed (including when there are zero chests), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature:
function Callback({{cChestEntity|ChestEntity}}, [CallbackData])
The callback should return false or no value to continue with the next chest, or true to abort the enumeration." }, ForEachEntity = { Params = "CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each entity in the loaded world. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature:
function Callback({{cEntity|Entity}}, [CallbackData])
The callback should return false or no value to continue with the next entity, or true to abort the enumeration." }, + ForEachEntityInBox = { Params = "{{cBoundingBox|Box}}, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the specified bounding box. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. If any chunk within the bounding box is not valid, it is silently skipped without any notification. The callback function has the following signature:
function Callback({{cEntity|Entity}})
The callback should return false or no value to continue with the next entity, or true to abort the enumeration." }, ForEachEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each entity in the specified chunk. Returns true if all the entities have been processed (including when there are zero entities), or false if the chunk is not loaded or the callback function has aborted the enumeration by returning true. The callback function has the following signature:
function Callback({{cEntity|Entity}}, [CallbackData])
The callback should return false or no value to continue with the next entity, or true to abort the enumeration." }, ForEachFurnaceInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each furnace in the chunk. Returns true if all furnaces in the chunk have been processed (including when there are zero furnaces), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature:
function Callback({{cFurnaceEntity|FurnaceEntity}}, [CallbackData])
The callback should return false or no value to continue with the next furnace, or true to abort the enumeration." }, ForEachPlayer = { Params = "CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each player in the loaded world. Returns true if all the players have been processed (including when there are zero players), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature:
function Callback({{cPlayer|Player}}, [CallbackData])
The callback should return false or no value to continue with the next player, or true to abort the enumeration." }, -- cgit v1.2.3 From 5fa1a7fa223324a891c14c8b91544d859ee6fef4 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 3 Sep 2014 17:02:16 +0200 Subject: Debuggers: Added a test code for ForEachEntityInBox(). Currently untested, may not run, may crash. --- MCServer/Plugins/Debuggers/Debuggers.lua | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 179935c08..ca764c959 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -65,6 +65,8 @@ function Initialize(Plugin) PM:BindCommand("/sb", "debuggers", HandleSetBiome, "- Sets the biome around you to the specified one"); PM:BindCommand("/wesel", "debuggers", HandleWESel, "- Expands the current WE selection by 1 block in X/Z"); PM:BindCommand("/rmitem", "debuggers", HandleRMItem, "- Remove the specified item from the inventory."); + PM:BindCommand("/pickups", "debuggers", HandlePickups, "- Spawns random pickups around you"); + PM:BindCommand("/poof", "debuggers", HandlePoof, "- Nudges pickups close to you away from you"); Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers) Plugin:AddWebTab("StressTest", HandleRequest_StressTest) @@ -1558,3 +1560,50 @@ end + +local PossibleItems = +{ + cItem(E_ITEM_DIAMOND), + cItem(E_ITEM_GOLD), + cItem(E_ITEM_IRON), + cItem(E_ITEM_DYE, E_META_DYE_BLUE), -- Lapis lazuli + cItem(E_ITEM_COAL), +} + + + + + +function HandlePickups(a_Split, a_Player) + local PlayerX = a_Player:GetPosX() + local PlayerY = a_Player:GetPosY() + local PlayerZ = a_Player:GetPosZ() + local World = a_Player:GetWorld() + local Range = 15 + for x = 0, Range do for z = 0, Range do + local x = PlayerX + x - Range / 2 + local z = PlayerZ + z - Range / 2 + local Items = cItems() + Items:Add(PossibleItems[math.random(#PossibleItems)]) + World:SpawnItemPickups(Items, x, PlayerY, z, 0) + end end -- for z, for x +end + + + + +function HandlePoof(a_Split, a_Player) + local PlayerPos = a_Player:GetPos() + local Box = cBoundingBox(PlayerPos, a_Player:GetWidth() / 2, a_Player:GetHeight()) + a_Player:GetWorld():ForEachEntityInBox(Box, + function (a_Entity) + local AddSpeed = PlayerPos - a_Entity:GetPosition() -- Speed away from the player + a_Entity:AddSpeed(AddSpeed / AddSpeed:SqrLength()) -- The further away, the less speed to add + end + ) + a_Player:SendMessage("Poof!") +end + + + + -- cgit v1.2.3 From 1b9edb0279b008cf549d75fa3135c166503bf9bc Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 3 Sep 2014 23:05:49 +0200 Subject: Debuggers: Reviewed and fixed the Pickups and Poof commands. Now they're confirmed working. --- MCServer/Plugins/Debuggers/Debuggers.lua | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index ca764c959..0e7e647d5 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -1566,7 +1566,7 @@ local PossibleItems = cItem(E_ITEM_DIAMOND), cItem(E_ITEM_GOLD), cItem(E_ITEM_IRON), - cItem(E_ITEM_DYE, E_META_DYE_BLUE), -- Lapis lazuli + cItem(E_ITEM_DYE, 1, E_META_DYE_BLUE), -- Lapis lazuli cItem(E_ITEM_COAL), } @@ -1579,29 +1579,36 @@ function HandlePickups(a_Split, a_Player) local PlayerY = a_Player:GetPosY() local PlayerZ = a_Player:GetPosZ() local World = a_Player:GetWorld() - local Range = 15 + local Range = 12 for x = 0, Range do for z = 0, Range do - local x = PlayerX + x - Range / 2 - local z = PlayerZ + z - Range / 2 + local px = PlayerX + x - Range / 2 + local pz = PlayerZ + z - Range / 2 local Items = cItems() Items:Add(PossibleItems[math.random(#PossibleItems)]) - World:SpawnItemPickups(Items, x, PlayerY, z, 0) + World:SpawnItemPickups(Items, px, PlayerY, pz, 0) end end -- for z, for x + return true end function HandlePoof(a_Split, a_Player) - local PlayerPos = a_Player:GetPos() - local Box = cBoundingBox(PlayerPos, a_Player:GetWidth() / 2, a_Player:GetHeight()) + local PlayerPos = Vector3d(a_Player:GetPosition()) -- Create a copy of the position + PlayerPos.y = PlayerPos.y - 1 + local Box = cBoundingBox(PlayerPos, 4, 2) + local NumEntities = 0 a_Player:GetWorld():ForEachEntityInBox(Box, function (a_Entity) - local AddSpeed = PlayerPos - a_Entity:GetPosition() -- Speed away from the player - a_Entity:AddSpeed(AddSpeed / AddSpeed:SqrLength()) -- The further away, the less speed to add + if not(a_Entity:IsPlayer()) then + local AddSpeed = a_Entity:GetPosition() - PlayerPos -- Speed away from the player + a_Entity:AddSpeed(AddSpeed * 32 / (AddSpeed:SqrLength() + 1)) -- The further away, the less speed to add + NumEntities = NumEntities + 1 + end end ) - a_Player:SendMessage("Poof!") + a_Player:SendMessage("Poof! (" .. NumEntities .. " entities)") + return true end -- cgit v1.2.3 From f6e029253f6902a038328ee3c02e2e08647da305 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 6 Sep 2014 10:24:33 +0100 Subject: Removed outdated message sending methods. Fixes #1381 --- MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html b/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html index 35c880b00..dd124e119 100644 --- a/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html +++ b/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html @@ -202,7 +202,7 @@ function Explode(Split, Player) if (#Split ~= 2) then -- There was more or less than one argument (excluding the "/explode" bit) -- Send the proper usage to the player and exit - SendMessage(Player, "Usage: /explode [playername]") + Player:SendMessage("Usage: /explode [playername]") return true end @@ -213,7 +213,7 @@ function Explode(Split, Player) if (Explodee:GetName() == Split[2]) then -- Create an explosion at the same position as they are; see API docs for further details of this function Player:GetWorld():DoExplosionAt(Explodee:GetPosX(), Explodee:GetPosY(), Explodee:GetPosZ(), false, esPlugin) - SendMessageSuccess(Player, Split[2] .. " was successfully exploded") + Player:SendMessageSuccess(Split[2] .. " was successfully exploded") HasExploded = true; return true -- Signalize to MCS that we do not need to call this callback for any more players end @@ -224,7 +224,7 @@ function Explode(Split, Player) if not(HasExploded) then -- We have not broken out so far, therefore, the player must not exist, send failure - SendMessageFailure(Player, Split[2] .. " was not found") + Player:SendMessageFailure(Split[2] .. " was not found") end return true -- cgit v1.2.3 From 690867c89ec4d27a3d32329d06b3842790b1dc21 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 7 Sep 2014 09:09:10 +0200 Subject: Fixed submodules' downgrade from the previous PR merge. --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 7cc99285a..bd23915df 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 7cc99285ae5117418f657c3b295ca71f2b75b4f4 +Subproject commit bd23915df763b182610c6163c5ff2d64a0756560 -- cgit v1.2.3 From c5cd75fae83a61920a9a5d50b94b09ae25d87430 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 7 Sep 2014 22:35:22 +0200 Subject: Exported cClientHandle:GetIPString() to Lua API. --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 718cb4e98..c23120600 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -524,6 +524,7 @@ end Functions = { GenerateOfflineUUID = { Params = "Username", Return = "string", Notes = "(STATIC) Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. Returns a 32-char UUID (no dashes)." }, + GetIPString = { Params = "", Return = "string", Notes = "Returns the IP address of the connection, as a string. Only the address part is returned, without the port number." }, GetLocale = { Params = "", Return = "Locale", Notes = "Returns the locale string that the client sends as part of the protocol handshake. Can be used to provide localized strings." }, GetPing = { Params = "", Return = "number", Notes = "Returns the ping time, in ms" }, 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." }, -- cgit v1.2.3 From c0a069b260bf3a2a858a30f32311ad8877bac0d5 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 12 Sep 2014 20:59:47 +0200 Subject: APIDump: Improved command binding documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index c23120600..fc1217474 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1885,13 +1885,13 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); }, BindCommand = { - { Params = "Command, Permission, Callback, HelpString", Return = "[bool]", Notes = "(STATIC) Binds an in-game command with the specified callback function, permission and help string. By common convention, providing an empty string for HelpString will hide the command from the /help display. Returns true if successful, logs to console and returns no value on error." }, - { Params = "Command, Permission, Callback, HelpString", Return = "[bool]", Notes = "Binds an in-game command with the specified callback function, permission and help string. By common convention, providing an empty string for HelpString will hide the command from the /help display. Returns true if successful, logs to console and returns no value on error." }, + { Params = "Command, Permission, Callback, HelpString", Return = "[bool]", Notes = "(STATIC) Binds an in-game command with the specified callback function, permission and help string. By common convention, providing an empty string for HelpString will hide the command from the /help display. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature:
function(Split, {{cPlayer|Player}})
The Split parameter contains an array-table of the words that the player has sent, Player is the {{cPlayer}} object representing the player who sent the command. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server sends a warning to the player that the command is unknown (this is so that subcommands can be implemented)." }, + { Params = "Command, Permission, Callback, HelpString", Return = "[bool]", Notes = "Binds an in-game command with the specified callback function, permission and help string. By common convention, providing an empty string for HelpString will hide the command from the /help display. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature:
function(Split, {{cPlayer|Player}})
The Split parameter contains an array-table of the words that the player has sent, Player is the {{cPlayer}} object representing the player who sent the command. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server sends a warning to the player that the command is unknown (this is so that subcommands can be implemented)." }, }, BindConsoleCommand = { - { Params = "Command, Callback, HelpString", Return = "[bool]", Notes = "(STATIC) Binds a console command with the specified callback function and help string. By common convention, providing an empty string for HelpString will hide the command from the \"help\" console command. Returns true if successful, logs to console and returns no value on error." }, - { Params = "Command, Callback, HelpString", Return = "[bool]", Notes = "Binds a console command with the specified callback function and help string. By common convention, providing an empty string for HelpString will hide the command from the \"help\" console command. Returns true if successful, logs to console and returns no value on error." }, + { Params = "Command, Callback, HelpString", Return = "[bool]", Notes = "(STATIC) Binds a console command with the specified callback function and help string. By common convention, providing an empty string for HelpString will hide the command from the \"help\" console command. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature:
function(Split)
The Split parameter contains an array-table of the words that the admin has typed. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server issues a warning to the console that the command is unknown (this is so that subcommands can be implemented)." }, + { Params = "Command, Callback, HelpString", Return = "[bool]", Notes = "Binds a console command with the specified callback function and help string. By common convention, providing an empty string for HelpString will hide the command from the \"help\" console command. Returns true if successful, logs to console and returns no value on error. The callback uses the following signature:
function(Split)
The Split parameter contains an array-table of the words that the admin has typed. If the callback returns true, the command is assumed to have executed successfully; in all other cases the server issues a warning to the console that the command is unknown (this is so that subcommands can be implemented)." }, }, CallPlugin = { Params = "PluginName, FunctionName, [FunctionArgs...]", Return = "[FunctionRets]", Notes = "(STATIC) Calls the specified function in the specified plugin, passing all the given arguments to it. If it succeeds, it returns all the values returned by that function. If it fails, returns no value at all. Note that only strings, numbers, bools, nils and classes can be used for parameters and return values; tables and functions cannot be copied across plugins." }, DisablePlugin = { Params = "PluginName", Return = "bool", Notes = "Disables a plugin specified by its name. Returns true if the plugin was disabled, false if it wasn't found or wasn't active." }, -- cgit v1.2.3 From ccaec8f424f4cb59ced6518d7fb1171667728f1c Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 17 Sep 2014 20:28:30 +0200 Subject: Fixed wrong url in the debuggers plugin --- MCServer/Plugins/Debuggers/Debuggers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 0e7e647d5..66e06cb72 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -1502,7 +1502,7 @@ function OnPlayerJoined(a_Player) -- Test composite chat chaining: a_Player:SendMessage(cCompositeChat() :AddTextPart("Hello, ") - :AddUrlPart(a_Player:GetName(), "www.mc-server.org", "u@2") + :AddUrlPart(a_Player:GetName(), "http://www.mc-server.org", "u@2") :AddSuggestCommandPart(", and welcome.", "/help", "u") :AddRunCommandPart(" SetDay", "/time set 0") ) -- cgit v1.2.3 From 0baca1f1d8e5e8f97e7aa81e319e343949879622 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 19 Sep 2014 14:36:02 +0200 Subject: Updated SPAWNING_ENTITY hook description. --- MCServer/Plugins/APIDump/Hooks/OnSpawningEntity.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Hooks/OnSpawningEntity.lua b/MCServer/Plugins/APIDump/Hooks/OnSpawningEntity.lua index c4bff3916..e2bd1c940 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnSpawningEntity.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnSpawningEntity.lua @@ -6,8 +6,9 @@ return DefaultFnName = "OnSpawningEntity", -- also used as pagename Desc = [[ This hook is called before the server spawns an {{cEntity|entity}}. The plugin can either modify the - entity before it is spawned, or disable the spawning altogether. If the entity spawning is a - monster, the {{OnSpawningMonster|HOOK_SPAWNING_MONSTER}} hook is called before this hook.

+ entity before it is spawned, or disable the spawning altogether. You can't disable the spawning if the + entity is a player. If the entity spawning is a monster, the {{OnSpawningMonster|HOOK_SPAWNING_MONSTER}} + hook is called before this hook.

See also the {{OnSpawnedEntity|HOOK_SPAWNED_ENTITY}} hook for a similar hook called after the entity is spawned. -- cgit v1.2.3 From a817243e3fc0115da3fc499ae108b4cdc9dd0a4e Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 26 Sep 2014 21:42:55 +0100 Subject: Updated Core --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index bd23915df..9de860603 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit bd23915df763b182610c6163c5ff2d64a0756560 +Subproject commit 9de86060388b515642c55d58b44b4281285efc00 -- cgit v1.2.3 From 400a4d1083fa8ea29898a045ea1bb7815b3a4fcb Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 27 Sep 2014 15:33:35 +0100 Subject: Hopefully fix #1384 Can @madmaxoft comment? --- MCServer/Plugins/APIDump/Hooks/OnServerPing.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 MCServer/Plugins/APIDump/Hooks/OnServerPing.lua (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua new file mode 100644 index 000000000..8a710e047 --- /dev/null +++ b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua @@ -0,0 +1,24 @@ + (cClientHandle & a_ClientHandle, AString & a_ServerDescription, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon); + +return +{ + HOOK_SERVER_PING = + { + CalledWhen = "Client pings the server from the server list.", + DefaultFnName = "OnServerPing", -- also used as pagename + Desc = [[ + A plugin may implement an OnServerPing() function and register it as a Hook to process pings from + clients in the server server list. + ]], + Params = { + { Name = "ClientHandle", Type = "{{cClientHandle}}", Notes = "The client handle that pinged the server" }, + { Name = "ServerDescription", Type = "string", Notes = "The server description" }, + { Name = "OnlinePlayersCount", Type = "number", Notes = "The number of players currently on the server" }, + { Name = "MaxPlayersCount", Type = "number", Notes = "The current player cap for the server" }, + { Name = "Favicon", Type = "string", Notes = "The base64 encoded favicon to be displayed in the server list for compatible clients" }, + }, + Returns = [[ + The plugin may return a boolean of whether to respond to the client that pinged. + ]], + }, -- HOOK_SERVER_PING +} -- cgit v1.2.3 From 3ff7103440202694f36f4c5edd09f8c5d4abb5a5 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 27 Sep 2014 15:35:06 +0100 Subject: Remaining part of fix. --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index e6ee4ca10..6a3c178ef 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1984,6 +1984,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); HOOK_PLAYER_USING_ITEM = { Notes = "Called when the player is about to right-click with a usable item in their hand." }, HOOK_POST_CRAFTING = { Notes = "Called after a valid recipe has been chosen for the current contents of the crafting grid. Plugins may modify the recipe." }, HOOK_PRE_CRAFTING = { Notes = "Called before a recipe is searched for the current contents of the crafting grid. Plugins may provide a recipe and cancel the built-in search." }, + HOOK_SERVER_PING = { Notes = "Called when a alient pings the server from the server list." }, HOOK_SPAWNED_ENTITY = { Notes = "Called after an entity is spawned in a {{cWorld|world}}. The entity is already part of the world." }, HOOK_SPAWNED_MONSTER = { Notes = "Called after a mob is spawned in a {{cWorld|world}}. The mob is already part of the world." }, HOOK_SPAWNING_ENTITY = { Notes = "Called just before an entity is spawned in a {{cWorld|world}}." }, -- cgit v1.2.3 From 9dccbe7792cfdc6ffd56348aa9092004526b3794 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 27 Sep 2014 15:40:33 +0100 Subject: Fixed line left in. --- MCServer/Plugins/APIDump/Hooks/OnServerPing.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua index 8a710e047..7cfbd06ac 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua @@ -1,5 +1,3 @@ - (cClientHandle & a_ClientHandle, AString & a_ServerDescription, int & a_OnlinePlayersCount, int & a_MaxPlayersCount, AString & a_Favicon); - return { HOOK_SERVER_PING = @@ -8,7 +6,8 @@ return DefaultFnName = "OnServerPing", -- also used as pagename Desc = [[ A plugin may implement an OnServerPing() function and register it as a Hook to process pings from - clients in the server server list. + clients in the server server list. It can change the logged in players and player capacity, as well + as the server description and the favicon by editing the values passed in. ]], Params = { { Name = "ClientHandle", Type = "{{cClientHandle}}", Notes = "The client handle that pinged the server" }, @@ -18,7 +17,7 @@ return { Name = "Favicon", Type = "string", Notes = "The base64 encoded favicon to be displayed in the server list for compatible clients" }, }, Returns = [[ - The plugin may return a boolean of whether to respond to the client that pinged. + The plugin may return a boolean. ]], }, -- HOOK_SERVER_PING } -- cgit v1.2.3 From 5245bb0eba6450339c5294038e34a242638c461b Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 27 Sep 2014 16:44:11 +0100 Subject: Typo fix. --- MCServer/Plugins/APIDump/APIDesc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 6a3c178ef..deaa28279 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2815,7 +2815,7 @@ end Globals = { Desc = [[ - These functions are available directly, without a class instance. Any plugin cal call them at any + These functions are available directly, without a class instance. Any plugin can call them at any time. ]], Functions = -- cgit v1.2.3 From 990a467eb41c6fb1dc4a132bd6e990c97efaa2e6 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 27 Sep 2014 16:49:40 +0100 Subject: Fixed typo again. --- MCServer/Plugins/APIDump/APIDesc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index deaa28279..f903308d1 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1984,7 +1984,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); HOOK_PLAYER_USING_ITEM = { Notes = "Called when the player is about to right-click with a usable item in their hand." }, HOOK_POST_CRAFTING = { Notes = "Called after a valid recipe has been chosen for the current contents of the crafting grid. Plugins may modify the recipe." }, HOOK_PRE_CRAFTING = { Notes = "Called before a recipe is searched for the current contents of the crafting grid. Plugins may provide a recipe and cancel the built-in search." }, - HOOK_SERVER_PING = { Notes = "Called when a alient pings the server from the server list." }, + HOOK_SERVER_PING = { Notes = "Called when a client pings the server from the server list. Plugins may change the favicon, server description, players online and maximum players values." }, HOOK_SPAWNED_ENTITY = { Notes = "Called after an entity is spawned in a {{cWorld|world}}. The entity is already part of the world." }, HOOK_SPAWNED_MONSTER = { Notes = "Called after a mob is spawned in a {{cWorld|world}}. The mob is already part of the world." }, HOOK_SPAWNING_ENTITY = { Notes = "Called just before an entity is spawned in a {{cWorld|world}}." }, -- cgit v1.2.3 From 57e83f7d49485e254ab33ee348ce66c3981005a5 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 27 Sep 2014 21:27:48 +0100 Subject: Fixed return value descriptions. --- MCServer/Plugins/APIDump/Hooks/OnServerPing.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua index 7cfbd06ac..e4c8b054b 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua @@ -17,7 +17,9 @@ return { Name = "Favicon", Type = "string", Notes = "The base64 encoded favicon to be displayed in the server list for compatible clients" }, }, Returns = [[ - The plugin may return a boolean. + The plugin returns res, ServerDescription, OnlinePlayersCount, MaxPlayersCount, Favicon. + res is a boolean which stops other plugins being notified of the ping if it's set to true, and the others + are the same as the arguments, and if emitted change the values transmitted to the client. ]], }, -- HOOK_SERVER_PING } -- cgit v1.2.3 From e5873d4e890ab4c5cdff365790a368d99984944d Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 27 Sep 2014 21:28:59 +0100 Subject: Copy edit. --- MCServer/Plugins/APIDump/Hooks/OnServerPing.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua index e4c8b054b..2a6aaee27 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua @@ -7,7 +7,7 @@ return Desc = [[ A plugin may implement an OnServerPing() function and register it as a Hook to process pings from clients in the server server list. It can change the logged in players and player capacity, as well - as the server description and the favicon by editing the values passed in. + as the server description and the favicon, that are displayed to the client in the server list. ]], Params = { { Name = "ClientHandle", Type = "{{cClientHandle}}", Notes = "The client handle that pinged the server" }, -- cgit v1.2.3 From 24275e058b9e98d43c21d6754b29defc1cba28f6 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sat, 27 Sep 2014 21:35:08 +0100 Subject: changed description to be more readable. --- MCServer/Plugins/APIDump/Hooks/OnServerPing.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua index 2a6aaee27..6dcaf3f17 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua @@ -17,9 +17,8 @@ return { Name = "Favicon", Type = "string", Notes = "The base64 encoded favicon to be displayed in the server list for compatible clients" }, }, Returns = [[ - The plugin returns res, ServerDescription, OnlinePlayersCount, MaxPlayersCount, Favicon. - res is a boolean which stops other plugins being notified of the ping if it's set to true, and the others - are the same as the arguments, and if emitted change the values transmitted to the client. + The plugin can return whether to continue processing of the hook with other plugins, the server description to + be displayed to the client, the currently online players, the player cap and the base64/png favicon data, in that order. ]], }, -- HOOK_SERVER_PING } -- cgit v1.2.3 From 4a4411d4d72efd13b38df813321565898d9da60f Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sun, 28 Sep 2014 09:28:51 +0100 Subject: Add Code example. --- MCServer/Plugins/APIDump/Hooks/OnServerPing.lua | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua index 6dcaf3f17..6d2325fe6 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua @@ -20,5 +20,31 @@ return The plugin can return whether to continue processing of the hook with other plugins, the server description to be displayed to the client, the currently online players, the player cap and the base64/png favicon data, in that order. ]], + CodeExamples = { + { + Title = "Change information returned to the player", + Desc = "Tells the client that the server description is 'test', there are one more players online than there actually are, and that the player cap is zero. It also changes the favicon data.", + Code = [[ +function OnServerPing(ClientHandle, ServerDescription, OnlinePlayers, MaxPlayers, Favicon) + -- Change Server Description + ServerDescription = "Test" + + -- Change online / max players + OnlinePlayers = OnlinePlayers + 1 + MaxPlayers = 0 + + -- Change favicon + if (cFile:IsFile("my-favicon.png")) then + local FaviconData = cFile:ReadWholeFile("my-favicon.png") + if (FaviconData != "") then + Favicon = Base64Encode(FaviconData) + end + end + + return false, ServerDescription, OnlinePlayers, MaxPlayers, Favicon +end + ]], + }, + }, }, -- HOOK_SERVER_PING } -- cgit v1.2.3 From 27331da017625c748a104c72d72c8958003e1e90 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 28 Sep 2014 11:17:36 +0200 Subject: Updated api documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index e6ee4ca10..fbed7cc00 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2035,6 +2035,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); AddRank = { Params = "RankName, MsgPrefix, MsgSuffix, MsgNameColorCode", Return = "", Notes = "Adds a new rank of the specified name and with the specified message visuals. Logs an info message and does nothing if the rank already exists." }, GetAllGroups = { Params = "", Return = "array-table of groups' names", Notes = "Returns an array-table containing the names of all the groups that are known to the manager." }, GetAllPermissions = { Params = "", Return = "array-table of permissions", Notes = "Returns an array-table containing all the permissions that are known to the manager." }, + GetAllPlayers = { Params = "", Return = "array-table of playernames", Notes = "Returns the short uuids of all defined players." }, GetAllRanks = { Params = "", Return = "array-table of ranks' names", Notes = "Returns an array-table containing the names of all the ranks that are known to the manager." }, GetDefaultRank = { Params = "", Return = "string", Notes = "Returns the name of the default rank. " }, GetGroupPermissions = { Params = "GroupName", Return = "array-table of permissions", Notes = "Returns an array-table containing the permissions that the specified group contains." }, @@ -2042,6 +2043,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); GetPlayerMsgVisuals = { Params = "PlayerUUID", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals assigned to the player. If the player is not explicitly assigned a rank, the default rank's visuals are returned. If there is an error, no value is returned at all." }, GetPlayerPermissions = { Params = "PlayerUUID", Return = "array-table of permissions", Notes = "Returns the permissions that the specified player is assigned through their rank. Returns the default rank's permissions if the player has no explicit rank assigned to them. Returns an empty array on error." }, GetPlayerRankName = { Params = "PlayerUUID", Return = "RankName", Notes = "Returns the name of the rank that is assigned to the specified player. An empty string (NOT the default rank) is returned if the player has no rank assigned to them." }, + GetPlayerName = { Params = "PlayerUUID", Return = "PlayerName", Notes = "Returns the last name that the specified player has. If the player isn't in the database, An empty string is returned if the player isn't in the database." }, GetRankGroups = { Params = "RankName", Return = "array-table of groups' names", Notes = "Returns an array-table of the names of all the groups that are assigned to the specified rank. Returns an empty table if there is no such rank." }, GetRankPermissions = { Params = "RankName", Return = "array-table of permissions", Notes = "Returns an array-table of all the permissions that are assigned to the specified rank through its groups. Returns an empty table if there is no such rank." }, GetRankVisuals = { Params = "RankName", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals for the specified rank. Returns no value if the specified rank does not exist." }, -- cgit v1.2.3 From 63c53a8e23776cc3011fd0260857bd22274e2c62 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 28 Sep 2014 15:16:11 +0200 Subject: cRankManager: Added ClearPlayerRanks() --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index fbed7cc00..2250092ba 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2033,6 +2033,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); AddGroupToRank = { Params = "GroupName, RankName", Return = "bool", Notes = "Adds the specified group to the specified rank. Returns true on success, false on failure - if the group name or the rank name is not found." }, AddPermissionToGroup = { Params = "Permission, GroupName", Return = "bool", Notes = "Adds the specified permission to the specified group. Returns true on success, false on failure - if the group name is not found." }, AddRank = { Params = "RankName, MsgPrefix, MsgSuffix, MsgNameColorCode", Return = "", Notes = "Adds a new rank of the specified name and with the specified message visuals. Logs an info message and does nothing if the rank already exists." }, + ClearPlayerRanks = { Params = "", Return = "", Notes = "Removes all player ranks from the database. Note that this doesn't change the cPlayer instances for the already connected players, you need to update all the instances manually." }, GetAllGroups = { Params = "", Return = "array-table of groups' names", Notes = "Returns an array-table containing the names of all the groups that are known to the manager." }, GetAllPermissions = { Params = "", Return = "array-table of permissions", Notes = "Returns an array-table containing all the permissions that are known to the manager." }, GetAllPlayers = { Params = "", Return = "array-table of playernames", Notes = "Returns the short uuids of all defined players." }, -- cgit v1.2.3 From 3c6ce77934c83972a1ea9c6f9e7cf6af0e44d8c9 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 29 Sep 2014 20:39:09 +0200 Subject: Fixed a typo in the description. --- MCServer/Plugins/APIDump/APIDesc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 6c13597f4..eace16c96 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2045,7 +2045,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); GetPlayerMsgVisuals = { Params = "PlayerUUID", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals assigned to the player. If the player is not explicitly assigned a rank, the default rank's visuals are returned. If there is an error, no value is returned at all." }, GetPlayerPermissions = { Params = "PlayerUUID", Return = "array-table of permissions", Notes = "Returns the permissions that the specified player is assigned through their rank. Returns the default rank's permissions if the player has no explicit rank assigned to them. Returns an empty array on error." }, GetPlayerRankName = { Params = "PlayerUUID", Return = "RankName", Notes = "Returns the name of the rank that is assigned to the specified player. An empty string (NOT the default rank) is returned if the player has no rank assigned to them." }, - GetPlayerName = { Params = "PlayerUUID", Return = "PlayerName", Notes = "Returns the last name that the specified player has. If the player isn't in the database, An empty string is returned if the player isn't in the database." }, + GetPlayerName = { Params = "PlayerUUID", Return = "PlayerName", Notes = "Returns the last name that the specified player has, for a player in the ranks database. An empty string is returned if the player isn't in the database." }, GetRankGroups = { Params = "RankName", Return = "array-table of groups' names", Notes = "Returns an array-table of the names of all the groups that are assigned to the specified rank. Returns an empty table if there is no such rank." }, GetRankPermissions = { Params = "RankName", Return = "array-table of permissions", Notes = "Returns an array-table of all the permissions that are assigned to the specified rank through its groups. Returns an empty table if there is no such rank." }, GetRankVisuals = { Params = "RankName", Return = "MsgPrefix, MsgSuffix, MsgNameColorCode", Notes = "Returns the message visuals for the specified rank. Returns no value if the specified rank does not exist." }, -- cgit v1.2.3 From 7a8ca26052f37d9e766f7f40ecff867aadfbbd2c Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 29 Sep 2014 21:46:38 +0200 Subject: Updated the Core. --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 9de860603..4fc575c05 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 9de86060388b515642c55d58b44b4281285efc00 +Subproject commit 4fc575c0567a570618cea09caa47fb5bcde6d5b9 -- cgit v1.2.3 From 33dc66a4d23246b5794cf9ca5bd4287a72db4cec Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 29 Sep 2014 22:00:14 +0200 Subject: RankMgr: GetAllPlayers() returns players sorted by name. --- MCServer/Plugins/APIDump/APIDesc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index eace16c96..9bc6299d9 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2037,7 +2037,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); ClearPlayerRanks = { Params = "", Return = "", Notes = "Removes all player ranks from the database. Note that this doesn't change the cPlayer instances for the already connected players, you need to update all the instances manually." }, GetAllGroups = { Params = "", Return = "array-table of groups' names", Notes = "Returns an array-table containing the names of all the groups that are known to the manager." }, GetAllPermissions = { Params = "", Return = "array-table of permissions", Notes = "Returns an array-table containing all the permissions that are known to the manager." }, - GetAllPlayers = { Params = "", Return = "array-table of playernames", Notes = "Returns the short uuids of all defined players." }, + GetAllPlayers = { Params = "", Return = "array-table of uuids", Notes = "Returns the short uuids of all defined players, sorted by the players' names (case insensitive)." }, GetAllRanks = { Params = "", Return = "array-table of ranks' names", Notes = "Returns an array-table containing the names of all the ranks that are known to the manager." }, GetDefaultRank = { Params = "", Return = "string", Notes = "Returns the name of the default rank. " }, GetGroupPermissions = { Params = "GroupName", Return = "array-table of permissions", Notes = "Returns an array-table containing the permissions that the specified group contains." }, -- cgit v1.2.3 From cba871fd872cd49eb668e785e4525234d90089e3 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 29 Sep 2014 22:00:36 +0200 Subject: Updated Core. --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 4fc575c05..0e4556798 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 4fc575c0567a570618cea09caa47fb5bcde6d5b9 +Subproject commit 0e455679821740a8d7c316340f4ed5d21e011172 -- cgit v1.2.3 From 46d3d4049364fc13a536396571bef2484d842315 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 29 Sep 2014 22:12:33 +0200 Subject: Updated Core. --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 0e4556798..3a0e0597b 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 0e455679821740a8d7c316340f4ed5d21e011172 +Subproject commit 3a0e0597b7a24c44bf87ec90beb9be48d0b99709 -- cgit v1.2.3 From f2f0c26421e47ab815b25e7971e49a47f4ae1629 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 1 Oct 2014 12:14:51 +0200 Subject: APIDump: Added missing cClientHandle documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 9bc6299d9..4865fb293 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -540,6 +540,9 @@ end SetUsername = { Params = "Name", Return = "", Notes = "Sets the username" }, SetViewDistance = { Params = "ViewDistance", Return = "", Notes = "Sets the viewdistance (number of chunks loaded for the player in each direction)" }, SendBlockChange = { Params = "BlockX, BlockY, BlockZ, BlockType, BlockMeta", Return = "", Notes = "Sends a BlockChange packet to the client. This can be used to create fake blocks only for that player." }, + SendEntityAnimation = { Params = "{{cEntity|Entity}}, AnimationNumber", Return = "", Notes = "Sends the specified animation of the specified entity to the client. The AnimationNumber is protocol-specific." }, + SendSoundEffect = { Params = "SoundName, X, Y, Z, Volume, Pitch", Return = "", Notes = "Sends a sound effect request to the client. The sound is played at the specified coords, with the specified volume (a float, 1.0 is full volume, can be more) and pitch (0-255, 63 is 100%)" }, + SendTimeUpdate = { Params = "WorldAge, TimeOfDay, DoDaylightCycle", Return = "", Notes = "Sends the specified time update to the client. WorldAge is the total age of the world, in ticks. TimeOfDay is the current day's time, in ticks (0 - 24000). DoDaylightCycle is a bool that specifies whether the client should automatically move the sun (true) or keep it in the same place (false)." }, }, Constants = { -- cgit v1.2.3 From a8f29097de5857f0b3530d365bb8f02aed5bac78 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 1 Oct 2014 12:24:09 +0200 Subject: APIDump: Documented missing cCompositeChat functions. --- MCServer/Plugins/APIDump/APIDesc.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 4865fb293..2d6a8a73c 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -558,9 +558,9 @@ end and commands suggested on click. The chat message can be sent by the regular chat-sending functions, {{cPlayer}}:SendMessage(), {{cWorld}}:BroadcastChat() and {{cRoot}}:BroadcastChat().

- Note that most of the functions in this class are so-called modifiers - they modify the object and - then return the object itself, so that they can be chained one after another. See the Chaining - example below for details.

+ Note that most of the functions in this class are so-called chaining modifiers - they modify the + object and then return the object itself, so that they can be chained one after another. See the + Chaining example below for details.

Each part of the composite chat message takes a "Style" parameter, this is a string that describes the formatting. It uses the following strings, concatenated together: @@ -584,14 +584,16 @@ end { Params = "Text", Return = "", Notes = "Creates a chat message containing the specified text, parsed by the ParseText() function. This allows easy migration from old chat messages." }, }, AddRunCommandPart = { Params = "Text, Command, [Style]", Return = "self", Notes = "Adds a text which, when clicked, runs the specified command. Chaining." }, + AddShowAchievementPart = { Params = "PlayerName, AchievementName, [Style]", Return = "", Notes = "Adds a text that represents the 'Achievement get' message." }, AddSuggestCommandPart = { Params = "Text, Command, [Style]", Return = "self", Notes = "Adds a text which, when clicked, puts the specified command into the player's chat input area. Chaining." }, AddTextPart = { Params = "Text, [Style]", Return = "self", Notes = "Adds a regular text. Chaining." }, AddUrlPart = { Params = "Text, Url, [Style]", Return = "self", Notes = "Adds a text which, when clicked, opens up a browser at the specified URL. Chaining." }, Clear = { Params = "", Return = "", Notes = "Removes all parts from this object" }, ExtractText = { Params = "", Return = "string", Notes = "Returns the text from the parts that comprises the human-readable data. Used for older protocols that don't support composite chat and for console-logging." }, + GetAdditionalMessageTypeData = { Params = "", Return = "string", Notes = "Returns the AdditionalData associated with the message, such as the sender's name for mtPrivateMessage" }, GetMessageType = { Params = "", Return = "MessageType", Notes = "Returns the MessageType (mtXXX constant) that is associated with this message. When sent to a player, the message will be formatted according to this message type and the player's settings (adding \"[INFO]\" prefix etc.)" }, ParseText = { Params = "Text", Return = "self", Notes = "Adds text, while recognizing http and https URLs and old-style formatting codes (\"@2\"). Chaining." }, - SetMessageType = { Params = "MessageType", Return = "self", Notes = "Sets the MessageType (mtXXX constant) that is associated with this message. When sent to a player, the message will be formatted according to this message type and the player's settings (adding \"[INFO]\" prefix etc.) Chaining." }, + SetMessageType = { Params = "MessageType, AdditionalData", Return = "self", Notes = "Sets the MessageType (mtXXX constant) that is associated with this message. Also sets the additional data (string) associated with the message, which is specific for the message type - such as the sender's name for mtPrivateMessage. When sent to a player, the message will be formatted according to this message type and the player's settings (adding \"[INFO]\" prefix etc.). Chaining." }, UnderlineUrls = { Params = "", Return = "self", Notes = "Makes all URL parts contained in the message underlined. Doesn't affect parts added in the future. Chaining." }, }, -- cgit v1.2.3 From 196f09d4bcabd4dffb740d7d538e8c2ebfe67feb Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 1 Oct 2014 12:24:37 +0200 Subject: APIDump: Documented missing cIniFile function. --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 2d6a8a73c..db6651707 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1048,6 +1048,7 @@ ValueName0=SomeOtherValue GetValueSetB = { Params = "KeyName, ValueName, Default", Return = "bool", Notes = "Returns the value of the specified name under the specified key, as a bool. If the value doesn't exist, creates it with the specified default." }, GetValueSetF = { Params = "KeyName, ValueName, Default", Return = "number", Notes = "Returns the value of the specified name under the specified key, as a floating-point number. If the value doesn't exist, creates it with the specified default." }, GetValueSetI = { Params = "KeyName, ValueName, Default", Return = "number", Notes = "Returns the value of the specified name under the specified key, as an integer. If the value doesn't exist, creates it with the specified default." }, + HasValue = { Params = "KeyName, ValueName", Return = "bool", Notes = "Returns true if the specified value is present." }, ReadFile = { Params = "FileName, [AllowExampleFallback]", Return = "bool", Notes = "Reads the values from the specified file. Previous in-memory contents are lost. If the file cannot be opened, and AllowExample is true, another file, \"filename.example.ini\", is loaded and then saved as \"filename.ini\". Returns true if successful, false if not." }, SetValue = { -- cgit v1.2.3 From 901bed39895be35ceb66352f8120b8117f44fb4e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 1 Oct 2014 12:44:28 +0200 Subject: Unified cRoot broadcast chat documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index db6651707..b7f3e3e07 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -2086,13 +2086,20 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); ]], Functions = { - BroadcastChat = { Params = "Message", Return = "", Notes = "Broadcasts a message to every player in the server. No formatting is done by the server." }, - BroadcastChatFailure = { Params = "Message", Return = "", Notes = "Prepends Rose [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For a command that failed to run because of insufficient permissions, etc." }, - BroadcastChatFatal = { Params = "Message", Return = "", Notes = "Prepends Red [FATAL] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For a plugin that crashed, or similar." }, - BroadcastChatInfo = { Params = "Message", Return = "", Notes = "Prepends Yellow [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For informational messages, such as command usage." }, - BroadcastChatSuccess = { Params = "Message", Return = "", Notes = "Prepends Green [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For success messages." }, - BroadcastChatWarning = { Params = "Message", Return = "", Notes = "Prepends Rose [WARN] / colours entire text (depending on ShouldUseChatPrefixes()) and broadcasts message. For concerning events, such as plugin reload etc." }, - CreateAndInitializeWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Creates a new world and initializes it. If there is a world whith the same name it returns nil." }, + BroadcastChat = + { + { Params = "MessageText, MessageType", Return = "", Notes = "Broadcasts a message to all players, with its message type set to MessageType (default: mtCustom)." }, + { Params = "{{cCompositeChat|CompositeChat}}", Return = "", Notes = "Broadcasts a {{cCompositeChat|composite chat message} to all players." }, + }, + BroadcastChatDeath = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtDeath. Use for when a player has died." }, + BroadcastChatFailure = { Params = "MessageText", Return = "", Notes = "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 = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtFatal. Use for a plugin that crashed, or similar." }, + BroadcastChatInfo = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtInfo. Use for informational messages, such as command usage." }, + BroadcastChatJoin = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtJoin. Use for players joining the server." }, + BroadcastChatLeave = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtLeave. Use for players leaving the server." }, + BroadcastChatSuccess = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtSuccess. Use for success messages." }, + BroadcastChatWarning = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtWarning. Use for concerning events, such as plugin reload etc." }, + CreateAndInitializeWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Creates a new world and initializes it. If there is a world whith the same name it returns nil.

NOTEThis function is currently unsafe, do not use!" }, FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "", Notes = "Calls the given callback function for all players with names partially (or fully) matching the name string provided." }, ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature:

function Callback({{cPlayer|cPlayer}})
" }, ForEachWorld = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each world. The callback function has the following signature:
function Callback({{cWorld|cWorld}})
" }, -- cgit v1.2.3 From ac0b3168a1dc4bb80499875375c458033423e35e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 1 Oct 2014 17:29:28 +0200 Subject: APIDump: Added more of the missing documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index b7f3e3e07..2f1c766cb 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -524,6 +524,7 @@ end Functions = { GenerateOfflineUUID = { Params = "Username", Return = "string", Notes = "(STATIC) Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. Returns a 32-char UUID (no dashes)." }, + GetClientBrand = { Params = "", Return = "string", Notes = "Returns the brand that the client has sent in their MC|Brand plugin message." }, GetIPString = { Params = "", Return = "string", Notes = "Returns the IP address of the connection, as a string. Only the address part is returned, without the port number." }, GetLocale = { Params = "", Return = "Locale", Notes = "Returns the locale string that the client sends as part of the protocol handshake. Can be used to provide localized strings." }, GetPing = { Params = "", Return = "number", Notes = "Returns the ping time, in ms" }, @@ -536,6 +537,7 @@ end IsUUIDOnline = { Params = "UUID", Return = "bool", Notes = "(STATIC) Returns true if the UUID is generated by online auth, false if it is an offline-generated UUID. We use Version-3 UUIDs for offline UUIDs, online UUIDs are Version-4, thus we can tell them apart. Accepts both 32-char and 36-char UUIDs (with and without dashes). If the string given is not a valid UUID, returns false."}, Kick = { Params = "Reason", Return = "", Notes = "Kicks the user with the specified reason" }, SendPluginMessage = { Params = "Channel, Message", Return = "", Notes = "Sends the plugin message on the specified channel." }, + SetClientBrand = { Params = "ClientBrand", Return = "", Notes = "Sets the value of the client's brand. Normally this value is received from the client by a MC|Brand plugin message, this function lets plugins overwrite the value." }, SetLocale = { Params = "Locale", Return = "", Notes = "Sets the locale that MCServer keeps on record. Initially the locale is initialized in protocol handshake, this function allows plugins to override the stored value (but only server-side and only until the user disconnects)." }, SetUsername = { Params = "Name", Return = "", Notes = "Sets the username" }, SetViewDistance = { Params = "ViewDistance", Return = "", Notes = "Sets the viewdistance (number of chunks loaded for the player in each direction)" }, @@ -589,6 +591,7 @@ end AddTextPart = { Params = "Text, [Style]", Return = "self", Notes = "Adds a regular text. Chaining." }, AddUrlPart = { Params = "Text, Url, [Style]", Return = "self", Notes = "Adds a text which, when clicked, opens up a browser at the specified URL. Chaining." }, Clear = { Params = "", Return = "", Notes = "Removes all parts from this object" }, + CreateJsonString = { Params = "[AddPrefixes]", Return = "string", Notes = "Returns the entire object serialized into JSON, as it would be sent to a client. AddPrefixes specifies whether the chat prefixes should be prepended to the message, true by default." }, ExtractText = { Params = "", Return = "string", Notes = "Returns the text from the parts that comprises the human-readable data. Used for older protocols that don't support composite chat and for console-logging." }, GetAdditionalMessageTypeData = { Params = "", Return = "string", Notes = "Returns the AdditionalData associated with the message, such as the sender's name for mtPrivateMessage" }, GetMessageType = { Params = "", Return = "MessageType", Notes = "Returns the MessageType (mtXXX constant) that is associated with this message. When sent to a player, the message will be formatted according to this message type and the player's settings (adding \"[INFO]\" prefix etc.)" }, @@ -1746,6 +1749,7 @@ a_Player:OpenWindow(Window); GetItem = { Params = "", Return = "{{cItem|cItem}}", Notes = "Returns the item represented by this pickup" }, IsCollected = { Params = "", Return = "bool", Notes = "Returns true if this pickup has already been collected (is waiting to be destroyed)" }, IsPlayerCreated = { Params = "", Return = "bool", Notes = "Returns true if the pickup was created by a player" }, + SetAge = { Params = "AgeTicks", Return = "", Notes = "Sets the pickup's age, in ticks." }, }, Inherits = "cEntity", }, -- cPickup @@ -1770,8 +1774,8 @@ a_Player:OpenWindow(Window); ForceSetSpeed = { Params = "{{Vector3d|Direction}}", Notes = "Forces the player to move to the given direction." }, GetClientHandle = { Params = "", Return = "{{cClientHandle}}", Notes = "Returns the client handle representing the player's connection. May be nil (AI players)." }, GetColor = { Return = "string", Notes = "Returns the full color code to be used for this player's messages (based on their rank). Prefix player messages with this code." }, - GetPlayerListName = { Return = "string", Notes = "Returns the name that is used in the playerlist." }, GetCurrentXp = { Params = "", Return = "number", Notes = "Returns the current amount of XP" }, + GetCustomName = { Params = "", Return = "string", Notes = "Returns the custom name of this player. If the player hasn't a custom name, it will return an empty string." }, GetEffectiveGameMode = { Params = "", Return = "{{Globals#GameMode|GameMode}}", Notes = "(OBSOLETE) Returns the current resolved game mode of the player. If the player is set to inherit the world's gamemode, returns that instead. See also GetGameMode() and IsGameModeXXX() functions. Note that this function is the same as GetGameMode(), use that function instead." }, GetEquippedItem = { Params = "", Return = "{{cItem}}", Notes = "Returns the item that the player is currently holding; empty item if holding nothing." }, GetEyeHeight = { Return = "number", Notes = "Returns the height of the player's eyes, in absolute coords" }, @@ -1786,18 +1790,24 @@ a_Player:OpenWindow(Window); GetGameMode = { Return = "{{Globals#GameMode|GameMode}}", Notes = "Returns the player's gamemode. The player may have their gamemode unassigned, in which case they inherit the gamemode from the current {{cWorld|world}}.
NOTE: Instead of comparing the value returned by this function to the gmXXX constants, use the IsGameModeXXX() functions. These functions handle the gamemode inheritance automatically."}, GetIP = { Return = "string", Notes = "Returns the IP address of the player, if available. Returns an empty string if there's no IP to report."}, GetInventory = { Return = "{{cInventory|Inventory}}", Notes = "Returns the player's inventory"}, + GetLastBedPos = { Params = "", Return = "{{Vector3i}}", Notes = "Returns the position of the last bed the player has slept in, or the world's spawn if no such position was recorded." }, GetMaxSpeed = { Params = "", Return = "number", Notes = "Returns the player's current maximum speed, relative to the game default speed. Takes into account the sprinting / flying status." }, GetName = { Return = "string", Notes = "Returns the player's name" }, GetNormalMaxSpeed = { Params = "", Return = "number", Notes = "Returns the player's maximum walking speed, relative to the game default speed. Defaults to 1, but plugins may modify it for faster or slower walking." }, + GetPermissions = { Params = "", Return = "array-table of strings", Notes = "Returns the list of all permissions that the player has assigned to them through their rank." }, + GetPlayerListName = { Return = "string", Notes = "Returns the name that is used in the playerlist." }, GetResolvedPermissions = { Return = "array-table of string", Notes = "Returns all the player's permissions, as a table. The permissions are stored in the array part of the table, beginning with index 1." }, GetSprintingMaxSpeed = { Params = "", Return = "number", Notes = "Returns the player's maximum sprinting speed, relative to the game default speed. Defaults to 1.3, but plugins may modify it for faster or slower sprinting." }, GetStance = { Return = "number", Notes = "Returns the player's stance (Y-pos of player's eyes)" }, + GetTeam = { Params = "", Return = "{{cTeam}}", Notes = "Returns the team that the player belongs to, or nil if none." }, GetThrowSpeed = { Params = "SpeedCoeff", Return = "{{Vector3d}}", Notes = "Returns the speed vector for an object thrown with the specified speed coeff. Basically returns the normalized look vector multiplied by the coeff, with a slight random variation." }, GetThrowStartPos = { Params = "", Return = "{{Vector3d}}", Notes = "Returns the position where the projectiles should start when thrown by this player." }, + GetUUID = { Params = "", Return = "string", Notes = "Returns the (short) UUID that the player is using. Could be empty string for players that don't have a Mojang account assigned to them (in the future, bots for example)." }, GetWindow = { Params = "", Return = "{{cWindow}}", Notes = "Returns the currently open UI window. If the player doesn't have any UI window open, returns the inventory window." }, GetXpLevel = { Params = "", Return = "number", Notes = "Returns the current XP level (based on current XP amount)." }, GetXpLifetimeTotal = { Params = "", Return = "number", Notes = "Returns the amount of XP that has been accumulated throughout the player's lifetime." }, GetXpPercentage = { Params = "", Return = "number", Notes = "Returns the percentage of the experience bar - the amount of XP towards the next XP level. Between 0 and 1." }, + HasCustomName = { Params = "", Return = "bool", Notes = "Returns true if the player has a custom name." }, HasPermission = { Params = "PermissionString", Return = "bool", Notes = "Returns true if the player has the specified permission" }, Heal = { Params = "HitPoints", Return = "", Notes = "Heals the player by the specified amount of HPs. Only positive amounts are expected. Sends a health update to the client." }, IsEating = { Params = "", Return = "bool", Notes = "Returns true if the player is currently eating the item in their hand." }, @@ -1805,7 +1815,9 @@ a_Player:OpenWindow(Window); IsFlying = { Return = "bool", Notes = "Returns true if the player is flying." }, IsGameModeAdventure = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmAdventure gamemode, or has their gamemode unset and the world is a gmAdventure world." }, IsGameModeCreative = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmCreative gamemode, or has their gamemode unset and the world is a gmCreative world." }, + IsGameModeSpectator = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmSpectator gamemode, or has their gamemode unset and the world is a gmSpectator world." }, IsGameModeSurvival = { Params = "", Return = "bool", Notes = "Returns true if the player is in the gmSurvival gamemode, or has their gamemode unset and the world is a gmSurvival world." }, + IsInBed = { Params = "", Return = "bool", Notes = "Returns true if the player is currently lying in a bed." }, IsOnGround = { Params = "", Return = "bool", Notes = "Returns true if the player is on ground (not falling, not jumping, not flying)" }, IsSatiated = { Params = "", Return = "bool", Notes = "Returns true if the player is satiated (cannot eat)." }, IsVisible = { Params = "", Return = "bool", Notes = "Returns true if the player is visible to other players" }, @@ -1813,6 +1825,7 @@ a_Player:OpenWindow(Window); MoveTo = { Params = "{{Vector3d|NewPosition}}", Return = "Tries to move the player into the specified position." }, MoveToWorld = { Params = "WorldName", Return = "bool", Return = "Moves the player to the specified world. Returns true if successful." }, OpenWindow = { Params = "{{cWindow|Window}}", Return = "", Notes = "Opens the specified UI window for the player." }, + PermissionMatches = { Params = "Permission, Template", Return = "bool", Notes = "(STATIC) Returns true if the specified permission matches the specified template. The template may contain wildcards." }, Respawn = { Params = "", Return = "", Notes = "Restores the health, extinguishes fire, makes visible and sends the Respawn packet." }, SendMessage = { Params = "Message", Return = "", Notes = "Sends the specified message to the player." }, SendMessageFailure = { Params = "Message", Return = "", Notes = "Prepends Rose [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. For a command that failed to run because of insufficient permissions, etc." }, @@ -1821,12 +1834,12 @@ a_Player:OpenWindow(Window); SendMessagePrivateMsg = { Params = "Message, SenderName", Return = "", Notes = "Prepends Light Blue [MSG: *SenderName*] / prepends SenderName and colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. For private messaging." }, SendMessageSuccess = { Params = "Message", Return = "", Notes = "Prepends Green [INFO] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Success notification." }, SendMessageWarning = { Params = "Message, Sender", Return = "", Notes = "Prepends Rose [WARN] / colours entire text (depending on ShouldUseChatPrefixes()) and sends message to player. Denotes that something concerning, such as plugin reload, is about to happen." }, - HasCustomName = { Params = "", Return = "bool", Notes = "Returns true if the player has a custom name." }, - GetCustomName = { Params = "", Return = "string", Notes = "Returns the custom name of this player. If the player hasn't a custom name, it will return an empty string." }, - SetCustomName = { Params = "string", Return = "", Notes = "Sets the custom name of this player. If you want to disable the custom name, simply set an empty string. The custom name will be used in the tab-list, in the player nametag and in the tab-completion." }, + SendRotation = { Params = "YawDegrees, PitchDegrees", Return = "", Notes = "Sends the specified rotation to the player, forcing them to look that way" }, + SetBedPos = { Params = "{{Vector3i|Position}}", Return = "", Notes = "Sets the internal representation of the last bed position the player has slept in. The player will respawn at this position if they die." }, SetCanFly = { Params = "CanFly", Notes = "Sets if the player can fly or not." }, SetCrouch = { Params = "IsCrouched", Return = "", Notes = "Sets the crouch state, broadcasts the change to other players." }, SetCurrentExperience = { Params = "XPAmount", Return = "", Notes = "Sets the current amount of experience (and indirectly, the XP level)." }, + SetCustomName = { Params = "string", Return = "", Notes = "Sets the custom name of this player. If you want to disable the custom name, simply set an empty string. The custom name will be used in the tab-list, in the player nametag and in the tab-completion." }, SetFlying = { Params = "IsFlying", Notes = "Sets if the player is flying or not." }, SetFlyingMaxSpeed = { Params = "FlyingMaxSpeed", Return = "", Notes = "Sets the flying maximum speed, relative to the game default speed. The default value is 1. Sends the updated speed to the client." }, SetFoodExhaustionLevel = { Params = "ExhaustionLevel", Return = "", Notes = "Sets the food exhaustion to the specified level." }, @@ -1840,7 +1853,11 @@ a_Player:OpenWindow(Window); SetNormalMaxSpeed = { Params = "NormalMaxSpeed", Return = "", Notes = "Sets the normal (walking) maximum speed, relative to the game default speed. The default value is 1. Sends the updated speed to the client, if appropriate." }, SetSprint = { Params = "IsSprinting", Return = "", Notes = "Sets whether the player is sprinting or not." }, SetSprintingMaxSpeed = { Params = "SprintingMaxSpeed", Return = "", Notes = "Sets the sprinting maximum speed, relative to the game default speed. The default value is 1.3. Sends the updated speed to the client, if appropriate." }, + SetTeam = { Params = "{{cTeam|Team}}", Return = "", Notes = "Moves the player to the specified team." }, SetVisible = { Params = "IsVisible", Return = "", Notes = "Sets the player visibility to other players" }, + TossEquippedItem = { Params = "[Amount]", Return = "", Notes = "Tosses the item that the player has selected in their hotbar. Amount defaults to 1." }, + TossHeldItem = { Params = "[Amount]", Return = "", Notes = "Tosses the item held by the cursor, then the player is in a UI window. Amount defaults to 1." }, + TossPickup = { Params = "{{cItem|Item}}", Return = "", Notes = "Tosses a pickup newly created from the specified item." }, XpForLevel = { Params = "XPLevel", Return = "number", Notes = "(STATIC) Returns the total amount of XP needed for the specified XP level. Inverse of CalcLevelFromXp()." }, }, Constants = @@ -2043,7 +2060,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); ClearPlayerRanks = { Params = "", Return = "", Notes = "Removes all player ranks from the database. Note that this doesn't change the cPlayer instances for the already connected players, you need to update all the instances manually." }, GetAllGroups = { Params = "", Return = "array-table of groups' names", Notes = "Returns an array-table containing the names of all the groups that are known to the manager." }, GetAllPermissions = { Params = "", Return = "array-table of permissions", Notes = "Returns an array-table containing all the permissions that are known to the manager." }, - GetAllPlayers = { Params = "", Return = "array-table of uuids", Notes = "Returns the short uuids of all defined players, sorted by the players' names (case insensitive)." }, + GetAllPlayerUUIDs = { Params = "", Return = "array-table of uuids", Notes = "Returns the short uuids of all players stored in the rank DB, sorted by the players' names (case insensitive)." }, GetAllRanks = { Params = "", Return = "array-table of ranks' names", Notes = "Returns an array-table containing the names of all the ranks that are known to the manager." }, GetDefaultRank = { Params = "", Return = "string", Notes = "Returns the name of the default rank. " }, GetGroupPermissions = { Params = "GroupName", Return = "array-table of permissions", Notes = "Returns an array-table containing the permissions that the specified group contains." }, -- cgit v1.2.3 From adab829d8fc24e0bc21737f5e125e19620b1f87c Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 1 Oct 2014 20:14:28 +0100 Subject: Fixed broken code. --- MCServer/Plugins/APIDump/Hooks/OnServerPing.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua index 6d2325fe6..db1707e47 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua @@ -34,9 +34,9 @@ function OnServerPing(ClientHandle, ServerDescription, OnlinePlayers, MaxPlayers MaxPlayers = 0 -- Change favicon - if (cFile:IsFile("my-favicon.png")) then + if cFile:IsFile("my-favicon.png") then local FaviconData = cFile:ReadWholeFile("my-favicon.png") - if (FaviconData != "") then + if FaviconData ~= "" and FaviconData ~= nil then Favicon = Base64Encode(FaviconData) end end -- cgit v1.2.3 From a765e43ee0db7be62a7d5c643a70cfec5a07d116 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 1 Oct 2014 22:29:38 +0200 Subject: APIDump: Fixed cEntity documentation. --- MCServer/Plugins/APIDump/APIDesc.lua | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 2f1c766cb..bf5003035 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -785,7 +785,9 @@ end AddSpeedX = { Params = "AddX", Return = "", Notes = "Adds the specified amount of speed in the X axis direction." }, AddSpeedY = { Params = "AddY", Return = "", Notes = "Adds the specified amount of speed in the Y axis direction." }, AddSpeedZ = { Params = "AddZ", Return = "", Notes = "Adds the specified amount of speed in the Z axis direction." }, + ArmorCoversAgainst = { Params = "{{cEntity|AttackerEntity}}, DamageType, RawDamage", Return = "number", Notes = "Returns the points out of a_RawDamage that the currently equipped armor would cover." }, Destroy = { Params = "", Return = "", Notes = "Schedules the entity to be destroyed" }, + GetAirLevel = { Params = "", Return = "number", Notes = "Returns the air level (number of ticks of air left). Note, this function is only updated with mobs or players." }, GetArmorCoverAgainst = { Params = "AttackerEntity, DamageType, RawDamage", Return = "number", Notes = "Returns the number of hitpoints out of RawDamage that the currently equipped armor would cover. See {{TakeDamageInfo}} for more information on attack damage." }, GetChunkX = { Params = "", Return = "number", Notes = "Returns the X-coord of the chunk in which the entity is placed" }, GetChunkZ = { Params = "", Return = "number", Notes = "Returns the Z-coord of the chunk in which the entity is placed" }, @@ -801,6 +803,7 @@ end GetHeadYaw = { Params = "", Return = "number", Notes = "Returns the pitch of the entity's head (FIXME: Rename to GetHeadPitch() )." }, GetHealth = { Params = "", Return = "number", Notes = "Returns the current health of the entity." }, GetHeight = { Params = "", Return = "number", Notes = "Returns the height (Y size) of the entity" }, + GetInvulnerableTicks = { Params = "", Return = "number", Notes = "Returns the number of ticks that this entity will be invulnerable for. This is used for after-hit recovery - the entities are invulnerable for half a second after being hit." }, GetKnockbackAmountAgainst = { Params = "ReceiverEntity", Return = "number", Notes = "Returns the amount of knockback that the currently equipped items would cause when attacking the ReceiverEntity." }, GetLookVector = { Params = "", Return = "{{Vector3f}}", Notes = "Returns the vector that defines the direction in which the entity is looking" }, GetMass = { Params = "", Return = "number", Notes = "Returns the mass of the entity. Currently unused." }, @@ -818,23 +821,29 @@ end GetSpeedX = { Params = "", Return = "number", Notes = "Returns the X-part of the speed vector" }, GetSpeedY = { Params = "", Return = "number", Notes = "Returns the Y-part of the speed vector" }, GetSpeedZ = { Params = "", Return = "number", Notes = "Returns the Z-part of the speed vector" }, + GetTicksAlive = { Params = "", Return = "number", Notes = "Returns the number of ticks that this entity has been alive for." }, GetUniqueID = { Params = "", Return = "number", Notes = "Returns the ID that uniquely identifies the entity within the running server. Note that this ID is not persisted to the data files." }, GetWidth = { Params = "", Return = "number", Notes = "Returns the width (X and Z size) of the entity." }, GetWorld = { Params = "", Return = "{{cWorld}}", Notes = "Returns the world where the entity resides" }, GetYaw = { Params = "", Return = "number", Notes = "Returns the yaw (direction) of the entity. Measured in degrees, values range from -180 to +180. 0 means ZP, 90 means XM, -180 means ZM, -90 means XP." }, + HandleSpeedFromAttachee = { Params = "ForwardAmount, SidewaysAmount", Return = "", Notes = "Updates the entity's speed based on the attachee exerting the specified force forward and sideways. Used for entities being driven by other entities attached to them - usually players driving minecarts and boats." }, Heal = { Params = "Hitpoints", Return = "", Notes = "Heals the specified number of hitpoints. Hitpoints is expected to be a positive number." }, IsA = { Params = "ClassName", Return = "bool", Notes = "Returns true if the entity class is a descendant of the specified class name, or the specified class itself" }, IsBoat = { Params = "", Return = "bool", Notes = "Returns true if the entity is a {{cBoat|boat}}." }, IsCrouched = { Params = "", Return = "bool", Notes = "Returns true if the entity is crouched. Always false for entities that don't support crouching." }, IsDestroyed = { Params = "", Return = "bool", Notes = "Returns true if the entity has been destroyed and is awaiting removal from the internal structures." }, + IsEnderCrystal = { Params = "", Return = "bool", Notes = "Returns true if the entity is an ender crystal." }, IsExpOrb = { Params = "", Return = "bool", Notes = "Returns true if the entity represents an experience orb" }, IsFallingBlock = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cFallingBlock}} entity." }, + IsFireproof = { Params = "", Return = "bool", Notes = "Returns true if the entity takes no damage from being on fire." }, IsFloater = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a fishing rod floater" }, IsInvisible = { Params = "", Return = "bool", Notes = "Returns true if the entity is invisible" }, + IsItemFrame = { Params = "", Return = "bool", Notes = "Returns true if the entity is an item frame." }, IsMinecart = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cMinecart|minecart}}" }, IsMob = { Params = "", Return = "bool", Notes = "Returns true if the entity represents any {{cMonster|mob}}." }, IsOnFire = { Params = "", Return = "bool", Notes = "Returns true if the entity is on fire" }, IsPainting = { Params = "", Return = "bool", Notes = "Returns if this entity is a painting." }, + IsPawn = { Params = "", Return = "bool", Notes = "Returns true if the entity is a {{cPawn}} descendant." }, IsPickup = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cPickup|pickup}}." }, IsPlayer = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cPlayer|player}}" }, IsProjectile = { Params = "", Return = "bool", Notes = "Returns true if the entity is a {{cProjectileEntity}} descendant." }, @@ -844,12 +853,19 @@ end IsSubmerged = { Params = "", Return = "bool", Notes = "Returns true if the mob or player is submerged in water (head is in a water block). Note, this function is only updated with mobs or players." }, IsSwimming = { Params = "", Return = "bool", Notes = "Returns true if the mob or player is swimming in water (feet are in a water block). Note, this function is only updated with mobs or players." }, IsTNT = { Params = "", Return = "bool", Notes = "Returns true if the entity represents a {{cTNTEntity|TNT entity}}" }, + Killed = { Params = "{{cEntity|Victim}}", Return = "", Notes = "This entity has killed another entity (the Victim). For players, adds the scoreboard statistics about the kill." }, KilledBy = { Notes = "FIXME: Remove this from API" }, - GetAirLevel = { Params = "", Return = "number", Notes = "Returns the air level (number of ticks of air left). Note, this function is only updated with mobs or players." }, + MoveToWorld = + { + { Params = "{{cWorld|World}}, [ShouldSendRespawn]", Return = "bool", Notes = "Removes the entity from this world and starts moving it to the specified world. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Repawn packet upon leaving the world (The client handles respawns only between different dimensions)." }, + { Params = "WorldName, [ShouldSendRespawn]", Return = "bool", Notes = "Removes the entity from this world and starts moving it to the specified world. Note that to avoid deadlocks, the move is asynchronous - the entity is moved into a queue and will be moved from that queue into the destination world at some (unpredictable) time in the future. ShouldSendRespawn is used only for players, it specifies whether the player should be sent a Repawn packet upon leaving the world (The client handles respawns only between different dimensions)." }, + }, SetGravity = { Params = "Gravity", Return = "", Notes = "Sets the number that is used as the gravity for physics simulation. 1G (9.78) by default." }, SetHeadYaw = { Params = "HeadPitch", Return = "", Notes = "Sets the head pitch (FIXME: Rename to SetHeadPitch() )." }, SetHealth = { Params = "Hitpoints", Return = "", Notes = "Sets the entity's health to the specified amount of hitpoints. Doesn't broadcast any hurt animation. Doesn't kill the entity if health drops below zero. Use the TakeDamage() function instead for taking damage." }, SetHeight = { Params = "", Return = "", Notes = "FIXME: Remove this from API" }, + SetInvulnerableTicks = { Params = "NumTicks", Return = "", Notes = "Sets the amount of ticks for which the entity will not receive any damage from other entities." }, + SetIsFireproof = { Params = "IsFireproof", Return = "", Notes = "Sets whether the entity receives damage from being on fire." }, SetMass = { Params = "Mass", Return = "", Notes = "Sets the mass of the entity. Currently unused." }, SetMaxHealth = { Params = "MaxHitpoints", Return = "", Notes = "Sets the maximum hitpoints of the entity. If current health is above MaxHitpoints, it is capped to MaxHitpoints." }, SetPitch = { Params = "number", Return = "", Notes = "Sets the pitch (nose-down rotation) of the entity" }, @@ -864,7 +880,7 @@ end SetPosZ = { Params = "number", Return = "", Notes = "Sets the Z-coord of the entity's pivot" }, SetRoll = { Params = "number", Return = "", Notes = "Sets the roll (sideways rotation) of the entity. Currently unused." }, SetRot = { Params = "{{Vector3f|Rotation}}", Return = "", Notes = "Sets the entire rotation vector (Yaw, Pitch, Roll)" }, - SetYawFromSpeed = { Params = "", Return = "", Notes = "Sets the entity's yaw to match its current speed (entity looking forwards as it moves). (FIXME: Rename to SetYawFromSpeed)" }, + SetYawFromSpeed = { Params = "", Return = "", Notes = "Sets the entity's yaw to match its current speed (entity looking forwards as it moves)." }, SetSpeed = { { Params = "SpeedX, SpeedY, SpeedZ", Return = "", Notes = "Sets the current speed of the entity" }, @@ -890,18 +906,20 @@ end Constants = { etBoat = { Notes = "The entity is a {{cBoat}}" }, + etEnderCrystal = { Notes = "" }, etEntity = { Notes = "No further specialization available" }, etExpOrb = { Notes = "The entity is a {{cExpOrb}}" }, etFallingBlock = { Notes = "The entity is a {{cFallingBlock}}" }, etFloater = { Notes = "The entity is a fishing rod floater" }, + etItemFrame = { Notes = "" }, + etMinecart = { Notes = "The entity is a {{cMinecart}} descendant" }, etMob = { Notes = "The entity is a {{cMonster}} descendant" }, etMonster = { Notes = "The entity is a {{cMonster}} descendant" }, - etMinecart = { Notes = "The entity is a {{cMinecart}} descendant" }, - etPlayer = { Notes = "The entity is a {{cPlayer}}" }, + etPainting = { Notes = "The entity is a {{cPainting}}" }, etPickup = { Notes = "The entity is a {{cPickup}}" }, + etPlayer = { Notes = "The entity is a {{cPlayer}}" }, etProjectile = { Notes = "The entity is a {{cProjectileEntity}} descendant" }, etTNT = { Notes = "The entity is a {{cTNTEntity}}" }, - etPainting = { Notes = "The entity is a {{cPainting}}" }, }, ConstantGroups = { -- cgit v1.2.3 From 7c731dbd8ac55c5e5660df0e1f745a76489b646c Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 1 Oct 2014 21:37:20 +0100 Subject: Added parentheses for clarity. --- MCServer/Plugins/APIDump/Hooks/OnServerPing.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua index db1707e47..76b6d1517 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnServerPing.lua @@ -36,7 +36,7 @@ function OnServerPing(ClientHandle, ServerDescription, OnlinePlayers, MaxPlayers -- Change favicon if cFile:IsFile("my-favicon.png") then local FaviconData = cFile:ReadWholeFile("my-favicon.png") - if FaviconData ~= "" and FaviconData ~= nil then + if (FaviconData ~= "") and (FaviconData ~= nil) then Favicon = Base64Encode(FaviconData) end end -- cgit v1.2.3 From 02617a11cd6454c7a1d35bded1413828460cfdeb Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 5 Oct 2014 15:05:24 +0200 Subject: Updated Core. --- MCServer/Plugins/Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core index 3a0e0597b..f8c2531fb 160000 --- a/MCServer/Plugins/Core +++ b/MCServer/Plugins/Core @@ -1 +1 @@ -Subproject commit 3a0e0597b7a24c44bf87ec90beb9be48d0b99709 +Subproject commit f8c2531fbef9bfd0b6f024d4d3319384a70a0831 -- cgit v1.2.3 From a8aeceab9d6e5e5e36ef7bd58783b65aca4d8be7 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 5 Oct 2014 20:19:21 +0200 Subject: cClientHandle: Added protocol version knowledge. --- MCServer/Plugins/APIDump/APIDesc.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index bf5003035..6a151b5ef 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -529,6 +529,7 @@ end GetLocale = { Params = "", Return = "Locale", Notes = "Returns the locale string that the client sends as part of the protocol handshake. Can be used to provide localized strings." }, GetPing = { Params = "", Return = "number", Notes = "Returns the ping time, in ms" }, 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." }, + GetProtocolVersion = { Params = "", Return = "number", Notes = "Returns the protocol version number of the protocol that the client is talking. Returns zero if the protocol version is not (yet) known." }, 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. Returns a 32-char UUID (no dashes)" }, GetUsername = { Params = "", Return = "string", Notes = "Returns the username that the client has provided" }, -- cgit v1.2.3 From de41e2a04cfae499e89f7edd96e160d854f6602c Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:04:26 +0100 Subject: Removed ChunkWorx --- MCServer/Plugins/ChunkWorx/ChunkWorx.deproj | 9 - MCServer/Plugins/ChunkWorx/chunkworx_main.lua | 128 ------------ MCServer/Plugins/ChunkWorx/chunkworx_web.lua | 274 -------------------------- 3 files changed, 411 deletions(-) delete mode 100644 MCServer/Plugins/ChunkWorx/ChunkWorx.deproj delete mode 100644 MCServer/Plugins/ChunkWorx/chunkworx_main.lua delete mode 100644 MCServer/Plugins/ChunkWorx/chunkworx_web.lua (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/ChunkWorx/ChunkWorx.deproj b/MCServer/Plugins/ChunkWorx/ChunkWorx.deproj deleted file mode 100644 index 17420d1d7..000000000 --- a/MCServer/Plugins/ChunkWorx/ChunkWorx.deproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - chunkworx_main.lua - - - chunkworx_web.lua - - diff --git a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua b/MCServer/Plugins/ChunkWorx/chunkworx_main.lua deleted file mode 100644 index 88ecb3979..000000000 --- a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua +++ /dev/null @@ -1,128 +0,0 @@ --- Global variables -PLUGIN = {} -- Reference to own plugin object -GENERATION_STATE = 0 -OPERATION_CODE = 0 -- 0 = generation -CX = 0 -CZ = 0 -CURRENT = 0 -TOTAL = 0 - --- AREA Variables -AreaStartX = -10 -AreaStartZ = -10 -AreaEndX = 10 -AreaEndZ = 10 - --- RADIAL Variables -RadialX = 0 -RadialZ = 0 -Radius = 10 - --- WORLD -WORK_WORLD = cRoot:Get():GetDefaultWorld():GetName() -WW_instance = cRoot:Get():GetDefaultWorld() -WORLDS = {} - - - - - -function Initialize(Plugin) - PLUGIN = Plugin - - PLUGIN:SetName("ChunkWorx") - PLUGIN:SetVersion(6) - - cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick) - - Plugin:AddWebTab("(Re)Generation", HandleRequest_Generation) - - GENERATION_STATE = 0 - WW_instance = cRoot:Get():GetWorld(WORK_WORLD) - if (WW_instance == nil) then - LOG("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": NO WORLD found :(") - end - - -- Read the stored values: - local SettingsIni = cIniFile(); - SettingsIni:ReadFile("ChunkWorx.ini"); -- ignore any read errors - AreaStartX = SettingsIni:GetValueSetI("Area data", "StartX", AreaStartX) - AreaStartZ = SettingsIni:GetValueSetI("Area data", "StartZ", AreaStartZ) - AreaEndX = SettingsIni:GetValueSetI("Area data", "EndX", AreaEndX) - AreaEndZ = SettingsIni:GetValueSetI("Area data", "EndZ", AreaEndZ) - RadialX = SettingsIni:GetValueSetI("Radial data", "RadialX", RadialX) - RadialZ = SettingsIni:GetValueSetI("Radial data", "RadialZ", RadialZ) - Radius = SettingsIni:GetValueSetI("Radial data", "Radius", Radius) - SettingsIni:WriteFile("ChunkWorx.ini"); - - LOG("Initialized " .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion()) - return true -end - - - - - -function OnTick( DeltaTime ) - if (GENERATION_STATE == 1 or GENERATION_STATE == 3) then - LOGINFO("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": works STARTED!") - LOGINFO("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": At world: " .. WORK_WORLD) - WW_instance = cRoot:Get():GetWorld(WORK_WORLD) - if (GENERATION_STATE == 1) then GENERATION_STATE = 2 end - if (GENERATION_STATE == 3) then GENERATION_STATE = 4 end - - -- Changing in case coordinates are flipped - local shifter = AreaEndX - if (AreaStartX > AreaEndX) then - AreaEndX = AreaStartX - AreaStartX = shifter - end - shifter = AreaEndZ - if (AreaStartZ > AreaEndZ) then - AreaEndZ = AreaStartZ - AreaStartZ = shifter - end - - CX = AreaStartX - CZ = AreaStartZ - CURRENT = 0 - - if (WW_instance == nil) then - LOGERROR("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": works ABORTED") - LOGERROR("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": NO WORLD found :(") - GENERATION_STATE = 0 - end - end - - - - if (GENERATION_STATE == 2 or GENERATION_STATE == 4) then - if (WW_instance:GetGeneratorQueueLength() < 200 - and WW_instance:GetLightingQueueLength() < 200 - and (WW_instance:GetStorageSaveQueueLength() + WW_instance:GetStorageLoadQueueLength()) < 80) then - local chunk_sum = (1+ AreaEndX - AreaStartX) * (1+ AreaEndZ - AreaStartZ) - TOTAL = chunk_sum - LOG("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": PROCESSING 100 chunks, (" .. CURRENT .. "/" .. chunk_sum .. ")") - for C = 1, 100 do - if (GENERATION_STATE == 2) then WW_instance:GenerateChunk(CX, CZ) end - if (GENERATION_STATE == 4) then WW_instance:RegenerateChunk(CX, CZ) end - - CX = CX + 1 - CURRENT = CURRENT + 1 - if (CX > AreaEndX) then - CX = AreaStartX - CZ = CZ + 1 - if (CZ > AreaEndZ) then - if (GENERATION_STATE == 2) then LOGINFO("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. " - generation ENDED!") end - if (GENERATION_STATE == 4) then LOGINFO("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. " - REgeneration ENDED!") end - - GENERATION_STATE = 0 - break - end - end - end - WW_instance:QueueSaveAllChunks() - WW_instance:QueueUnloadUnusedChunks() - end - end -end \ No newline at end of file diff --git a/MCServer/Plugins/ChunkWorx/chunkworx_web.lua b/MCServer/Plugins/ChunkWorx/chunkworx_web.lua deleted file mode 100644 index 9aec38b12..000000000 --- a/MCServer/Plugins/ChunkWorx/chunkworx_web.lua +++ /dev/null @@ -1,274 +0,0 @@ - --- chunkworx_web.lua - --- WebAdmin-related functions - - - - - -local function Buttons_Player( Name ) - return "
" -end - - - - - -local function Button_World( Name ) - return "
" -end - - - - - -local function SaveSettings() - local SettingsIni = cIniFile() - SettingsIni:SetValueI("Area data", "StartX", AreaStartX) - SettingsIni:SetValueI("Area data", "StartZ", AreaStartZ) - SettingsIni:SetValueI("Area data", "EndX", AreaEndX) - SettingsIni:SetValueI("Area data", "EndZ", AreaEndZ) - SettingsIni:SetValueI("Radial data", "RadialX", RadialX) - SettingsIni:SetValueI("Radial data", "RadialZ", RadialZ) - SettingsIni:SetValueI("Radial data", "Radius", Radius) - SettingsIni:WriteFile("ChunkWorx.ini") -end - - - - - -function HandleRequest_Generation( Request ) - local Content = "" - if (Request.PostParams["AGHRRRR"] ~= nil) then - GENERATION_STATE = 0 - WW_instance:QueueSaveAllChunks() - WW_instance:QueueUnloadUnusedChunks() - LOGERROR("" .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. ": works ABORTED by admin") - end - --Content = Content .. "" - -- PROCESSING - -------------------------------------------------------------------------------------------------- - local function ProcessingContent() - local _small_content = "" - _small_content = _small_content .. "" - _small_content = _small_content .. "

World for operations:

"..WORK_WORLD - if (OPERATION_CODE == 0) then - _small_content = _small_content .. "

Operation:

Generation" - elseif (OPERATION_CODE == 1) then - _small_content = _small_content .. "

Operation:

Regeneration" - end - _small_content = _small_content .. "

Area:

["..AreaStartX..":"..AreaStartZ.."] ["..AreaEndX..":"..AreaEndZ.."]" - _small_content = _small_content .. "

Progress:

"..CURRENT.."/"..TOTAL - _small_content = _small_content .. "
" - _small_content = _small_content .. "
" - _small_content = _small_content .. "" - _small_content = _small_content .. "
" - return _small_content - end - if (GENERATION_STATE == 2 or GENERATION_STATE == 4) then - Content = ProcessingContent() - return Content - end - -- SELECTING - -------------------------------------------------------------------------------------------------- - if ( Request.PostParams["FormSetWorld"] ) then - WORK_WORLD = Request.PostParams["FormWorldName"] - WW_instance = cRoot:Get():GetWorld(WORK_WORLD) - end - - if( Request.PostParams["SelectWorld"] ~= nil - and Request.PostParams["WorldName"] ~= nil ) then -- World is selected! - WORK_WORLD = Request.PostParams["WorldName"] - WW_instance = cRoot:Get():GetWorld(WORK_WORLD) - end - - if(Request.PostParams["OperationGenerate"] ~= nil) then - OPERATION_CODE = 0 - end - if(Request.PostParams["OperationReGenerate"] ~= nil) then - OPERATION_CODE = 1 - end - - if (GENERATION_STATE == 0) then - if( Request.PostParams["FormAreaStartX"] ~= nil - and Request.PostParams["FormAreaStartZ"] ~= nil - and Request.PostParams["FormAreaEndX"] ~= nil - and Request.PostParams["FormAreaEndZ"] ~= nil ) then --(Re)Generation valid! - -- COMMON (Re)gen - if( Request.PostParams["StartArea"]) then - AreaStartX = tonumber(Request.PostParams["FormAreaStartX"]) - AreaStartZ = tonumber(Request.PostParams["FormAreaStartZ"]) - AreaEndX = tonumber(Request.PostParams["FormAreaEndX"]) - AreaEndZ = tonumber(Request.PostParams["FormAreaEndZ"]) - SaveSettings(); - if (OPERATION_CODE == 0) then - GENERATION_STATE = 1 - elseif (OPERATION_CODE == 1) then - GENERATION_STATE = 3 - end - Content = ProcessingContent() - return Content - end - end - if( Request.PostParams["FormRadialX"] ~= nil - and Request.PostParams["FormRadialZ"] ~= nil - and Request.PostParams["FormRadius"] ~= nil ) then --(Re)Generation valid! - -- COMMON (Re)gen - if( Request.PostParams["StartRadial"]) then - RadialX = tonumber(Request.PostParams["FormRadialX"]) or 0 - RadialZ = tonumber(Request.PostParams["FormRadialZ"]) or 0 - Radius = tonumber(Request.PostParams["FormRadius"]) or 10 - AreaStartX = RadialX - Radius - AreaStartZ = RadialZ - Radius - AreaEndX = RadialX + Radius - AreaEndZ = RadialZ + Radius - SaveSettings() - if (OPERATION_CODE == 0) then - GENERATION_STATE = 1 - elseif (OPERATION_CODE == 1) then - GENERATION_STATE = 3 - end - Content = ProcessingContent() - return Content - end - end - -- POINT REGEN! - if( Request.PostParams["FormPointX"] ~= nil - and Request.PostParams["FormPointZ"] ~= nil ) then --ReGeneration valid! - -- EXACT - if ( Request.PostParams["PointExact"] ~= nil) then - AreaStartX = tonumber(Request.PostParams["FormPointX"]) - AreaStartZ = tonumber(Request.PostParams["FormPointZ"]) - AreaEndX = AreaStartX - AreaEndZ = AreaStartZ - GENERATION_STATE = 3 - Content = ProcessingContent() - return Content - end - -- 3x3 - if ( Request.PostParams["Point3x3"] ~= nil) then - AreaStartX = tonumber(Request.PostParams["FormPointX"]) - 1 - AreaStartZ = tonumber(Request.PostParams["FormPointZ"]) - 1 - AreaEndX = AreaStartX + 2 - AreaEndZ = AreaStartZ + 2 - GENERATION_STATE = 3 - Content = ProcessingContent() - return Content - end - end - - local GetAreaByPlayer = function(Player) - -- Player is valid only within this function, it cannot be stord and used later! - AreaStartX = Player:GetChunkX() - AreaStartZ = Player:GetChunkZ() - end - -- PLAYERS REGEN! - if( Request.PostParams["PlayerExact"] ~= nil - and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate... - cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer) - AreaEndX = AreaStartX - AreaEndZ = AreaStartZ - GENERATION_STATE = 3 - Content = ProcessingContent() - return Content - end - if( Request.PostParams["Player3x3"] ~= nil - and Request.PostParams["PlayerName"] ~= nil ) then -- Making BOOM! I meant, regenereate... - cRoot:Get():GetWorld(WORK_WORLD):DoWithPlayer(Request.PostParams["PlayerName"],GetAreaByPlayer) - AreaStartX = AreaStartX - 1 - AreaStartZ = AreaStartZ - 1 - AreaEndX = AreaStartX + 2 - AreaEndZ = AreaStartZ + 2 - GENERATION_STATE = 3 - Content = ProcessingContent() - return Content - end - end - - --Content = Content .. "

World for operations: " .. WORK_WORLD .. "

" - --Content = Content .. "
" - --Content = Content .. "" - --Content = Content .. "
" - - -- SELECTING WORK_WORLD - Content = Content .. "

World for operations: " .. WORK_WORLD .. "

" - Content = Content .. "" - local WorldNum = 0 - local AddWorldToTable = function(World) - WorldNum = WorldNum + 1 - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - end - cRoot:Get():ForEachWorld(AddWorldToTable) - if( WorldNum == 0 ) then - Content = Content .. "" - end - Content = Content .. "
" .. WorldNum .. "." .. World:GetName() .. "" .. Button_World(World:GetName()) .. "
No worlds! O_O
" - Content = Content .. "
" - - -- SELECTING OPERATION - if (OPERATION_CODE == 0) then - Content = Content .. "

Operation: Generation

" - elseif (OPERATION_CODE == 1) then - Content = Content .. "

Operation: Regeneration

" - end - Content = Content .. "
" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "
" - - -- SELECTING AREA - Content = Content .. "

Area:

Start X, Start Z; End X, End Z" - Content = Content .. "
" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "
" - - -- SELECTING RADIAL - Content = Content .. "

Radial:

Center X, Center Z, Radius" - Content = Content .. "
" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "
" - Content = Content .. "
" - Content = Content .. "
" - Content = Content .. "
" - - -- SELECTING POINT - Content = Content .. "

Point regeneration:

X, Z" - Content = Content .. "
" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "
" - - -- SELECTING PLAYERS - Content = Content .. "

Player-based regeneration:

" - Content = Content .. "" - local PlayerNum = 0 - local AddPlayerToTable = function( Player ) - PlayerNum = PlayerNum + 1 - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - Content = Content .. "" - end - if (cRoot:Get():GetWorld(WORK_WORLD) == nil) then - Content = Content .. "" - else - cRoot:Get():GetWorld(WORK_WORLD):ForEachPlayer( AddPlayerToTable ) - if( PlayerNum == 0 ) then - Content = Content .. "" - end - end - Content = Content .. "
" .. PlayerNum .. "." .. Player:GetName() .. "" .. Buttons_Player(Player:GetName()) .. "
Incorrect world selection
No connected players
" - Content = Content .. "
" - return Content -end \ No newline at end of file -- cgit v1.2.3 From ce11888851f7531d23db8aa10045b4babb9def88 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:05:24 +0100 Subject: Added chunkWorx. --- MCServer/Plugins/ChunkWorx | 1 + 1 file changed, 1 insertion(+) create mode 160000 MCServer/Plugins/ChunkWorx (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/ChunkWorx b/MCServer/Plugins/ChunkWorx new file mode 160000 index 000000000..894c7e320 --- /dev/null +++ b/MCServer/Plugins/ChunkWorx @@ -0,0 +1 @@ +Subproject commit 894c7e32049e9d2a1e736f7d721aaacd1ae29e53 -- cgit v1.2.3 From 8f625867f72ea5865616a14c628a21d494bac27e Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:07:55 +0100 Subject: Removed ChatLog. --- MCServer/Plugins/ChatLog/plugin.lua | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 MCServer/Plugins/ChatLog/plugin.lua (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/ChatLog/plugin.lua b/MCServer/Plugins/ChatLog/plugin.lua deleted file mode 100644 index adbf986e0..000000000 --- a/MCServer/Plugins/ChatLog/plugin.lua +++ /dev/null @@ -1,31 +0,0 @@ - --- plugin.lua - --- Implements the main entrypoint for the plugin, as well as all the handling needed - --- ChatLog plugin logs all chat messages into the server log - - - - - -function Initialize(Plugin) - Plugin:SetName("ChatLog") - Plugin:SetVersion(3) - - cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat) - - LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) - return true -end - - - - - -function OnChat(Player, Message) - -- Lets get loggin' - LOGINFO("[" .. Player:GetName() .. "]: " .. StripColorCodes(Message)); - - return false -end \ No newline at end of file -- cgit v1.2.3 From 3b68949cc92d1b059516c4467faa7d648d802f50 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:08:21 +0100 Subject: Added ChatLog --- MCServer/Plugins/ChatLog | 1 + 1 file changed, 1 insertion(+) create mode 160000 MCServer/Plugins/ChatLog (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/ChatLog b/MCServer/Plugins/ChatLog new file mode 160000 index 000000000..983d23ca3 --- /dev/null +++ b/MCServer/Plugins/ChatLog @@ -0,0 +1 @@ +Subproject commit 983d23ca37baa89f7e4dc11d71502d9c059f6376 -- cgit v1.2.3 From ccbd5ba6a2cf75cfa3a11e74464fc5943468127f Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:11:09 +0100 Subject: Added Handy. --- MCServer/Plugins/Handy | 1 + MCServer/Plugins/Handy/handy.lua | 28 ---- MCServer/Plugins/Handy/handy_functions.lua | 216 ----------------------------- 3 files changed, 1 insertion(+), 244 deletions(-) create mode 160000 MCServer/Plugins/Handy delete mode 100644 MCServer/Plugins/Handy/handy.lua delete mode 100644 MCServer/Plugins/Handy/handy_functions.lua (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/Handy b/MCServer/Plugins/Handy new file mode 160000 index 000000000..e64a04be3 --- /dev/null +++ b/MCServer/Plugins/Handy @@ -0,0 +1 @@ +Subproject commit e64a04be39ac7790abcb09de3d4c7d8fc2a2a1e2 diff --git a/MCServer/Plugins/Handy/handy.lua b/MCServer/Plugins/Handy/handy.lua deleted file mode 100644 index e4e9d3f5f..000000000 --- a/MCServer/Plugins/Handy/handy.lua +++ /dev/null @@ -1,28 +0,0 @@ --- Global variables -PLUGIN = {} -- Reference to own plugin object -CHEST_WIDTH = 9 -HANDY_VERSION = 2 ---[[ - -Handy is a plugin for other plugins. It contain no commands, no hooks, but functions to ease plugins developers' life. - -API: - - -TODO: -1. GetChestSlot wrapper, so it will detect double chest neighbour chest and will be able to access it. -]] - -function Initialize(Plugin) - PLUGIN = Plugin - PLUGIN:SetName("Handy") - PLUGIN:SetVersion(HANDY_VERSION) - - PluginManager = cRoot:Get():GetPluginManager() - LOG("Initialized " .. PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion()) - return true -end - -function OnDisable() - LOG(PLUGIN:GetName() .. " v" .. PLUGIN:GetVersion() .. " is shutting down...") -end \ No newline at end of file diff --git a/MCServer/Plugins/Handy/handy_functions.lua b/MCServer/Plugins/Handy/handy_functions.lua deleted file mode 100644 index af43f663a..000000000 --- a/MCServer/Plugins/Handy/handy_functions.lua +++ /dev/null @@ -1,216 +0,0 @@ ---[[ -General stuff -]] --- Returns Handy plugin version number -function GetHandyVersion() - return HANDY_VERSION -end --- Checks if handy is in proper version -function CheckForRequiredVersion( inVersion ) - if( inVersion > HANDY_VERSION ) then return false end - return true -end ---[[ -MCS-specific _functions and nasty hacks :D -]] -function GetChestHeightCheat( inChest ) - local chestGrid = inChest:GetContents() - LOGINFO( "This function serves no purpose now! You should consider chest:GetContents():GetHeight() now!" ) - LOGINFO( "Also, you might find Handy's new 'IsChestDouble()' useful for your case" ) - return chestGrid:GetHeight() -end -function IsChestDouble( inChest ) - local chestHeight = inChest:GetContents():GetHeight() - if( chestHeight == 3 ) then - return false - end - return true -end --- Those two checks how many items of given inItemID chest and player have, and how much they could fit inside them -function ReadChestForItem( inChest, inItemID ) - return ReadGridForItems( inChest:GetContents(), inItemID ) -end -function ReadPlayerForItem( inPlayer, inItemID ) - local inventoryFound, inventoryFree = ReadGridForItems( inPlayer:GetInventory():GetInventoryGrid(), inItemID ) - local hotbarFound, hotbarFree = ReadGridForItems( inPlayer:GetInventory():GetHotbarGrid(), inItemID ) - local itemsFound = inventoryFound + hotbarFound - local freeSpace = inventoryFree + hotbarFree - return itemsFound, freeSpace -end --- Following functions are for chest-related operations --- BEWARE! Those assume you did checked if chest has items/space in it! -function ReadGridForItems( inGrid, inItemID ) - local itemsFound = 0 - local freeSpace = 0 - local slotsCount = inGrid:GetNumSlots() - local testerItem = cItem( inItemID ) - local maxStackSize = testerItem:GetMaxStackSize() - for index = 0, (slotsCount - 1) do - slotItem = inGrid:GetSlot( index ) - if( slotItem:IsEmpty() ) then - freeSpace = freeSpace + maxStackSize - else - if( slotItem:IsStackableWith( testerItem ) ) then - itemsFound = itemsFound + slotItem.m_ItemCount - freeSpace = maxStackSize - slotItem.m_ItemCount - end - end - end - return itemsFound, freeSpace -end - -function TakeItemsFromGrid( inGrid, inItem ) - local slotsCount = inGrid:GetNumSlots() - local removedItem = cItem( inItem ) - for index = 0, (slotsCount - 1) do - slotItem = inGrid:GetSlot( index ) - if( slotItem:IsSameType( removedItem ) ) then - if( slotItem.m_ItemCount <= removedItem.m_ItemCount ) then - removedItem.m_ItemCount = removedItem.m_ItemCount - slotItem.m_ItemCount - inGrid:EmptySlot( index ) - else - removedItem.m_ItemCount = slotItem.m_ItemCount - removedItem.m_ItemCount - inGrid:SetSlot( index, removedItem ) - removedItem.m_ItemCount = 0 - end - if( removedItem.m_ItemCount <= 0 ) then break end - end - end - return removedItem.m_ItemCount -end --------------- -function TakeItemsFromChest( inChest, inItemID, inAmount ) -- MIGHT BE UNSAFE! CHECK FOR ITEMS FIRST!! - local chestGrid = inChest:GetContents() - local removedItem = cItem( inItemID, inAmount ) - TakeItemsFromGrid( chestGrid, removedItem ) -end -function PutItemsToChest( inChest, inItemID, inAmount ) - local chestGrid = inChest:GetContents() - local addedItem = cItem( inItemID, inAmount ) - chestGrid:AddItem( addedItem ) -end --- Similar to chest-related. -function TakeItemsFromPlayer( inPlayer, inItemID, inAmount ) -- MIGHT BE UNSAFE! CHECK FIRST! - local removedItem = cItem( inItemID, inAmount ) - local inventoryGrid = inPlayer:GetInventory():GetInventoryGrid() - local hotbarGrid = inPlayer:GetInventory():GetHotbarGrid() - local itemsLeft = TakeItemsFromGrid( inventoryGrid, removedItem ) - if( itemsLeft > 0 ) then - removedItem = cItem( inItemID, itemsLeft ) - TakeItemsFromGrid( hotbarGrid, removedItem ) - end -end -function GiveItemsToPlayer( inPlayer, inItemID, inAmount ) - local addedItem = cItem( inItemID, inAmount ) - local inventoryGrid = inPlayer:GetInventory():GetInventoryGrid() - local hotbarGrid = inPlayer:GetInventory():GetHotbarGrid() - local itemsAdded = inventoryGrid:AddItem( addedItem ) - if( itemsAdded < inAmount ) then - addedItem.m_ItemCount = addedItem.m_ItemCount - itemsAdded - hotbarGrid:AddItem( addedItem ) - end -end --- This function returns item max stack for a given itemID. It uses vanilla max stack size, and uses several non-common items notations; --- Those are: --- oneonerecord( because aparently 11record wasn't the best idea in lua scripting application ) --- carrotonastick( because it wasn't added to items.txt yet ) --- waitrecord( for same reason ) --- Feel free to ignore the difference, or to add those to items.txt -function GetItemMaxStack( inItemID ) - local testerItem = cItem( inItemID ) - LOGINFO( "This function serves no real purpose now, maybe consider using cItem:GetMaxStackSize()?" ) - return testerItem:GetMaxStackSize() -end -function ItemIsArmor( inItemID, inCheckForHorseArmor ) - inCheckForHorseArmor = inCheckForHorseArmor or false - if( inItemID == E_ITEM_LEATHER_CAP ) then return true end - if( inItemID == E_ITEM_LEATHER_TUNIC ) then return true end - if( inItemID == E_ITEM_LEATHER_PANTS ) then return true end - if( inItemID == E_ITEM_LEATHER_BOOTS ) then return true end - - if( inItemID == E_ITEM_CHAIN_HELMET ) then return true end - if( inItemID == E_ITEM_CHAIN_CHESTPLATE ) then return true end - if( inItemID == E_ITEM_CHAIN_LEGGINGS ) then return true end - if( inItemID == E_ITEM_CHAIN_BOOTS ) then return true end - - if( inItemID == E_ITEM_IRON_HELMET ) then return true end - if( inItemID == E_ITEM_IRON_CHESTPLATE ) then return true end - if( inItemID == E_ITEM_IRON_LEGGINGS ) then return true end - if( inItemID == E_ITEM_IRON_BOOTS ) then return true end - - if( inItemID == E_ITEM_DIAMOND_HELMET ) then return true end - if( inItemID == E_ITEM_DIAMOND_CHESTPLATE ) then return true end - if( inItemID == E_ITEM_DIAMOND_LEGGINGS ) then return true end - if( inItemID == E_ITEM_DIAMOND_BOOTS ) then return true end - - if( inItemID == E_ITEM_GOLD_HELMET ) then return true end - if( inItemID == E_ITEM_GOLD_CHESTPLATE ) then return true end - if( inItemID == E_ITEM_GOLD_LEGGINGS ) then return true end - if( inItemID == E_ITEM_GOLD_BOOTS ) then return true end - - if( inCheckForHorseArmor ) then - if( inItemID == E_ITEM_IRON_HORSE_ARMOR ) then return true end - if( inItemID == E_ITEM_GOLD_HORSE_ARMOR ) then return true end - if( inItemID == E_ITEM_DIAMOND_HORSE_ARMOR ) then return true end - end - return false -end --- Returns full-length playername for a short name( usefull for parsing commands ) -function GetExactPlayername( inPlayerName ) - local _result = inPlayerName - local function SetProcessingPlayername( inPlayer ) - _result = inPlayer:GetName() - end - cRoot:Get():FindAndDoWithPlayer( inPlayerName, SetProcessingPlayername ) - return _result -end -function GetPlayerByName( inPlayerName ) - local _player - local PlayerSetter = function( Player ) - _player = Player - end - cRoot:Get():FindAndDoWithPlayer( inPlayerName, PlayerSetter ) - return _player -end ---[[ -Not-so-usual math _functions -]] --- Rounds floating point number. Because lua guys think this function doesn't deserve to be presented in lua's math -function round( inX ) - if( inX%2 ~= 0.5 ) then - return math.floor( inX + 0.5 ) - end - return inX - 0.5 -end ---[[ -Functions I use for filework and stringswork -]] -function PluralString( inValue, inSingularString, inPluralString ) - local _value_string = tostring( inValue ) - if( _value_string[#_value_string] == "1" ) then - return inSingularString - end - return inPluralString -end -function PluralItemName( inItemID, inAmount ) -- BEWARE! TEMPORAL SOLUTION THERE! :D - local _value_string = tostring( inValue ) - local _name = "" - if( _value_string[#_value_string] == "1" ) then - -- singular names - _name = ItemTypeToString( inItemID ) - else - -- plural names - _name = ItemTypeToString( inItemID ).."s" - end - return _name -end --- for filewriting purposes. 0 = false, 1 = true -function StringToBool( inValue ) - if( inValue == "1" ) then return true end - return false -end --- same, but reversal -function BoolToString( inValue ) - if( inValue == true ) then return 1 end - return 0 -end -- cgit v1.2.3 From 27e69f32c6e72ada6741f0b866c1afbc7ba00bc0 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:13:10 +0100 Subject: Removed MagicCarpet --- MCServer/Plugins/MagicCarpet/objects.lua | 97 -------------------------------- MCServer/Plugins/MagicCarpet/plugin.lua | 81 -------------------------- 2 files changed, 178 deletions(-) delete mode 100644 MCServer/Plugins/MagicCarpet/objects.lua delete mode 100644 MCServer/Plugins/MagicCarpet/plugin.lua (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/MagicCarpet/objects.lua b/MCServer/Plugins/MagicCarpet/objects.lua deleted file mode 100644 index 8d81623a5..000000000 --- a/MCServer/Plugins/MagicCarpet/objects.lua +++ /dev/null @@ -1,97 +0,0 @@ --- Location object -cLocation = {} -function cLocation:new( x, y, z ) - local object = { x = x, y = y, z = z } - setmetatable(object, { __index = cLocation }) - return object -end - --- Offsets -cFibers = { } -function cFibers:new() - local object = { - cLocation:new( 2, -1, 2 ), - cLocation:new( 2, -1, 1 ), - cLocation:new( 2, -1, 0 ), - cLocation:new( 2, -1, -1 ), - cLocation:new( 2, -1, -2 ), - cLocation:new( 1, -1, 2 ), - cLocation:new( 1, -1, 1 ), - cLocation:new( 1, -1, 0 ), - cLocation:new( 1, -1, -1 ), - cLocation:new( 1, -1, -2 ), - cLocation:new( 0, -1, 2 ), - cLocation:new( 0, -1, 1 ), - cLocation:new( 0, -1, 0 ), - cLocation:new( 0, -1, -1 ), - cLocation:new( 0, -1, -2 ), - cLocation:new( -1, -1, 2 ), - cLocation:new( -1, -1, 1 ), - cLocation:new( -1, -1, 0 ), - cLocation:new( -1, -1, -1 ), - cLocation:new( -1, -1, -2 ), - cLocation:new( -2, -1, 2 ), - cLocation:new( -2, -1, 1 ), - cLocation:new( -2, -1, 0 ), - cLocation:new( -2, -1, -1 ), - cLocation:new( -2, -1, -2 ), - imadeit = false, - } - setmetatable(object, { __index = cFibers }) - return object; -end - --- Carpet object -cCarpet = {} -function cCarpet:new() - local object = { Location = cLocation:new(0,0,0), - Fibers = cFibers:new(), - } - setmetatable(object, { __index = cCarpet }) - return object -end - -function cCarpet:remove() - local World = cRoot:Get():GetDefaultWorld() - for i, fib in ipairs( self.Fibers ) do - local x = self.Location.x + fib.x - local y = self.Location.y + fib.y - local z = self.Location.z + fib.z - local BlockID = World:GetBlock( x, y, z ) - if( fib.imadeit == true and BlockID == E_BLOCK_GLASS ) then - World:SetBlock( x, y, z, 0, 0 ) - fib.imadeit = false - end - end -end - -function cCarpet:draw() - local World = cRoot:Get():GetDefaultWorld() - for i, fib in ipairs( self.Fibers ) do - local x = self.Location.x + fib.x - local y = self.Location.y + fib.y - local z = self.Location.z + fib.z - local BlockID = World:GetBlock( x, y, z ) - if( BlockID == 0 ) then - fib.imadeit = true - World:SetBlock( x, y, z, E_BLOCK_GLASS, 0 ) - else - fib.imadeit = false - end - end -end - -function cCarpet:moveTo( NewPos ) - local x = math.floor( NewPos.x ) - local y = math.floor( NewPos.y ) - local z = math.floor( NewPos.z ) - if( self.Location.x ~= x or self.Location.y ~= y or self.Location.z ~= z ) then - self:remove() - self.Location = cLocation:new( x, y, z ) - self:draw() - end -end - -function cCarpet:getY() - return self.Location.y -end \ No newline at end of file diff --git a/MCServer/Plugins/MagicCarpet/plugin.lua b/MCServer/Plugins/MagicCarpet/plugin.lua deleted file mode 100644 index 417ea0e02..000000000 --- a/MCServer/Plugins/MagicCarpet/plugin.lua +++ /dev/null @@ -1,81 +0,0 @@ -local Carpets = {} -local PLUGIN - -function Initialize( Plugin ) - Plugin:SetName( "MagicCarpet" ) - Plugin:SetVersion( 2 ) - - cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving) - cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_DESTROYED, OnDisconnect) - - local PluginManager = cPluginManager:Get() - PluginManager:BindCommand("/mc", "magiccarpet", HandleCarpetCommand, " - Spawns a magical carpet"); - - PLUGIN = Plugin - - LOG( "Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() ) - return true -end - - - - - -function OnDisable() - LOG( PLUGIN:GetName() .. " v." .. PLUGIN:GetVersion() .. " is shutting down..." ) - for i, Carpet in pairs( Carpets ) do - Carpet:remove() - end -end - - - - - -function HandleCarpetCommand( Split, Player ) - Carpet = Carpets[ Player ] - - if( Carpet == nil ) then - Carpets[ Player ] = cCarpet:new() - Player:SendMessageSuccess("You're on a magic carpet!") - Player:SendMessageInfo("Look straight down to descend. Jump to ascend.") - else - Carpet:remove() - Carpets[ Player ] = nil - Player:SendMessageSuccess("The carpet vanished!") - end - - return true -end - - - - - -function OnDisconnect( Reason, Player ) - local Carpet = Carpets[ Player ] - if( Carpet ~= nil ) then - Carpet:remove() - end - Carpets[ Player ] = nil -end - - - - - -function OnPlayerMoving(Player) - local Carpet = Carpets[ Player ] - if( Carpet == nil ) then - return - end - - if( Player:GetPitch() == 90 ) then - Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY() - 1, Player:GetPosZ() ) ) - else - if( Player:GetPosY() < Carpet:getY() ) then - Player:TeleportToCoords(Player:GetPosX(), Carpet:getY() + 0.2, Player:GetPosZ()) - end - Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() ) ) - end -end -- cgit v1.2.3 From fa00cbeda3729c072e3594b137ee00b298d5f120 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Wed, 8 Oct 2014 21:13:38 +0100 Subject: Added MagicCarpet --- MCServer/Plugins/MagicCarpet | 1 + 1 file changed, 1 insertion(+) create mode 160000 MCServer/Plugins/MagicCarpet (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/MagicCarpet b/MCServer/Plugins/MagicCarpet new file mode 160000 index 000000000..493f2dfa6 --- /dev/null +++ b/MCServer/Plugins/MagicCarpet @@ -0,0 +1 @@ +Subproject commit 493f2dfa6d39f134e37c4c614cf8d6ffd10c825f -- cgit v1.2.3