Kick inactive players from clans (lord-server/lord#1385). Closes lord-server/lord#1324.

* Kick inactive players from clans on startup
* Check last login clan players every day
This commit is contained in:
ssdaniel24
2024-05-27 23:04:05 +03:00
committed by GitHub
parent 3382f78275
commit be26987fee
2 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
---@class AuthenticationHandlerGetAuth
---@field password string
---@field priveleges table<string,number>
---@field last_login number|nil
-- Used by `minetest.register_authentication_handler`.
---@class AuthenticationHandlerDefinition
local AuthenticationHandlerDefinition = {
--- Get authentication data for existing player `name` (`nil` if player
--- doesn't exist).
--- Returns following structure:
--- `{password=<string>, privileges=<table>, last_login=<number or nil>}`
---@type fun(name:string):AuthenticationHandlerGetAuth
get_auth = function(name) end,
--- Create new auth data for player `name`.
--- Note that `password` is not plain-text but an arbitrary
--- representation decided by the engine.
---@type fun(name:string, password:string)
create_auth = function(name, password) end,
--- Delete auth data of player `name`.
--- Returns boolean indicating success (false if player is nonexistent).
---@type fun(name:string)
delete_auth = function(name) end,
--- Set password of player `name` to `password`.
--- Auth data should be created if not present.
---@type fun(name:string, password:string)
set_password = function(name, password) end,
--- Set privileges of player `name`.
--- `privileges` is in table form, auth data should be created if not
--- present.
---@type fun(name:string, priveleges:table<string,number>)
set_privileges = function(name, privileges) end,
--- Reload authentication data from the storage location.
--- Returns boolean indicating success.
---@type fun():boolean
reload = function() end,
--- Called when player joins, used for keeping track of last_login
---@type fun(name:string)
record_login = function(name) end,
--- Returns an iterator (use with `for` loops) for all player names
--- currently in the auth database
---@type fun():fun()
iterate = function() end,
}

View File

@@ -150,6 +150,7 @@ function minetest.is_nan(arg) end
--- * This value might overflow on certain 32-bit systems!
---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L3269-L3271)
---@return number
function minetest.get_us_time() end
--- returns a position.
--- * returns the exact position on the surface of a pointed node
@@ -839,6 +840,7 @@ function minetest.get_player_ip(name) end
--- `local auth_data = minetest.get_auth_handler().get_auth(playername)`
---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4807-L4810)
---@return AuthenticationHandlerDefinition
function minetest.get_auth_handler() end
--- * Must be called by the authentication handler for privilege changes.
--- * `name`: string; if omitted, all auth data should be considered modified
@@ -1703,6 +1705,9 @@ function minetest.sound_fade(handle, step, gain) end
--- * Optional: Variable number of arguments that are passed to `func`
---
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L5420-L5422)
---@param time number @in seconds
---@param func fun()
---@return table @job (job:cancel() to stop)
function minetest.after(time, func, ...) end
--- * Cancels the job function from being called
function job:cancel() end