summaryrefslogtreecommitdiffstats
path: root/Server
diff options
context:
space:
mode:
authornshah25 <68348722+nshah25@users.noreply.github.com>2021-05-03 22:07:09 +0200
committerGitHub <noreply@github.com>2021-05-03 22:07:09 +0200
commit8be1dd54bb17b3ba3e20960aa3c3f696d09facf7 (patch)
tree334cf9a2c9f781816f8278c933d66a71bf5c7d88 /Server
parentStyle: specify include relativity (#5217) (diff)
downloadcuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar
cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar.gz
cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar.bz2
cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar.lz
cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar.xz
cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.tar.zst
cuberite-8be1dd54bb17b3ba3e20960aa3c3f696d09facf7.zip
Diffstat (limited to '')
-rw-r--r--Server/Plugins/APIDump/APIDesc.lua415
-rw-r--r--Server/Plugins/APIDump/main_APIDump.lua12
2 files changed, 392 insertions, 35 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua
index 888ce9aef..0e616a35c 100644
--- a/Server/Plugins/APIDump/APIDesc.lua
+++ b/Server/Plugins/APIDump/APIDesc.lua
@@ -10245,27 +10245,17 @@ a_Player:OpenWindow(Window);
},
Notes = "Returns the full color code to be used for this player's messages (based on their rank). Prefix player messages with this code.",
},
- GetDraggingItem =
- {
- Returns =
- {
- {
- Type = "cItem",
- },
- },
- Notes = "Returns the item the player is dragging in a UI window."
- },
- GetPrefix =
+ GetCurrentXp =
{
Returns =
{
{
- Type = "string",
+ Type = "number",
},
},
- Notes = "Returns the prefix to player names for messages (based on their rank), may contain @ format codes.",
+ Notes = "Returns the current amount of XP",
},
- GetSuffix =
+ GetCustomName =
{
Returns =
{
@@ -10273,27 +10263,17 @@ a_Player:OpenWindow(Window);
Type = "string",
},
},
- Notes = "Returns the suffix to player names for messages (based on their rank), may contain @ format codes.",
- },
- GetCurrentXp =
- {
- Returns =
- {
- {
- Type = "number",
- },
- },
- Notes = "Returns the current amount of XP",
+ Notes = "Returns the custom name of this player. If the player hasn't a custom name, it will return an empty string.",
},
- GetCustomName =
+ GetDraggingItem =
{
Returns =
{
{
- Type = "string",
+ Type = "cItem",
},
},
- Notes = "Returns the custom name of this player. If the player hasn't a custom name, it will return an empty string.",
+ Notes = "Returns the item the player is dragging in a UI window."
},
GetEffectiveGameMode =
{
@@ -10489,6 +10469,16 @@ a_Player:OpenWindow(Window);
},
Notes = "Returns the name that is used in the playerlist.",
},
+ GetPrefix =
+ {
+ Returns =
+ {
+ {
+ Type = "string",
+ },
+ },
+ Notes = "Returns the prefix to player names for messages (based on their rank), may contain @ format codes.",
+ },
GetRestrictions =
{
Returns =
@@ -10519,6 +10509,26 @@ a_Player:OpenWindow(Window);
},
Notes = "Returns the player's current set of skin part flags. This is a bitwise OR of various {{Globals#eSkinPart|eSkinPart}} constants. Note that HasSkinPart may be easier to use in most situations.",
},
+ GetStatistics =
+ {
+ Returns =
+ {
+ {
+ Type = "StatisticsManager",
+ },
+ },
+ Notes = "Returns the player's statistics manager."
+ },
+ GetSuffix =
+ {
+ Returns =
+ {
+ {
+ Type = "string",
+ },
+ },
+ Notes = "Returns the suffix to player names for messages (based on their rank), may contain @ format codes.",
+ },
GetTeam =
{
Returns =
@@ -13219,7 +13229,41 @@ end
Include = { "wt.*" },
}
}, -- ConstantGroups
- }, -- cWindow
+ },
+ StatisticsManager =
+ {
+ Desc = [[
+ This class provides a store for various types of player statistics. The store will be read and sent to the client when the Statistics button is pressed.
+ ]],
+ Variables =
+ {
+ Custom =
+ {
+ Type = "Map of {{CustomStatistic}} to number",
+ Notes = "Gets or sets the value of a custom statistic.",
+ },
+ },
+ AdditionalInfo =
+ {
+ {
+ Header = "Example usage",
+ Contents = [[
+ Each store is a table, keyed by the statistic that the entry tracks, with value typically representing the number of times the event happened:
+<pre class="prettyprint lang-lua">
+function ModifyPlayerFurnaceInteractions(Player)
+ local Statistics = Player:GetStatistics()
+
+ if (Statistics.Custom[CustomStatistic.WalkOneCm] > 10) then
+ Statistics.Custom[CustomStatistic.InteractWithFurnace] = 1337
+ end
+
+ -- Next time the player presses Statistics they will see the updated value for furnace interactions.
+end
+</pre>
+ ]],
+ },
+ },
+ },
BannerPattern =
{
@@ -13700,6 +13744,319 @@ end
},
}
},
+ CustomStatistic =
+ {
+ Desc = [[
+ An enumeration of statistics of the custom type to be used with the {{StatisticsManager#Custom|Custom}} statistics store.
+ ]],
+ Constants =
+ {
+ AnimalsBred =
+ {
+ Notes = "",
+ },
+ AviateOneCm =
+ {
+ Notes = "",
+ },
+ BellRing =
+ {
+ Notes = "",
+ },
+ BoatOneCm =
+ {
+ Notes = "",
+ },
+ CleanArmor =
+ {
+ Notes = "",
+ },
+ CleanBanner =
+ {
+ Notes = "",
+ },
+ CleanShulkerBox =
+ {
+ Notes = "",
+ },
+ ClimbOneCm =
+ {
+ Notes = "",
+ },
+ CrouchOneCm =
+ {
+ Notes = "",
+ },
+ DamageAbsorbed =
+ {
+ Notes = "",
+ },
+ DamageBlockedByShield =
+ {
+ Notes = "",
+ },
+ DamageDealt =
+ {
+ Notes = "",
+ },
+ DamageDealtAbsorbed =
+ {
+ Notes = "",
+ },
+ DamageDealtResisted =
+ {
+ Notes = "",
+ },
+ DamageResisted =
+ {
+ Notes = "",
+ },
+ DamageTaken =
+ {
+ Notes = "",
+ },
+ Deaths =
+ {
+ Notes = "",
+ },
+ Drop =
+ {
+ Notes = "",
+ },
+ EatCakeSlice =
+ {
+ Notes = "",
+ },
+ EnchantItem =
+ {
+ Notes = "",
+ },
+ FallOneCm =
+ {
+ Notes = "",
+ },
+ FillCauldron =
+ {
+ Notes = "",
+ },
+ FishCaught =
+ {
+ Notes = "",
+ },
+ FlyOneCm =
+ {
+ Notes = "",
+ },
+ HorseOneCm =
+ {
+ Notes = "",
+ },
+ InspectDispenser =
+ {
+ Notes = "",
+ },
+ InspectDropper =
+ {
+ Notes = "",
+ },
+ InspectHopper =
+ {
+ Notes = "",
+ },
+ InteractWithAnvil =
+ {
+ Notes = "",
+ },
+ InteractWithBeacon =
+ {
+ Notes = "",
+ },
+ InteractWithBlastFurnace =
+ {
+ Notes = "",
+ },
+ InteractWithBrewingstand =
+ {
+ Notes = "",
+ },
+ InteractWithCampfire =
+ {
+ Notes = "",
+ },
+ InteractWithCartographyTable =
+ {
+ Notes = "",
+ },
+ InteractWithCraftingTable =
+ {
+ Notes = "",
+ },
+ InteractWithFurnace =
+ {
+ Notes = "",
+ },
+ InteractWithGrindstone =
+ {
+ Notes = "",
+ },
+ InteractWithLectern =
+ {
+ Notes = "",
+ },
+ InteractWithLoom =
+ {
+ Notes = "",
+ },
+ InteractWithSmithingTable =
+ {
+ Notes = "",
+ },
+ InteractWithSmoker =
+ {
+ Notes = "",
+ },
+ InteractWithStonecutter =
+ {
+ Notes = "",
+ },
+ JunkFished =
+ {
+ Notes = "",
+ },
+ Jump =
+ {
+ Notes = "",
+ },
+ LeaveGame =
+ {
+ Notes = "",
+ },
+ MinecartOneCm =
+ {
+ Notes = "",
+ },
+ MobKills =
+ {
+ Notes = "",
+ },
+ OpenBarrel =
+ {
+ Notes = "",
+ },
+ OpenChest =
+ {
+ Notes = "",
+ },
+ OpenEnderchest =
+ {
+ Notes = "",
+ },
+ OpenShulkerBox =
+ {
+ Notes = "",
+ },
+ PigOneCm =
+ {
+ Notes = "",
+ },
+ PlayNoteblock =
+ {
+ Notes = "",
+ },
+ PlayOneMinute =
+ {
+ Notes = "",
+ },
+ PlayRecord =
+ {
+ Notes = "",
+ },
+ PlayerKills =
+ {
+ Notes = "",
+ },
+ PotFlower =
+ {
+ Notes = "",
+ },
+ RaidTrigger =
+ {
+ Notes = "",
+ },
+ RaidWin =
+ {
+ Notes = "",
+ },
+ SleepInBed =
+ {
+ Notes = "",
+ },
+ SneakTime =
+ {
+ Notes = "",
+ },
+ SprintOneCm =
+ {
+ Notes = "",
+ },
+ StriderOneCm =
+ {
+ Notes = "",
+ },
+ SwimOneCm =
+ {
+ Notes = "",
+ },
+ TalkedToVillager =
+ {
+ Notes = "",
+ },
+ TargetHit =
+ {
+ Notes = "",
+ },
+ TimeSinceDeath =
+ {
+ Notes = "",
+ },
+ TimeSinceRest =
+ {
+ Notes = "",
+ },
+ TradedWithVillager =
+ {
+ Notes = "",
+ },
+ TreasureFished =
+ {
+ Notes = "",
+ },
+ TriggerTrappedChest =
+ {
+ Notes = "",
+ },
+ TuneNoteblock =
+ {
+ Notes = "",
+ },
+ UseCauldron =
+ {
+ Notes = "",
+ },
+ WalkOnWaterOneCm =
+ {
+ Notes = "",
+ },
+ WalkOneCm =
+ {
+ Notes = "",
+ },
+ WalkUnderWaterOneCm =
+ {
+ Notes = "",
+ },
+ },
+ },
Globals =
{
Desc = [[
diff --git a/Server/Plugins/APIDump/main_APIDump.lua b/Server/Plugins/APIDump/main_APIDump.lua
index f92abb932..61dd1e66c 100644
--- a/Server/Plugins/APIDump/main_APIDump.lua
+++ b/Server/Plugins/APIDump/main_APIDump.lua
@@ -52,7 +52,6 @@ end
-
--- Returns the API currently detected from the global environment
local function CreateAPITables()
--[[
@@ -121,14 +120,15 @@ local function CreateAPITables()
end
-- Member variables:
+ local GetField = a_ClassObj[".get"];
local SetField = a_ClassObj[".set"] or {};
- if ((a_ClassObj[".get"] ~= nil) and (type(a_ClassObj[".get"]) == "table")) then
- for k in pairs(a_ClassObj[".get"]) do
- if (SetField[k] == nil) then
- -- It is a read-only variable, add it as a constant:
+ if ((GetField ~= nil) and (type(GetField) == "table")) then
+ for k, v in pairs(GetField) do
+ if ((SetField[k] == nil) and ((type(v) ~= "table") or (v["__newindex"] == nil))) then
+ -- It is a read-only variable or array, add it as a constant:
table.insert(res.Constants, {Name = k, Value = ""});
else
- -- It is a read-write variable, add it as a variable:
+ -- It is a read-write variable or array, add it as a variable:
table.insert(res.Variables, { Name = k });
end
end