Merge pull request 'Fix crash when trying to use awards if they are disabled for the player (#2164)' (#2170) from awards_crashfix into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2170 Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
commit
b13835dd6f
|
@ -21,9 +21,13 @@ minetest.register_chatcommand("awards", {
|
||||||
description = S("Show, clear, disable or enable your achievements"),
|
description = S("Show, clear, disable or enable your achievements"),
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if param == "clear" then
|
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)
|
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 achievements."))
|
minetest.chat_send_player(name, S("You have disabled your achievements."))
|
||||||
|
@ -31,11 +35,19 @@ minetest.register_chatcommand("awards", {
|
||||||
awards.enable(name)
|
awards.enable(name)
|
||||||
minetest.chat_send_player(name, S("You have enabled your achievements."))
|
minetest.chat_send_player(name, S("You have enabled your achievements."))
|
||||||
elseif param == "c" then
|
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)
|
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("achievements", {
|
minetest.register_privilege("achievements", {
|
||||||
|
|
|
@ -61,3 +61,4 @@ Achievement “@1” does not exist.=Auszeichnung »@1« existiert nicht.
|
||||||
Write something in chat.=Schreiben Sie etwas in den Chat.
|
Write something in chat.=Schreiben Sie etwas in den Chat.
|
||||||
Write @1 chat messages.=Schreiben Sie @1 Chatnachrichten.
|
Write @1 chat messages.=Schreiben Sie @1 Chatnachrichten.
|
||||||
@1/@2 chat messages=@1/@2 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!
|
|
@ -61,3 +61,4 @@ Achievement “@1” does not exist.=
|
||||||
@1 has made the achievement @2=
|
@1 has made the achievement @2=
|
||||||
Mine a block: @1=
|
Mine a block: @1=
|
||||||
Mine blocks: @1×@2=
|
Mine blocks: @1×@2=
|
||||||
|
Awards are disabled, enable them first by using /awards enable!=
|
||||||
|
|
Loading…
Reference in New Issue
Block a user