forked from VoxeLibre/VoxeLibre
Merge pull request 'Fix crash related to awards' (#2884) from awards_crashfix into master
Reviewed-on: MineClone2/MineClone2#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,34 +20,28 @@ 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 == "clear" then
|
if param == "enable" then
|
||||||
if awards.player(name).disabled ~= nil 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!"))
|
minetest.chat_send_player(name, S("Awards are disabled, enable them first by using /awards enable!"))
|
||||||
else
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if param == "clear" then
|
||||||
awards.clear_player(name)
|
awards.clear_player(name)
|
||||||
minetest.chat_send_player(name,
|
minetest.chat_send_player(name,
|
||||||
S("All your awards and statistics have been cleared. You can now start again."))
|
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
|
|
||||||
if awards.player(name).disabled ~= nil then
|
|
||||||
minetest.chat_send_player(name, S("Awards are disabled, enable them first by using /awards enable!"))
|
|
||||||
else
|
else
|
||||||
awards.show_to(name, name, nil, false)
|
awards.show_to(name, name, nil, false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_privilege("advancements", {
|
minetest.register_privilege("advancements", {
|
||||||
|
|
Loading…
Reference in New Issue