From 390802a344baf6a12100c6db9473f3458aaf796e Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Tue, 3 May 2022 14:58:44 +0000 Subject: [PATCH 1/3] fix crash when achievements are disabled and /awards is being used This commit fixes https://git.minetest.land/MineClone2/MineClone2/issues/2164, which crashes the game whenever /awards is called with arguments other than enable --- mods/HUD/awards/chat_commands.lua | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/mods/HUD/awards/chat_commands.lua b/mods/HUD/awards/chat_commands.lua index 88bed0afe..9b990fd0c 100644 --- a/mods/HUD/awards/chat_commands.lua +++ b/mods/HUD/awards/chat_commands.lua @@ -21,9 +21,13 @@ minetest.register_chatcommand("awards", { description = S("Show, clear, disable or enable your achievements"), func = function(name, param) if param == "clear" then - awards.clear_player(name) - minetest.chat_send_player(name, - S("All your awards and statistics have been cleared. You can now start again.")) + if awards.player(name).disabled ~= nil then + minetest.chat_send_player(name, S("Awards are disabled, enable them first by using /awards enable!")) + else + awards.clear_player(name) + minetest.chat_send_player(name, + S("All your awards and statistics have been cleared. You can now start again.")) + end elseif param == "disable" then awards.disable(name) minetest.chat_send_player(name, S("You have disabled your achievements.")) @@ -31,9 +35,17 @@ minetest.register_chatcommand("awards", { awards.enable(name) minetest.chat_send_player(name, S("You have enabled your achievements.")) elseif param == "c" then - awards.show_to(name, name, nil, true) + if awards.player(name).disabled ~= nil then + minetest.chat_send_player(name, S("Awards are disabled, enable them first by using /awards enable!")) + else + awards.show_to(name, name, nil, true) + end else - awards.show_to(name, name, nil, false) + if awards.player(name).disabled ~= nil then + minetest.chat_send_player(name, S("Awards are disabled, enable them first by using /awards enable!")) + else + awards.show_to(name, name, nil, false) + end end end }) From 9c652df8a2ace45fa6d69a4346a0bac34615c0bc Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Tue, 3 May 2022 14:59:49 +0000 Subject: [PATCH 2/3] update german translation --- mods/HUD/awards/locale/awards.de.tr | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/HUD/awards/locale/awards.de.tr b/mods/HUD/awards/locale/awards.de.tr index 489a19683..19db5e0be 100644 --- a/mods/HUD/awards/locale/awards.de.tr +++ b/mods/HUD/awards/locale/awards.de.tr @@ -61,3 +61,4 @@ Achievement “@1” does not exist.=Auszeichnung »@1« existiert nicht. Write something in chat.=Schreiben Sie etwas in den Chat. Write @1 chat messages.=Schreiben Sie @1 Chatnachrichten. @1/@2 chat messages=@1/@2 Chatnachrichten +Awards are disabled, enable them first by using /awards enable!=Ihre Auszeichnungen sind aktuell deaktiviert, bitte aktivieren Sie diese zuerst indem Sie /awards enable ausführen bevor Sie diesen Befehl erneut verwenden! \ No newline at end of file From 3699ca553547df861c7d20307651cdafe547bb01 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Tue, 3 May 2022 15:21:18 +0000 Subject: [PATCH 3/3] update translation template --- mods/HUD/awards/locale/template.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/HUD/awards/locale/template.txt b/mods/HUD/awards/locale/template.txt index ac6a1d752..fa05b22b3 100644 --- a/mods/HUD/awards/locale/template.txt +++ b/mods/HUD/awards/locale/template.txt @@ -61,3 +61,4 @@ Achievement “@1” does not exist.= @1 has made the achievement @2= Mine a block: @1= Mine blocks: @1×@2= +Awards are disabled, enable them first by using /awards enable!=