forked from Mirrorlandia_minetest/minetest
Make chat command + privilege help slightly more accurate (#6964)
* Make chat command help slightly more accurate * Slightly more accurate privilege help * Simplify command/priv help * More command/priv help tweaks
This commit is contained in:
parent
de2c40c8fc
commit
3b4df956b1
@ -71,7 +71,7 @@ end
|
|||||||
--
|
--
|
||||||
core.register_chatcommand("me", {
|
core.register_chatcommand("me", {
|
||||||
params = "<action>",
|
params = "<action>",
|
||||||
description = "Display chat action (e.g., '/me orders a pizza' displays"
|
description = "Show chat action (e.g., '/me orders a pizza' displays"
|
||||||
.. " '<player name> orders a pizza')",
|
.. " '<player name> orders a pizza')",
|
||||||
privs = {shout=true},
|
privs = {shout=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
@ -93,7 +93,7 @@ core.register_chatcommand("admin", {
|
|||||||
|
|
||||||
core.register_chatcommand("privs", {
|
core.register_chatcommand("privs", {
|
||||||
params = "[<name>]",
|
params = "[<name>]",
|
||||||
description = "Print privileges of player",
|
description = "Show privileges of yourself or another player",
|
||||||
func = function(caller, param)
|
func = function(caller, param)
|
||||||
param = param:trim()
|
param = param:trim()
|
||||||
local name = (param ~= "" and param or caller)
|
local name = (param ~= "" and param or caller)
|
||||||
@ -149,7 +149,7 @@ end
|
|||||||
|
|
||||||
core.register_chatcommand("grant", {
|
core.register_chatcommand("grant", {
|
||||||
params = "<name> (<privilege> | all)",
|
params = "<name> (<privilege> | all)",
|
||||||
description = "Give privilege to player",
|
description = "Give privileges to player",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local grantname, grantprivstr = string.match(param, "([^ ]+) (.+)")
|
local grantname, grantprivstr = string.match(param, "([^ ]+) (.+)")
|
||||||
if not grantname or not grantprivstr then
|
if not grantname or not grantprivstr then
|
||||||
@ -172,7 +172,7 @@ core.register_chatcommand("grantme", {
|
|||||||
|
|
||||||
core.register_chatcommand("revoke", {
|
core.register_chatcommand("revoke", {
|
||||||
params = "<name> (<privilege> | all)",
|
params = "<name> (<privilege> | all)",
|
||||||
description = "Remove privilege from player",
|
description = "Remove privileges from player",
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if not core.check_player_privs(name, {privs=true}) and
|
if not core.check_player_privs(name, {privs=true}) and
|
||||||
@ -263,7 +263,7 @@ core.register_chatcommand("setpassword", {
|
|||||||
|
|
||||||
core.register_chatcommand("clearpassword", {
|
core.register_chatcommand("clearpassword", {
|
||||||
params = "<name>",
|
params = "<name>",
|
||||||
description = "Set empty password",
|
description = "Set empty password for a player",
|
||||||
privs = {password=true},
|
privs = {password=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local toname = param
|
local toname = param
|
||||||
@ -290,7 +290,7 @@ core.register_chatcommand("auth_reload", {
|
|||||||
|
|
||||||
core.register_chatcommand("remove_player", {
|
core.register_chatcommand("remove_player", {
|
||||||
params = "<name>",
|
params = "<name>",
|
||||||
description = "Remove player data",
|
description = "Remove a player's data",
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local toname = param
|
local toname = param
|
||||||
@ -315,7 +315,7 @@ core.register_chatcommand("remove_player", {
|
|||||||
|
|
||||||
core.register_chatcommand("teleport", {
|
core.register_chatcommand("teleport", {
|
||||||
params = "<X>,<Y>,<Z> | <to_name> | (<name> <X>,<Y>,<Z>) | (<name> <to_name>)",
|
params = "<X>,<Y>,<Z> | <to_name> | (<name> <X>,<Y>,<Z>) | (<name> <to_name>)",
|
||||||
description = "Teleport to player or position",
|
description = "Teleport to position or player",
|
||||||
privs = {teleport=true},
|
privs = {teleport=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
-- Returns (pos, true) if found, otherwise (pos, false)
|
-- Returns (pos, true) if found, otherwise (pos, false)
|
||||||
@ -588,7 +588,7 @@ local function handle_give_command(cmd, giver, receiver, stackstring)
|
|||||||
end
|
end
|
||||||
|
|
||||||
core.register_chatcommand("give", {
|
core.register_chatcommand("give", {
|
||||||
params = "<name> <ItemString>",
|
params = "<name> <ItemString> [<count> [<wear>]]",
|
||||||
description = "Give item to player",
|
description = "Give item to player",
|
||||||
privs = {give=true},
|
privs = {give=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
@ -601,7 +601,7 @@ core.register_chatcommand("give", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
core.register_chatcommand("giveme", {
|
core.register_chatcommand("giveme", {
|
||||||
params = "<ItemString>",
|
params = "<ItemString> [<count> [<wear>]]",
|
||||||
description = "Give item to yourself",
|
description = "Give item to yourself",
|
||||||
privs = {give=true},
|
privs = {give=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
@ -766,15 +766,15 @@ core.register_chatcommand("rollback", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
core.register_chatcommand("status", {
|
core.register_chatcommand("status", {
|
||||||
description = "Print server status",
|
description = "Show server status",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
return true, core.get_server_status()
|
return true, core.get_server_status()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
core.register_chatcommand("time", {
|
core.register_chatcommand("time", {
|
||||||
params = "<0..23>:<0..59> | <0..24000>",
|
params = "[<0..23>:<0..59> | <0..24000>]",
|
||||||
description = "Set time of day",
|
description = "Show or set time of day",
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if param == "" then
|
if param == "" then
|
||||||
@ -813,7 +813,7 @@ core.register_chatcommand("time", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
core.register_chatcommand("days", {
|
core.register_chatcommand("days", {
|
||||||
description = "Display day count",
|
description = "Show day count since world creation",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
return true, "Current day is " .. core.get_day_count()
|
return true, "Current day is " .. core.get_day_count()
|
||||||
end
|
end
|
||||||
@ -839,12 +839,17 @@ core.register_chatcommand("shutdown", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
core.register_chatcommand("ban", {
|
core.register_chatcommand("ban", {
|
||||||
params = "<name>",
|
params = "[<name> | <IP_address>]",
|
||||||
description = "Ban IP of player",
|
description = "Ban player or show ban list",
|
||||||
privs = {ban=true},
|
privs = {ban=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if param == "" then
|
if param == "" then
|
||||||
return true, "Ban list: " .. core.get_ban_list()
|
local ban_list = core.get_ban_list()
|
||||||
|
if ban_list == "" then
|
||||||
|
return true, "The ban list is empty."
|
||||||
|
else
|
||||||
|
return true, "Ban list: " .. ban_list
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if not core.get_player_by_name(param) then
|
if not core.get_player_by_name(param) then
|
||||||
return false, "No such player."
|
return false, "No such player."
|
||||||
@ -860,7 +865,7 @@ core.register_chatcommand("ban", {
|
|||||||
|
|
||||||
core.register_chatcommand("unban", {
|
core.register_chatcommand("unban", {
|
||||||
params = "<name> | <IP_address>",
|
params = "<name> | <IP_address>",
|
||||||
description = "Remove IP ban",
|
description = "Remove player ban",
|
||||||
privs = {ban=true},
|
privs = {ban=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if not core.unban_player_or_ip(param) then
|
if not core.unban_player_or_ip(param) then
|
||||||
@ -938,7 +943,7 @@ core.register_chatcommand("msg", {
|
|||||||
|
|
||||||
core.register_chatcommand("last-login", {
|
core.register_chatcommand("last-login", {
|
||||||
params = "[<name>]",
|
params = "[<name>]",
|
||||||
description = "Get the last login time of a player",
|
description = "Get the last login time of a player or yourself",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if param == "" then
|
if param == "" then
|
||||||
param = name
|
param = name
|
||||||
|
@ -34,7 +34,7 @@ core.register_privilege("basic_privs", "Can modify 'shout' and 'interact' privil
|
|||||||
core.register_privilege("privs", "Can modify privileges")
|
core.register_privilege("privs", "Can modify privileges")
|
||||||
|
|
||||||
core.register_privilege("teleport", {
|
core.register_privilege("teleport", {
|
||||||
description = "Can use /teleport command",
|
description = "Can teleport self",
|
||||||
give_to_singleplayer = false,
|
give_to_singleplayer = false,
|
||||||
})
|
})
|
||||||
core.register_privilege("bring", {
|
core.register_privilege("bring", {
|
||||||
@ -42,7 +42,7 @@ core.register_privilege("bring", {
|
|||||||
give_to_singleplayer = false,
|
give_to_singleplayer = false,
|
||||||
})
|
})
|
||||||
core.register_privilege("settime", {
|
core.register_privilege("settime", {
|
||||||
description = "Can use /time",
|
description = "Can set the time of day using /time",
|
||||||
give_to_singleplayer = false,
|
give_to_singleplayer = false,
|
||||||
})
|
})
|
||||||
core.register_privilege("server", {
|
core.register_privilege("server", {
|
||||||
@ -74,15 +74,15 @@ core.register_privilege("password", {
|
|||||||
give_to_admin = true,
|
give_to_admin = true,
|
||||||
})
|
})
|
||||||
core.register_privilege("fly", {
|
core.register_privilege("fly", {
|
||||||
description = "Can fly using the free_move mode",
|
description = "Can use fly mode",
|
||||||
give_to_singleplayer = false,
|
give_to_singleplayer = false,
|
||||||
})
|
})
|
||||||
core.register_privilege("fast", {
|
core.register_privilege("fast", {
|
||||||
description = "Can walk fast using the fast_move mode",
|
description = "Can use fast mode",
|
||||||
give_to_singleplayer = false,
|
give_to_singleplayer = false,
|
||||||
})
|
})
|
||||||
core.register_privilege("noclip", {
|
core.register_privilege("noclip", {
|
||||||
description = "Can fly through walls",
|
description = "Can fly through solid nodes using noclip mode",
|
||||||
give_to_singleplayer = false,
|
give_to_singleplayer = false,
|
||||||
})
|
})
|
||||||
core.register_privilege("rollback", {
|
core.register_privilege("rollback", {
|
||||||
|
Loading…
Reference in New Issue
Block a user