Merge pull request 'Fix crash related to awards' (#2884) from awards_crashfix into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2884 Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
commit
fb29abcd50
|
@ -484,7 +484,7 @@ function awards.show_to(name, to, sid, text)
|
||||||
name = to
|
name = to
|
||||||
end
|
end
|
||||||
if name == to and awards.player(to).disabled then
|
if name == to and awards.player(to).disabled then
|
||||||
minetest.chat_send_player(S("You've disabled awards. Type /awards enable to reenable."))
|
minetest.chat_send_player(name,S("You've disabled awards. Type /awards enable to reenable."))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if text then
|
if text then
|
||||||
|
|
|
@ -20,32 +20,26 @@ 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 param == "enable" then
|
||||||
|
awards.enable(name)
|
||||||
|
minetest.chat_send_player(name, S("You have enabled your advancements."))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
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."))
|
||||||
elseif param == "enable" then
|
|
||||||
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
|
|
||||||
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
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user