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