Skip to content

Commit

Permalink
Limit use of /thankyou
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklp09 committed Sep 7, 2024
1 parent 5baa5ef commit 9be8f18
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions archtec/locale/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ You can disable snow in the settings.=
[Info]:=
You can't thank yourself!=
You can't thank an offline player!=
You used '/thankyou' within the last hour! Try again later.=
@1 said thank you to @2.=
@1 requested a server shutdown in @2 seconds.=
[report] Report successfully created. GitHub URL: @1=
Expand Down
1 change: 1 addition & 0 deletions archtec/scripts/faq_content.lua
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ archtec.faq.register("Thank you", {
pos = 6,
text = [[
There are many helpful players on Archtec. If someone has been helpful and you want to thank them and call them out for their assistance, use the '/thankyou' command. To see how many thankyou's a player has received, use the '/stats' command. :-)
You are limited to 1 '/thankyou' per hour.
To thank a player:
'/thankyou <name>'
Expand Down
4 changes: 3 additions & 1 deletion archtec/scripts/idlekick.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ minetest.register_globalstep(function(dtime)
end

if cache[name].last_active < time - timeout then
archtec.kick_inactive_player(name)
if not minetest.get_player_privs(name).staff then
archtec.kick_inactive_player(name)
end
end

if cache[name].last_active < time - 300 then
Expand Down
6 changes: 6 additions & 0 deletions archtec/scripts/random_things.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ end

-- Thankyou command
archtec_playerdata.register_key("thank_you", "number", 0)
archtec_playerdata.register_key("thank_you_last_used", "number", 0)

minetest.register_chatcommand("thankyou", {
params = "<name>",
Expand All @@ -43,7 +44,12 @@ minetest.register_chatcommand("thankyou", {
archtec.ignore_msg("thankyou", name, target)
return
end
if archtec_playerdata.get(name, "thank_you_last_used") > os.time() - archtec.time.hours(1) then
minetest.chat_send_player(name, minetest.colorize("#FF0000", S("You used '/thankyou' within the last hour! Try again later.")))
return
end
archtec_playerdata.mod(target, "thank_you", 1)
archtec_playerdata.set(name, "thank_you_last_used", os.time())
minetest.chat_send_all(minetest.colorize("#00BD00", S("@1 said thank you to @2.", name, target)))
archtec_matterbridge.send(":wave: **" .. name .. "** said thank you to **" .. target .. "**.")
end
Expand Down

0 comments on commit 9be8f18

Please sign in to comment.