From e4c3d3eb6decddddc986f1020f3fb30af48bbe4b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 28 Feb 2014 10:37:09 +0100 Subject: Added a MobDebug enabler script. This file is to be copied to a plugin's folder in order to debug that plugin with MobDebug. --- MCServer/Plugins/@EnableMobDebug.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 MCServer/Plugins/@EnableMobDebug.lua (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/@EnableMobDebug.lua b/MCServer/Plugins/@EnableMobDebug.lua new file mode 100644 index 000000000..48d4c36b7 --- /dev/null +++ b/MCServer/Plugins/@EnableMobDebug.lua @@ -0,0 +1,29 @@ + +-- @EnableMobDebug.lua + +-- Enables the MobDebug debugger, used by ZeroBrane Studio, for a plugin +-- Needs to be named with a @ at the start so that it's loaded as the first file of the plugin + +--[[ +Usage: +Copy this file to your plugin's folder when you want to debug that plugin +You should neither check this file into the plugin's version control system, +nor distribute it in the final release. +--]] + + + + + +-- Try to load the debugger, be silent about failures: +local IsSuccess, MobDebug = pcall(require, "mobdebug") +if (IsSuccess) then + MobDebug.start() + + -- The debugger will automatically put a breakpoint on this line, use this opportunity to set more breakpoints in your code + LOG(cPluginManager:GetCurrentPlugin():GetName() .. ": MobDebug enabled") +end + + + + -- cgit v1.2.3 From d97363a1b39fd94a77bb84a4d9732ab4f46b08b7 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 28 Feb 2014 15:41:46 +0100 Subject: Documented the changes in cJukeboxEntity. --- MCServer/Plugins/APIDump/Classes/BlockEntities.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/Classes/BlockEntities.lua b/MCServer/Plugins/APIDump/Classes/BlockEntities.lua index cf258160c..61a8e8d22 100644 --- a/MCServer/Plugins/APIDump/Classes/BlockEntities.lua +++ b/MCServer/Plugins/APIDump/Classes/BlockEntities.lua @@ -196,9 +196,11 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), Inherits = "cBlockEntity", Functions = { - EjectRecord = { Params = "", Return = "", Notes = "Ejects the current record as a {{cPickup|pickup}}. No action if there's no current record. To remove record without generating the pickup, use SetRecord(0)" }, + EjectRecord = { Params = "", Return = "bool", Notes = "Ejects the current record as a {{cPickup|pickup}}. No action if there's no current record. To remove record without generating the pickup, use SetRecord(0). Returns true if pickup ejected." }, GetRecord = { Params = "", Return = "number", Notes = "Returns the record currently present. Zero for no record, E_ITEM_*_DISC for records." }, - PlayRecord = { Params = "", Return = "", Notes = "Plays the currently present record. No action if there's no current record." }, + IsPlayingRecord = { Params = "", Return = "bool", Notes = "Returns true if the jukebox is playing a record." }, + IsRecordItem = { Params = "ItemType", Return = "bool", Notes = "Returns true if the specified item is a record that can be played." }, + PlayRecord = { Params = "RecordItemType", Return = "bool", Notes = "Plays the specified Record. Return false if the parameter isn't a playable Record (E_ITEM_XXX_DISC). If there is a record already playing, ejects it first." }, SetRecord = { Params = "number", Return = "", Notes = "Sets the currently present record. Use zero for no record, or E_ITEM_*_DISC for records." }, }, }, -- cJukeboxEntity -- cgit v1.2.3 From ce07a22fe6f210cd6461d54cd7fd8eaaaa47be4f Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 1 Mar 2014 10:44:34 +0100 Subject: APIDump: Documented cRoot:CreateAndInitializeWorld. --- 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 c6221f30d..241aa05ad 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1773,6 +1773,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage); 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." }, FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "", Notes = "Calls the given callback function for the given player." }, ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature:
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 5c449452871340eeae9df8f34c5e145fda991d92 Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 1 Mar 2014 12:06:19 +0200 Subject: Exported and documented cScoreboard --- MCServer/Plugins/APIDump/APIDesc.lua | 90 ++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index c6221f30d..c2dd6ba99 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1115,6 +1115,42 @@ local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3"); }, }, -- cItem + cObjective = + { + Desc = [[ + This class represents a single scoreboard objective. + ]], + Functions = + { + AddScore = { Params = "string, number", Return = "Score", Notes = "Adds a value to the score of the specified player and returns the new value." }, + GetDisplayName = { Params = "", Return = "string", Notes = "Returns the display name of the objective. This name will be shown to the connected players." }, + GetName = { Params = "", Return = "string", Notes = "Returns the internal name of the objective." }, + GetScore = { Params = "string", Return = "Score", Notes = "Returns the score of the specified player." }, + GetType = { Params = "", Return = "eType", Notes = "Returns the type of the objective. (i.e what is being tracked)" }, + Reset = { Params = "", Return = "", Notes = "Resets the scores of the tracked players." }, + ResetScore = { Params = "string", Return = "", Notes = "Reset the score of the specified player." }, + SetDisplayName = { Params = "string", Return = "", Notes = "Sets the display name of the objective." }, + SetScore = { Params = "string, Score", Return = "", Notes = "Sets the score of the specified player." }, + SubScore = { Params = "string, number", Return = "Score", Notes = "Subtracts a value from the score of the specified player and returns the new value." }, + }, + Constants = + { + E_TYPE_ACHIEVEMENT = { Notes = "" }, + E_TYPE_DEATH_COUNT = { Notes = "" }, + E_TYPE_DUMMY = { Notes = "" }, + E_TYPE_HEALTH = { Notes = "" }, + E_TYPE_PLAYER_KILL_COUNT = { Notes = "" }, + E_TYPE_STAT = { Notes = "" }, + E_TYPE_STAT_BLOCK_MINE = { Notes = "" }, + E_TYPE_STAT_ENTITY_KILL = { Notes = "" }, + E_TYPE_STAT_ENTITY_KILLED_BY = { Notes = "" }, + E_TYPE_STAT_ITEM_BREAK = { Notes = "" }, + E_TYPE_STAT_ITEM_CRAFT = { Notes = "" }, + E_TYPE_STAT_ITEM_USE = { Notes = "" }, + E_TYPE_TOTAL_KILL_COUNT = { Notes = "" }, + }, + }, -- cObjective + cPainting = { Desc = "This class represents a painting in the world. These paintings are special and different from Vanilla in that they can be critical-hit.", @@ -1821,6 +1857,34 @@ end }, }, -- cRoot + cScoreboard = + { + Desc = [[ + This class manages the objectives and teams of a single world. + ]], + Functions = + { + AddPlayerScore = { Params = "Name, Type, Value", Return = "", Notes = "Adds a value to all player scores of the specified objective type." }, + GetNumObjectives = { Params = "", Return = "number", Notes = "Returns the nuber of registered objectives." }, + GetNumTeams = { Params = "", Return = "number", Notes = "Returns the number of registered teams." }, + GetObjective = { Params = "string", Return = "{{cObjective}}", Notes = "Returns the objective with the specified name." }, + GetObjectiveIn = { Params = "DisplaySlot", Return = "{{cObjective}}", Notes = "Returns the objective in the specified display slot. Can be nil." }, + GetTeam = { Params = "string", Return = "{{cTeam}}", Notes = "Returns the team with the specified name." }, + RegisterObjective = { Params = "Name, DisplayName, Type", Return = "{{cObjective}}", Notes = "Registers a new scoreboard objective. Returns the {{cObjective}} instance, nil on error." }, + RegisterTeam = { Params = "Name, DisplayName, Prefix, Suffix", Return = "{{cTeam}}", Notes = "Registers a new team. Returns the {{cTeam}} instance, nil on error." }, + RemoveObjective = { Params = "string", Return = "bool", Notes = "Removes the objective with the specified name. Returns true if operation was successful." }, + RemoveTeam = { Params = "string", Return = "bool", Notes = "Removes the team with the specified name. Returns true if operation was successful." }, + SetDisplay = { Params = "Name, DisplaySlot", Return = "", Notes = "Updates the currently displayed objective." }, + }, + Constants = + { + E_DISPLAY_SLOT_COUNT = { Notes = "" }, + E_DISPLAY_SLOT_LIST = { Notes = "" }, + E_DISPLAY_SLOT_NAME = { Notes = "" }, + E_DISPLAY_SLOT_SIDEBAR = { Notes = "" }, + }, + }, -- cScoreboard + cServer = { Desc = [[ @@ -1841,6 +1905,32 @@ end }, }, -- cServer + cTeam = + { + Desc = [[ + This class manages a single player team. + ]], + Functions = + { + AddPlayer = { Params = "string", Returns = "bool", Notes = "Adds a player to this team. Returns true if the operation was successful." }, + AllowsFriendlyFire = { Params = "", Return = "bool", Notes = "Returns whether team friendly fire is allowed." }, + CanSeeFriendlyInvisible = { Params = "", Return = "bool", Notes = "Returns whether players can see invisible teammates." }, + HasPlayer = { Params = "string", Returns = "bool", Notes = "Returns whether the specified player is a member of this team." }, + GetDisplayName = { Params = "", Return = "string", Notes = "Returns the display name of the team." }, + GetName = { Params = "", Return = "string", Notes = "Returns the internal name of the team." }, + GetNumPlayers = { Params = "", Return = "number", Notes = "Returns the number of registered players." }, + GetPrefix = { Params = "", Return = "string", Notes = "Returns the prefix prepended to the names of the members of this team." }, + RemovePlayer = { Params = "string", Returns = "bool", Notes = "Removes the player with the specified name from this team. Returns true if the operation was successful." }, + Reset = { Params = "", Returns = "", Notes = "Removes all players from this team." }, + GetSuffix = { Params = "", Return = "string", Notes = "Returns the suffix appended to the names of the members of this team." }, + SetCanSeeFriendlyInvisible = { Params = "bool", Return = "", Notes = "Set whether players can see invisible teammates." }, + SetDisplayName = { Params = "string", Return = "", Notes = "Sets the display name of this team. (i.e. what will be shown to the players)" }, + SetFriendlyFire = { Params = "bool", Return = "", Notes = "Sets whether team friendly fire is allowed." }, + SetPrefix = { Params = "string", Return = "", Notes = "Sets the prefix prepended to the names of the members of this team." }, + SetSuffix = { Params = "string", Return = "", Notes = "Sets the suffix appended to the names of the members of this team." }, + }, + }, -- cTeam + cTNTEntity = { Desc = "This class manages a TNT entity.", -- cgit v1.2.3 From a28e5eca1835e1be868c3bcd22d87e3cfae2f547 Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 1 Mar 2014 14:03:16 +0200 Subject: Exported cScoreboard::ForEachObjective --- 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 c2dd6ba99..5bc69eb24 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1865,6 +1865,7 @@ end Functions = { AddPlayerScore = { Params = "Name, Type, Value", Return = "", Notes = "Adds a value to all player scores of the specified objective type." }, + ForEachObjective = { Params = "CallBackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each objective in the scoreboard. Returns true if all objectives have been processed (including when there are zero objectives), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature:
function Callback({{cObjective|Objective}}, [CallbackData])
The callback should return false or no value to continue with the next objective, or true to abort the enumeration." }, GetNumObjectives = { Params = "", Return = "number", Notes = "Returns the nuber of registered objectives." }, GetNumTeams = { Params = "", Return = "number", Notes = "Returns the number of registered teams." }, GetObjective = { Params = "string", Return = "{{cObjective}}", Notes = "Returns the objective with the specified name." }, -- cgit v1.2.3 From 39c8e68ef030b70f1f50165e74d26100bc1988cc Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 1 Mar 2014 14:27:55 +0200 Subject: Exported cScoreboard::ForEachTeam --- 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 5bc69eb24..e45c5c475 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1866,6 +1866,7 @@ end { AddPlayerScore = { Params = "Name, Type, Value", Return = "", Notes = "Adds a value to all player scores of the specified objective type." }, ForEachObjective = { Params = "CallBackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each objective in the scoreboard. Returns true if all objectives have been processed (including when there are zero objectives), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature:
function Callback({{cObjective|Objective}}, [CallbackData])
The callback should return false or no value to continue with the next objective, or true to abort the enumeration." }, + ForEachTeam = { Params = "CallBackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each team in the scoreboard. Returns true if all teams have been processed (including when there are zero teams), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature:
function Callback({{cObjective|Objective}}, [CallbackData])
The callback should return false or no value to continue with the next team, or true to abort the enumeration." }, GetNumObjectives = { Params = "", Return = "number", Notes = "Returns the nuber of registered objectives." }, GetNumTeams = { Params = "", Return = "number", Notes = "Returns the number of registered teams." }, GetObjective = { Params = "string", Return = "{{cObjective}}", Notes = "Returns the objective with the specified name." }, -- cgit v1.2.3 From add9955255ffc3dba012d4adfa743b244b240ea5 Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 1 Mar 2014 15:03:27 +0200 Subject: APIDump: Fixed cScoreboard enums --- MCServer/Plugins/APIDump/APIDesc.lua | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index e45c5c475..ea89d04af 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1135,19 +1135,19 @@ local Item5 = cItem(E_ITEM_DIAMOND_CHESTPLATE, 1, 0, "thorns=1;unbreaking=3"); }, Constants = { - E_TYPE_ACHIEVEMENT = { Notes = "" }, - E_TYPE_DEATH_COUNT = { Notes = "" }, - E_TYPE_DUMMY = { Notes = "" }, - E_TYPE_HEALTH = { Notes = "" }, - E_TYPE_PLAYER_KILL_COUNT = { Notes = "" }, - E_TYPE_STAT = { Notes = "" }, - E_TYPE_STAT_BLOCK_MINE = { Notes = "" }, - E_TYPE_STAT_ENTITY_KILL = { Notes = "" }, - E_TYPE_STAT_ENTITY_KILLED_BY = { Notes = "" }, - E_TYPE_STAT_ITEM_BREAK = { Notes = "" }, - E_TYPE_STAT_ITEM_CRAFT = { Notes = "" }, - E_TYPE_STAT_ITEM_USE = { Notes = "" }, - E_TYPE_TOTAL_KILL_COUNT = { Notes = "" }, + otAchievement = { Notes = "" }, + otDeathCount = { Notes = "" }, + otDummy = { Notes = "" }, + otHealth = { Notes = "" }, + otPlayerKillCount = { Notes = "" }, + otStat = { Notes = "" }, + otStatBlockMine = { Notes = "" }, + otStatEntityKill = { Notes = "" }, + otStatEntityKilledBy = { Notes = "" }, + otStatItemBreak = { Notes = "" }, + otStatItemCraft = { Notes = "" }, + otStatItemUse = { Notes = "" }, + otTotalKillCount = { Notes = "" }, }, }, -- cObjective @@ -1880,10 +1880,10 @@ end }, Constants = { - E_DISPLAY_SLOT_COUNT = { Notes = "" }, - E_DISPLAY_SLOT_LIST = { Notes = "" }, - E_DISPLAY_SLOT_NAME = { Notes = "" }, - E_DISPLAY_SLOT_SIDEBAR = { Notes = "" }, + dsCount = { Notes = "" }, + dsList = { Notes = "" }, + dsName = { Notes = "" }, + dsSidebar = { Notes = "" }, }, }, -- cScoreboard -- cgit v1.2.3 From 6129b6edf161c61db91d91145e9b1f23db688529 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 1 Mar 2014 14:29:40 +0100 Subject: If there is a SourceLocation available the InfoDump will note it in the forum version. --- MCServer/Plugins/InfoDump.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/InfoDump.lua b/MCServer/Plugins/InfoDump.lua index 8fac09d60..03ce46d99 100644 --- a/MCServer/Plugins/InfoDump.lua +++ b/MCServer/Plugins/InfoDump.lua @@ -578,7 +578,10 @@ local function DumpPluginInfoForum(a_PluginFolder, a_PluginInfo) DumpAdditionalInfoForum(a_PluginInfo, f); DumpCommandsForum(a_PluginInfo, f); DumpPermissionsForum(a_PluginInfo, f); - + if (a_PluginInfo.SourceLocation ~= nil) then + f:write("[b][color=blue]Source:[/color] [url=" .. a_PluginInfo.SourceLocation .. "]Link[/url][/b]"); + end + f:close(); end -- cgit v1.2.3 From 854cf9df999691463aa382bc760d3a4322d015a5 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 1 Mar 2014 14:45:38 +0100 Subject: Using comma instead of string concatenation. --- MCServer/Plugins/InfoDump.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/InfoDump.lua b/MCServer/Plugins/InfoDump.lua index 03ce46d99..e7ed157e3 100644 --- a/MCServer/Plugins/InfoDump.lua +++ b/MCServer/Plugins/InfoDump.lua @@ -579,7 +579,7 @@ local function DumpPluginInfoForum(a_PluginFolder, a_PluginInfo) DumpCommandsForum(a_PluginInfo, f); DumpPermissionsForum(a_PluginInfo, f); if (a_PluginInfo.SourceLocation ~= nil) then - f:write("[b][color=blue]Source:[/color] [url=" .. a_PluginInfo.SourceLocation .. "]Link[/url][/b]"); + f:write("[b][color=blue]Source:[/color] [url=", a_PluginInfo.SourceLocation, "]Link[/url][/b]"); end f:close(); -- cgit v1.2.3