Colorize command references in chat output

This commit is contained in:
sfan5 2024-04-20 14:21:28 +02:00
parent 602f175cc0
commit 41d53180b1
7 changed files with 24 additions and 20 deletions

View File

@ -101,7 +101,7 @@ worldedit.register_command("brush", {
else else
local cmddef = worldedit.registered_commands[cmd] local cmddef = worldedit.registered_commands[cmd]
if cmddef == nil or cmddef.require_pos ~= 1 then if cmddef == nil or cmddef.require_pos ~= 1 then
worldedit.player_notify(name, "//" .. cmd .. " cannot be used with brushes") worldedit.player_notify(name, minetest.colorize("#00ffff", "//"..cmd) .. " cannot be used with brushes")
return return
end end

View File

@ -232,7 +232,8 @@ worldedit.register_command("cubeapply", {
end end
local cmddef = worldedit.registered_commands[cmd] local cmddef = worldedit.registered_commands[cmd]
if cmddef == nil or cmddef.require_pos ~= 2 then if cmddef == nil or cmddef.require_pos ~= 2 then
return false, S("invalid usage: //@1 cannot be used with cubeapply", cmd) return false, S("invalid usage: @1 cannot be used with cubeapply",
minetest.colorize("#00ffff", "//"..cmd))
end end
-- run parsing of target command -- run parsing of target command
local parsed = {cmddef.parse(args)} local parsed = {cmddef.parse(args)}

View File

@ -296,9 +296,9 @@ worldedit.register_command("about", {
description = S("Get information about the WorldEdit mod"), description = S("Get information about the WorldEdit mod"),
func = function(name) func = function(name)
worldedit.player_notify(name, S("WorldEdit @1".. worldedit.player_notify(name, S("WorldEdit @1"..
" is available on this server. Type //help to get a list of ".. " is available on this server. Type @2 to get a list of "..
"commands, or get more information at @2", "commands, or find more information at @3",
worldedit.version_string, worldedit.version_string, minetest.colorize("#00ffff", "//help"),
"https://github.com/Uberi/Minetest-WorldEdit" "https://github.com/Uberi/Minetest-WorldEdit"
)) ))
end, end,
@ -335,9 +335,11 @@ worldedit.register_command("help", {
end end
end end
table.sort(cmds) table.sort(cmds)
local help = minetest.colorize("#00ffff", "//help")
return true, S("Available commands: @1@n" return true, S("Available commands: @1@n"
.. "Use '//help <cmd>' to get more information," .. "Use '@2' to get more information,"
.. " or '//help all' to list everything.", table.concat(cmds, " ")) .. " or '@3' to list everything.",
table.concat(cmds, " "), help .. " <cmd>", help .. " all")
elseif param == "all" then elseif param == "all" then
local cmds = {} local cmds = {}
for cmd, def in pairs(worldedit.registered_commands) do for cmd, def in pairs(worldedit.registered_commands) do

View File

@ -13,7 +13,7 @@ Region expanded by @1 nodes=
Contracts the selection in the selected absolute or relative axis= Contracts the selection in the selected absolute or relative axis=
Region contracted by @1 nodes= Region contracted by @1 nodes=
Select a cube with side length <size> around position 1 and run <command> on region= Select a cube with side length <size> around position 1 and run <command> on region=
invalid usage: //@1 cannot be used with cubeapply= invalid usage: @1 cannot be used with cubeapply=
Missing privileges: @1= Missing privileges: @1=
Can use WorldEdit commands= Can use WorldEdit commands=
no region selected= no region selected=
@ -24,10 +24,10 @@ Could not open file "@1"=
Invalid file format!= Invalid file format!=
Schematic was created with a newer version of WorldEdit.= Schematic was created with a newer version of WorldEdit.=
Get information about the WorldEdit mod= Get information about the WorldEdit mod=
WorldEdit @1 is available on this server. Type //help to get a list of commands, or get more information at @2= 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= Get help for WorldEdit commands=
You are not allowed to use any WorldEdit commands.= You are not allowed to use any WorldEdit commands.=
Available commands: @1@nUse '//help <cmd>' to get more information, or '//help all' to list everything.= Available commands: @1@nUse '@2' to get more information, or '@3' to list everything.=
Available commands:@n= Available commands:@n=
Command not available: = Command not available: =
Enable or disable node inspection= Enable or disable node inspection=
@ -139,7 +139,7 @@ currently set node probabilities:=
invalid node probability given, not saved= invalid node probability given, not saved=
Clears all objects within the WorldEdit region= Clears all objects within the WorldEdit region=
@1 objects cleared= @1 objects cleared=
WARNING: this operation could affect up to @1 nodes; type //y to continue or //n to cancel= WARNING: this operation could affect up to @1 nodes; type @2 to continue or @3 to cancel=
Confirm a pending operation= Confirm a pending operation=
no operation pending= no operation pending=
Abort a pending operation= Abort a pending operation=

View File

@ -24,7 +24,7 @@ Region expanded by @1 nodes=Gebiet um @1 Blöcke erweitert
Contracts the selection in the selected absolute or relative axis=Schrumpft das Gebiet in Richtung einer absoluten oder relativen Achse Contracts the selection in the selected absolute or relative axis=Schrumpft das Gebiet in Richtung einer absoluten oder relativen Achse
Region contracted by @1 nodes=Gebiet um @1 Blöcke geschrumpft Region contracted by @1 nodes=Gebiet um @1 Blöcke geschrumpft
Select a cube with side length <size> around position 1 and run <command> on region=Wähle einen Würfel mit Seitenlänge <size> um Position 1 und führe <command> auf diesem Gebiet aus Select a cube with side length <size> around position 1 and run <command> on region=Wähle einen Würfel mit Seitenlänge <size> um Position 1 und führe <command> auf diesem Gebiet aus
invalid usage: //@1 cannot be used with cubeapply=Ungültige Verwendung: //@1 kann nicht mit cubeapply verwendet werden invalid usage: @1 cannot be used with cubeapply=Ungültige Verwendung: @1 kann nicht mit cubeapply verwendet werden
Missing privileges: @1=Fehlende Privilegien: @1 Missing privileges: @1=Fehlende Privilegien: @1
Can use WorldEdit commands=Kann WorldEdit-Befehle benutzen Can use WorldEdit commands=Kann WorldEdit-Befehle benutzen
no region selected=Kein Gebiet ausgewählt no region selected=Kein Gebiet ausgewählt
@ -35,10 +35,10 @@ Could not open file "@1"=Konnte die Datei „@1“ nicht öffnen
Invalid file format!=Ungültiges Dateiformat! Invalid file format!=Ungültiges Dateiformat!
Schematic was created with a newer version of WorldEdit.=Schematic wurde mit einer neueren Version von WorldEdit erstellt. Schematic was created with a newer version of WorldEdit.=Schematic wurde mit einer neueren Version von WorldEdit erstellt.
Get information about the WorldEdit mod=Informationen über den WorldEdit-Mod erhalten. Get information about the WorldEdit mod=Informationen über den WorldEdit-Mod erhalten.
WorldEdit @1 is available on this server. Type //help to get a list of commands, or get more information at @2=WorldEdit @1 ist auf diesem Server verfügbar. Nutzen Sie //help, um eine Liste der Befehle zu erhalten, oder finden Sie weitere Informationen unter @2 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 Get help for WorldEdit commands=Hilfe für WorldEdit-Befehle erhalten
You are not allowed to use any WorldEdit commands.=Ihnen ist nicht erlaubt WorldEdit-Befehle zu nutzen. You are not allowed to use any WorldEdit commands.=Ihnen ist nicht erlaubt WorldEdit-Befehle zu nutzen.
Available commands: @1@nUse '//help <cmd>' to get more information, or '//help all' to list everything.=Verfügbare Befehle: @1@n„//help <Befehl>“ benutzen, um mehr Informationen zu erhalten, oder „//help all“, um alles aufzulisten. 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 Available commands:@n=Verfügbare Befehle:@n
Command not available: =Befehl nicht verfügbar: Command not available: =Befehl nicht verfügbar:
Enable or disable node inspection=Inspizieren von Blöcken ein- oder ausschalten Enable or disable node inspection=Inspizieren von Blöcken ein- oder ausschalten
@ -150,7 +150,7 @@ currently set node probabilities:=
invalid node probability given, not saved= invalid node probability given, not saved=
Clears all objects within the WorldEdit region=Löscht alle Objekte innerhalb des WorldEdit-Gebiets Clears all objects within the WorldEdit region=Löscht alle Objekte innerhalb des WorldEdit-Gebiets
@1 objects cleared=@1 Objekte gelöscht @1 objects cleared=@1 Objekte gelöscht
WARNING: this operation could affect up to @1 nodes; type //y to continue or //n to cancel=WARNUNG: Dieser Vorgang könnte bis zu @1 Blöcke betreffen; //y zum Fortfahren oder //n zum Abbrechen WARNING: this operation could affect up to @1 nodes; type @2 to continue or @3 to cancel=WARNUNG: Dieser Vorgang könnte bis zu @1 Blöcke betreffen; @2 zum Fortfahren oder @3 zum Abbrechen
Confirm a pending operation=Einen ausstehenden Vorgang bestätigen Confirm a pending operation=Einen ausstehenden Vorgang bestätigen
no operation pending=Kein Vorgang ausstehend no operation pending=Kein Vorgang ausstehend
Abort a pending operation=Einen ausstehenden Vorgang abbrechen Abort a pending operation=Einen ausstehenden Vorgang abbrechen

View File

@ -11,10 +11,10 @@ Invalid file format!=Не верный формат файла!
Schematic was created with a newer version of WorldEdit.=Схема была создана с использованием более новой версии WorldEdit. Schematic was created with a newer version of WorldEdit.=Схема была создана с использованием более новой версии WorldEdit.
Get information about the WorldEdit mod=Вывести информацию о WorldEdit Get information about the WorldEdit mod=Вывести информацию о WorldEdit
WorldEdit @1 is available on this server. Type //help to get a list of commands, or get more information at @2=WorldEdit @1 доступен на этом сервере. Наберите команду //help чтобы увидеть список команд, больше информации по ссылке @2 WorldEdit @1 is available on this server. Type @2 to get a list of commands, or get more information at @3=WorldEdit @1 доступен на этом сервере. Наберите команду @2 чтобы увидеть список команд, больше информации по ссылке @3
Get help for WorldEdit commands=Вывести информацию об использовании команд WorldEdit Get help for WorldEdit commands=Вывести информацию об использовании команд WorldEdit
You are not allowed to use any WorldEdit commands.=У вас нет привилегий, чтобы использовать команды WorldEdit. You are not allowed to use any WorldEdit commands.=У вас нет привилегий, чтобы использовать команды WorldEdit.
Available commands: @1@nUse '//help <cmd>' to get more information, or '//help all' to list everything.=Доступные команды: @1@nИспользуйте '//help <cmd>' для получения информации по команде или '//help all' для вывода подсказок по всем командам. Available commands: @1@nUse '@2' to get more information, or '@3' to list everything.=Доступные команды: @1@nИспользуйте '@2' для получения информации по команде или '@3' для вывода подсказок по всем командам.
Available commands:@n=Доступные команды:@n Available commands:@n=Доступные команды:@n
Command not available: =Команда не найдена: Command not available: =Команда не найдена:
Enable or disable node inspection=Включить/отключить инспекцию блоков Enable or disable node inspection=Включить/отключить инспекцию блоков
@ -128,7 +128,7 @@ Clears all objects within the WorldEdit region=Очистить все объе
@1 objects cleared=очищено @1 объектов @1 objects cleared=очищено @1 объектов
### safe.lua ### ### safe.lua ###
WARNING: this operation could affect up to @1 nodes; type //y to continue or //n to cancel=ПРЕДУПРЕЖДЕНИЕ: эта операция может затронуть до @1 нод; введите //y для продолжения или //n для отмены WARNING: this operation could affect up to @1 nodes; type @2 to continue or @3 to cancel=ПРЕДУПРЕЖДЕНИЕ: эта операция может затронуть до @1 нод; введите @2 для продолжения или @3 для отмены
Confirm a pending operation=Подтвердить отложенную операцию Confirm a pending operation=Подтвердить отложенную операцию
no operation pending=нет ожидающей операции no operation pending=нет ожидающей операции
Abort a pending operation=Отклонить отложенную операцию Abort a pending operation=Отклонить отложенную операцию
@ -148,7 +148,7 @@ Region expanded by @1 nodes=Регион увеличен на @1 нод(у/ы)
Contracts the selection in the selected absolute or relative axis=Уменьшить выделение региона по выбранной абсолютной или относительной оси Contracts the selection in the selected absolute or relative axis=Уменьшить выделение региона по выбранной абсолютной или относительной оси
Region contracted by @1 nodes=Регион уменьшен на @1 нод(у/ы) Region contracted by @1 nodes=Регион уменьшен на @1 нод(у/ы)
Select a cube with side length <size> around position 1 and run <command> on region=Выделить куб с длиной стороны <size> вокруг позиции 1 и запустите <команду> в области Select a cube with side length <size> around position 1 and run <command> on region=Выделить куб с длиной стороны <size> вокруг позиции 1 и запустите <команду> в области
invalid usage: //@1 cannot be used with cubeapply=недопустимое использование: //@1 не может быть применено в cubeapply invalid usage: @1 cannot be used with cubeapply=недопустимое использование: @1 не может быть применено в cubeapply
Missing privileges: @1=Отсутствуют привилегии: @1 Missing privileges: @1=Отсутствуют привилегии: @1
### wand.lua ### ### wand.lua ###

View File

@ -11,7 +11,8 @@ local function safe_region(name, count, callback)
--save callback to call later --save callback to call later
safe_region_callback[name] = callback safe_region_callback[name] = callback
worldedit.player_notify(name, S("WARNING: this operation could affect up to @1 nodes; type //y to continue or //n to cancel", count)) worldedit.player_notify(name, S("WARNING: this operation could affect up to @1 nodes; type @2 to continue or @3 to cancel",
count, minetest.colorize("#00ffff", "//y"), minetest.colorize("#00ffff", "//n")))
end end
local function reset_pending(name) local function reset_pending(name)