improve my poor (old) fix

This commit is contained in:
chmodsayshello 2022-10-31 16:22:28 +01:00
parent 910b3d57ac
commit c1af4935a1

View File

@ -20,14 +20,15 @@ minetest.register_chatcommand("awards", {
params = S("[c|clear|disable|enable]"),
description = S("Show, clear, disable or enable your advancements."),
func = function(name, param)
if awards.player(name).disabled then
minetest.chat_send_player(name, S("Awards are disabled, enable them first by using /awards enable!"))
return
end
if param == "clear" then
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
awards.clear_player(name)
minetest.chat_send_player(name,
S("All your awards and statistics have been cleared. You can now start again."))
elseif param == "disable" then
awards.disable(name)
minetest.chat_send_player(name, S("You have disabled your advancements."))
@ -35,17 +36,9 @@ minetest.register_chatcommand("awards", {
awards.enable(name)
minetest.chat_send_player(name, S("You have enabled your advancements."))
elseif param == "c" then
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
awards.show_to(name, name, nil, true)
else
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
awards.show_to(name, name, nil, false)
end
end
})