Update minetest.chatcommands → minetest.registered_chatcommands

This commit is contained in:
Starbeamrainbowlabs 2023-07-09 19:49:38 +01:00
parent 3bfc62be24
commit f2214150f2
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
8 changed files with 12 additions and 12 deletions

View File

@ -68,7 +68,7 @@ worldeditadditions_core.register_command("for", {
return true, values, command, args
end,
func = function(name, values, command, args)
local cmd = minetest.chatcommands[command]
local cmd = minetest.registered_chatcommands[command]
if not cmd then
return false, "Error: "..command.." isn't a valid command."
end

View File

@ -20,7 +20,7 @@ local function step(params)
if not args then args = ""
else args = args:match("^%s*(.*)%s*$") end
-- Get command and test privs
local cmd = minetest.chatcommands[command]
local cmd = minetest.registered_chatcommands[command]
if not cmd then
return false, "Error: "..command.." isn't a valid command."
end

View File

@ -20,7 +20,7 @@ local function step(params)
))
))
local cmd = minetest.chatcommands[params.cmd_name]
local cmd = minetest.registered_chatcommands[params.cmd_name]
minetest.log("action", params.name.." runs "..full_cmd.." (time "..tostring(params.i).." of "..tostring(params.count)..")")
cmd.func(params.name, params.args)
@ -80,7 +80,7 @@ minetest.register_chatcommand("/many", {
cmd_name = wea_c.trim(cmd_name):sub(2) -- Things start at 1, not 0 in Lua :-(
-- Check the command we're going to execute
local cmd = minetest.chatcommands[cmd_name]
local cmd = minetest.registered_chatcommands[cmd_name]
if not cmd then
return false, "Error: "..cmd_name.." isn't a valid command."
end

View File

@ -31,7 +31,7 @@ minetest.register_chatcommand("/multi", {
worldedit.player_notify(name, "#"..i..": "..command)
local cmd = minetest.chatcommands[command_name]
local cmd = minetest.registered_chatcommands[command_name]
if not cmd then
return false, "Error: "..command_name.." isn't a valid command."
end

View File

@ -123,7 +123,7 @@ worldeditadditions_core.register_command("subdivide", {
-- worldedit.marker_update(name)
cmd.func(name, wea_c.table.unpack(cmd_args_parsed))
if will_trigger_saferegion(name, cmd_name, args) then
minetest.chatcommands["/y"].func(name)
minetest.registered_chatcommands["/y"].func(name)
end
worldedit.player_notify_unsuppress(name)

View File

@ -2,7 +2,7 @@
--- Fetches the definition of a WorldEditAdditions or WorldEdit command
-- Does not support fetching generic Minetest commands - check
-- minetest.chatcommands for this.
-- minetest.registered_chatcommands for this.
-- @param cmdname string The name of the command to fetch the definition for.
local function fetch_command_def(cmdname)
local wea_c = worldeditadditions_core

View File

@ -18,15 +18,15 @@ local function register_alias(cmdname_target, cmdname_source, override)
-- print("DEBUG ALIAS source "..cmdname_source.." target "..cmdname_target)
if minetest.chatcommands["/"..cmdname_target] then
if minetest.registered_chatcommands["/" .. cmdname_target] then
minetest.override_chatcommand(
"/"..cmdname_target,
minetest.chatcommands["/"..cmdname_source]
minetest.registered_chatcommands["/" .. cmdname_source]
)
else
minetest.register_chatcommand(
"/"..cmdname_target,
minetest.chatcommands["/"..cmdname_source]
minetest.registered_chatcommands["/" .. cmdname_source]
)
end
wea_c.registered_commands[cmdname_target] = wea_c.registered_commands[cmdname_source]

View File

@ -8,8 +8,8 @@
local worldedit_command_y, worldedit_command_n
if minetest.global_exists("worldedit") then
worldedit_command_y = minetest.chatcommands["/y"].func
worldedit_command_n = minetest.chatcommands["/n"].func
worldedit_command_y = minetest.registered_chatcommands["/y"].func
worldedit_command_n = minetest.registered_chatcommands["/n"].func
end
--- A table that holds at most 1 pending function call per player.