From f2214150f229b0960801512d5fdf50fc84afb22a Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 9 Jul 2023 19:49:38 +0100 Subject: [PATCH] =?UTF-8?q?Update=20minetest.chatcommands=20=E2=86=92=20mi?= =?UTF-8?q?netest.registered=5Fchatcommands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worldeditadditions_commands/commands/meta/for.lua | 2 +- worldeditadditions_commands/commands/meta/macro.lua | 2 +- worldeditadditions_commands/commands/meta/many.lua | 4 ++-- worldeditadditions_commands/commands/meta/multi.lua | 2 +- worldeditadditions_commands/commands/meta/subdivide.lua | 2 +- worldeditadditions_core/core/fetch_command_def.lua | 2 +- worldeditadditions_core/core/register_alias.lua | 6 +++--- worldeditadditions_core/core/safe_region.lua | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/worldeditadditions_commands/commands/meta/for.lua b/worldeditadditions_commands/commands/meta/for.lua index c48fb1c..819d891 100644 --- a/worldeditadditions_commands/commands/meta/for.lua +++ b/worldeditadditions_commands/commands/meta/for.lua @@ -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 diff --git a/worldeditadditions_commands/commands/meta/macro.lua b/worldeditadditions_commands/commands/meta/macro.lua index 61011d4..62ff894 100644 --- a/worldeditadditions_commands/commands/meta/macro.lua +++ b/worldeditadditions_commands/commands/meta/macro.lua @@ -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 diff --git a/worldeditadditions_commands/commands/meta/many.lua b/worldeditadditions_commands/commands/meta/many.lua index d366c69..53b7f30 100644 --- a/worldeditadditions_commands/commands/meta/many.lua +++ b/worldeditadditions_commands/commands/meta/many.lua @@ -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 diff --git a/worldeditadditions_commands/commands/meta/multi.lua b/worldeditadditions_commands/commands/meta/multi.lua index beb8975..8e70755 100644 --- a/worldeditadditions_commands/commands/meta/multi.lua +++ b/worldeditadditions_commands/commands/meta/multi.lua @@ -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 diff --git a/worldeditadditions_commands/commands/meta/subdivide.lua b/worldeditadditions_commands/commands/meta/subdivide.lua index a033650..f40efda 100644 --- a/worldeditadditions_commands/commands/meta/subdivide.lua +++ b/worldeditadditions_commands/commands/meta/subdivide.lua @@ -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) diff --git a/worldeditadditions_core/core/fetch_command_def.lua b/worldeditadditions_core/core/fetch_command_def.lua index d77da5b..956e733 100644 --- a/worldeditadditions_core/core/fetch_command_def.lua +++ b/worldeditadditions_core/core/fetch_command_def.lua @@ -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 diff --git a/worldeditadditions_core/core/register_alias.lua b/worldeditadditions_core/core/register_alias.lua index 70c7a1e..011b70c 100644 --- a/worldeditadditions_core/core/register_alias.lua +++ b/worldeditadditions_core/core/register_alias.lua @@ -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] diff --git a/worldeditadditions_core/core/safe_region.lua b/worldeditadditions_core/core/safe_region.lua index 0e8a24f..ea821a4 100644 --- a/worldeditadditions_core/core/safe_region.lua +++ b/worldeditadditions_core/core/safe_region.lua @@ -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.