diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index bf91bce..dd33bc0 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -114,6 +114,7 @@ end function worldedit.register_command(name, def) local def = table.copy(def) assert(name and #name > 0) + def.name = name assert(def.privs) def.require_pos = def.require_pos or 0 assert(def.require_pos >= 0 and def.require_pos < 3) @@ -130,6 +131,9 @@ function worldedit.register_command(name, def) minetest.log("warning", "//" .. name .. " might be missing nodes_needed") end--]] + -- disable further modification + setmetatable(def, {__newindex = {}}) + minetest.register_chatcommand("/" .. name, { privs = def.privs, params = def.params, @@ -304,7 +308,7 @@ worldedit.register_command("about", { end, }) --- mostly copied from builtin/chatcommands.lua with minor modifications +-- initially copied from builtin/chatcommands.lua worldedit.register_command("help", { privs = {}, params = "[all/]", @@ -315,11 +319,16 @@ worldedit.register_command("help", { func = function(name, param) local function format_help_line(cmd, def) local msg = minetest.colorize("#00ffff", "//"..cmd) - if def.params and def.params ~= "" then - msg = msg .. " " .. def.params - end - if def.description and def.description ~= "" then - msg = msg .. ": " .. def.description + if def.name ~= cmd then + msg = msg .. ": " .. S("alias to @1", + minetest.colorize("#00ffff", "//"..def.name)) + else + if def.params and def.params ~= "" then + msg = msg .. " " .. def.params + end + if def.description and def.description ~= "" then + msg = msg .. ": " .. def.description + end end return msg end diff --git a/worldedit_commands/locale/template.txt b/worldedit_commands/locale/template.txt index 8ea57d1..c915590 100644 --- a/worldedit_commands/locale/template.txt +++ b/worldedit_commands/locale/template.txt @@ -26,6 +26,7 @@ Schematic was created with a newer version of WorldEdit.= Get information about the WorldEdit mod= WorldEdit @1 is available on this server. Type @2 to get a list of commands, or find more information at @3= Get help for WorldEdit commands= +alias to @1= You are not allowed to use any WorldEdit commands.= Available commands: @1@nUse '@2' to get more information, or '@3' to list everything.= Available commands:@n= diff --git a/worldedit_commands/locale/worldedit_commands.de.tr b/worldedit_commands/locale/worldedit_commands.de.tr index 2e798c3..2ac6f4d 100644 --- a/worldedit_commands/locale/worldedit_commands.de.tr +++ b/worldedit_commands/locale/worldedit_commands.de.tr @@ -37,6 +37,7 @@ Schematic was created with a newer version of WorldEdit.=Schematic wurde mit ein Get information about the WorldEdit mod=Informationen über den WorldEdit-Mod erhalten. WorldEdit @1 is available on this server. Type @2 to get a list of commands, or find more information at @3=WorldEdit @1 ist auf diesem Server verfügbar. Nutzen Sie @2, um eine Liste der Befehle zu erhalten, oder finden Sie weitere Informationen unter @3 Get help for WorldEdit commands=Hilfe für WorldEdit-Befehle erhalten +alias to @1=Alias für @1 You are not allowed to use any WorldEdit commands.=Ihnen ist nicht erlaubt WorldEdit-Befehle zu nutzen. Available commands: @1@nUse '@2' to get more information, or '@3' to list everything.=Verfügbare Befehle: @1@n„@2“ benutzen, um mehr Informationen zu erhalten, oder „@3“, um alles aufzulisten. Available commands:@n=Verfügbare Befehle:@n