Skip to content

Commit

Permalink
documentation redo... again
Browse files Browse the repository at this point in the history
  • Loading branch information
VorTechnix committed Oct 17, 2024
1 parent 440dae6 commit 644510a
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions worldeditadditions_core/utils/notify/notify.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ end

--- Send a notification of type `ntype` (for metatable).
-- (Same as `Notify[ntype](name, message)`)
-- @param table _self Provided automatically by Lua. You do not need to set this automatically - see example.
-- @param string name The name of the player to send the notification to.
-- @param string ntype The type of notification.
-- @param string message The message to send.
-- @param _self table Provided automatically by Lua. You do not need to set this automatically - see example.
-- @param name string The name of the player to send the notification to.
-- @param ntype string The type of notification.
-- @param message string The message to send.
-- @return table The Notify instance.
-- @example Basic usage
-- worldeditadditions_core.notify(player_name, "info", "All registered commands:\n....")
Expand All @@ -80,11 +80,11 @@ end
setmetatable(Notify, {__call = call})

--- Send a custom notification.
-- @param string name The name of the player to send the notification to.
-- @param string ntype The type of notification.
-- @param string message The message to send.
-- @param string? colour Optional. The colour of the notification.
-- @param boolean? message_coloured Optional. Whether the message should be coloured.
-- @param name string The name of the player to send the notification to.
-- @param ntype string The type of notification.
-- @param message string The message to send.
-- @param colour string? Optional. The colour of the notification.
-- @param message_coloured boolean? Optional. Whether the message should be coloured.
-- @return boolean True if all parameters are valid, false otherwise.
-- @example Custom notification types
-- Notify.custom(name, "custom", "This one is magenta!", "#FF00FF", true)
Expand All @@ -96,8 +96,8 @@ end


--- Register the aforementioned predefined notification types.
-- @param string name The name of the player to send the notification to.
-- @param string message The message to send.
-- @param name string The name of the player to send the notification to.
-- @param message string The message to send.
-- @example
-- Notify.error(name, "multi-line error!\n" .. debug.traceback())
-- Notify.warn(name, "This is the last coloured message type!")
Expand All @@ -118,8 +118,8 @@ do
end

--- Local suppression status handler
-- @param string name The name of the player to check.
-- @param table suppress The table of suppressed players.
-- @param name string The name of the player to check.
-- @param suppress table The table of suppressed players.
-- @return boolean True if the player is not suppressed or
-- if the player is clear(ed), false otherwise.
local check_clear_suppressed = function(name, suppress)
Expand All @@ -133,8 +133,8 @@ local check_clear_suppressed = function(name, suppress)
end

--- Suppress a player's notifications.
-- @param string name The name of the player to suppress.
-- @param number > 1 time The number of seconds to suppress notifications for.
-- @param name string The name of the player to suppress.
-- @param time number > 1 The number of seconds to suppress notifications for.
-- number < 1 immediately removes the suppression.
function Notify.suppress_for_player(name, time)
local suppress = globalstate.suppressed_players
Expand All @@ -148,6 +148,9 @@ function Notify.suppress_for_player(name, time)
end

--- Suppress a player's notifications while function executes.
-- @param name string The name of the player to suppress.
-- @param func function The function to execute while the player is suppressed.
-- @returns bool, string Success, result of the executed function.
function Notify.suppress_for_function(name, func)
local suppress = globalstate.suppressed_players
-- If the player is already suppressed, cancel it unless it's a function
Expand Down

0 comments on commit 644510a

Please sign in to comment.