Allow muting other players' teleport requests (#40)

* Allow muting players

Allow muting other players' teleport requests.

* Update translations
This commit is contained in:
David Leal 2020-10-18 12:08:10 -05:00 committed by GitHub
parent a15fcb822c
commit a902bfb79e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 199 additions and 6 deletions

@ -66,3 +66,17 @@ minetest.register_chatcommand("tpn", {
privs = {interact = true, tp = true},
func = tp.tpr_deny
})
minetest.register_chatcommand("tpr_mute", {
description = S("Mutes a player: denies them from sending you teleport requests"),
params = S("<playername> | leave playername empty to see help message"),
privs = {interact = true, tp = true},
func = tp.tpr_mute
})
minetest.register_chatcommand("tpr_unmute", {
description = S("Unmutes a player: allow them to send you teleport requests again"),
params = S("<playername> | leave playername empty to see help message"),
privs = {interact = true, tp = true},
func = tp.tpr_unmute
})

@ -28,6 +28,8 @@ target_coords, tpc_target_coords, old_tpc_target_coords
local spam_prevention = {}
local band = false
local muted_players = {}
local map_size = 30912
function tp.can_teleport(to)
return to.x < map_size and to.x > -map_size and to.y < map_size and to.y > -map_size and to.z < map_size and to.z > -map_size
@ -100,8 +102,73 @@ function tp.parti2(pos)
"tps_portal_parti.png")
end
-- Mutes a player from sending you teleport requests
function tp.tpr_mute(player, muted_player)
if muted_player == "" then
minetest.chat_send_player(player, S("Usage: /tpr_mute <player>"))
if minetest.get_modpath("chat2") then
chat2.send_message(minetest.get_player_by_name(player), S("Usage: /tpr_mute <player>"), 0xFFFFFF)
end
return
end
if not minetest.get_player_by_name(muted_player) then
minetest.chat_send_player(player, S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."))
if minetest.get_modpath("chat2") then
chat2.send_message(minetest.get_player_by_name(player), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."), 0xFFFFFF)
end
return
end
if minetest.check_player_privs(muted_player, {tp_admin = true}) and not minetest.check_player_privs(player, {server = true}) then
minetest.chat_send_player(player, S("tpr_mute: Failed to mute player @1: they have the tp_admin privilege.", muted_player))
return
end
if muted_players[player] == muted_player then
minetest.chat_send_player(player, S("tpr_mute: Player @1 is already muted.", muted_player))
return
end
muted_players[player] = muted_player
minetest.chat_send_player(player, S("tpr_mute: Player @1 successfully muted.", muted_player))
end
-- Unmutes a player from sending you teleport requests
function tp.tpr_unmute(player, muted_player)
if muted_player == "" then
minetest.chat_send_player(player, S("Usage: /tpr_unmute <player>"))
if minetest.get_modpath("chat2") then
chat2.send_message(minetest.get_player_by_name(player), S("Usage: /tpr_unmute <player>"), 0xFFFFFF)
end
return
end
if not minetest.get_player_by_name(muted_player) then
minetest.chat_send_player(player, S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."))
if minetest.get_modpath("chat2") then
chat2.send_message(minetest.get_player_by_name(player), S("There is no player by that name. Keep in mind this is case-sensitive, and the player must be online."), 0xFFFFFF)
end
return
end
if muted_players[player] ~= muted_player then
minetest.chat_send_player(player, S("tpr_mute: Player @1 is not muted yet.", muted_player))
return
end
muted_players[player] = nil
minetest.chat_send_player(player, S("tpr_mute: Player @1 successfully unmuted.", muted_player))
end
-- Teleport Request System
function tp.tpr_send(sender, receiver)
-- Check if the sender is muted
if muted_players[receiver] == sender and not minetest.check_player_privs(sender, {server = true}) then
minetest.chat_send_player(sender, S("Cannot send request to @1 (you have been muted).", receiver))
return
end
if receiver == "" then
minetest.chat_send_player(sender, S("Usage: /tpr <Player name>"))
if minetest.get_modpath("chat2") then
@ -246,6 +313,12 @@ function tp.tpr_send(sender, receiver)
end
function tp.tphr_send(sender, receiver)
-- Check if the sender is muted
if muted_players[receiver] == sender and not minetest.check_player_privs(sender, {server = true}) then
minetest.chat_send_player(sender, S("Cannot send request to @1 (you have been muted).", receiver))
return
end
if receiver == "" then
minetest.chat_send_player(sender, S("Usage: /tphr <Player name>"))
if minetest.get_modpath("chat2") then
@ -390,7 +463,6 @@ function tp.tphr_send(sender, receiver)
end
function tp.tpc_send(sender, coordinates)
local posx,posy,posz = string.match(coordinates, "^(-?%d+), (-?%d+), (-?%d+)$")
local pname = minetest.get_player_by_name(sender)
@ -503,7 +575,6 @@ function tp.tpc_send(sender, coordinates)
end
function tp.tpr_deny(name)
if not tp.tpr_list[name] and not tp.tphr_list[name]
and not tp.tpc_list[name] and not tp.tpn_list[name] then
minetest.chat_send_player(name, S("Usage: /tpn allows you to deny teleport/area requests sent to you by other players."))
@ -586,7 +657,6 @@ end
-- Teleport Accept Systems
function tp.tpr_accept(name)
-- Check to prevent constant teleporting
if not tp.tpr_list[name] and not tp.tphr_list[name]
and not tp.tpc_list[name] then
@ -714,7 +784,6 @@ end
-- Teleport Jump - Relative Position Teleportation by number of nodes
function tp.tpj(player, param)
if param == "" then
minetest.chat_send_player(player, S("Usage: <x|y|z> <number>"))
if minetest.get_modpath("chat2") then
@ -800,9 +869,7 @@ end
-- Teleport To Place (TPP) system.
if tp.enable_tpp_command then
function tp.tpp(player, param)
-- Show the available places to the player (taken from shivajiva101's POI mod, thanks!).
if param == "" then
local places = {}

@ -28,6 +28,14 @@ msgstr "Da acceso total de administrador a un jugador."
msgid "Allow player to teleport to coordinates (if allowed by area protection)"
msgstr "Permite a los jugadores teletransportarse a las coordenadas especificadas (si esta permitido por la protección de la área)"
#: init.lua
msgid "Usage: /tpr_mute <player>"
msgstr "Uso: /tpr_mute <jugador>"
#: init.lua
msgid "tpr_mute: Failed to mute player @1: they have the tp_admin privilege."
msgstr "tpr_mute: No se pudo silenciar al jugador @1: tiene el privilegio tp_admin."
#: init.lua
msgid "Wait @1 seconds before you can send teleport requests to @2 again."
msgstr "Espere @1 segundos antes de que pueda mandar solicitudes de teletransporte a @2."
@ -40,6 +48,30 @@ msgstr "Ya puede mandar solicitudes de teletransporte a @1."
msgid "You are not allowed to send requests because you're muted."
msgstr "No tienes permiso para mandar solicitudes de teletransporte porque estás silenciado."
#: init.lua
msgid "Cannot send request to @1 (you have been muted)."
msgstr "No se puede enviar la solicitud a @1 (has sido silenciado)."
#: init.lua
msgid "tpr_mute: Player @1 is already muted."
msgstr "tpr_mute: El jugador @1 ya esta silenciado."
#: init.lua
msgid "tpr_mute: Player @1 successfully muted."
msgstr "tpr_mute: El jugador @1 ha sido silenciado con éxito."
#: init.lua
msgid "Usage: /tpr_unmute <player>"
msgstr "Uso: /tpr_unmute <player>"
#: init.lua
msgid "tpr_mute: Player @1 is not muted yet."
msgstr "tpr_mute: El jugador @1 aún no ha sido slienciado."
#: init.lua
msgid "tpr_mute: Player @1 successfully unmuted."
msgstr "tpr_mute: El sonido del jugador @1 ha sido activado con éxito."
#: init.lua
msgid "Usage: /tpr <Player name>"
msgstr "Uso: /tpr <jugador>"
@ -227,6 +259,14 @@ msgstr "Aceptar solicitudes de otro jugador."
msgid "Deny teleport requests from another player"
msgstr "Denegar solicitudos de otro jugador."
#: init.lua
msgid "Mutes a player: denies them from sending you teleport requests"
msgstr "Silencia a un jugador: le niega el envío de solicitudes de teletransporte"
#: init.lua
msgid "Unmutes a player: allow them to send you teleport requests again"
msgstr "Activar el sonido de un jugador: permite que te envíe solicitudes de teletransporte nuevamente"
#: init.lua
msgid "[Teleport Request] TPS Teleport v@1 Loaded!"
msgstr "[TPS] Solicitud de teletransporte v@1 Cargado!"

@ -28,10 +28,38 @@ msgstr "Da acesso de administrador completo a um jogador."
msgid "Allow player to teleport to coordinates (if allowed by area protection)"
msgstr "Permitir que o jogador se teletransporte para coordenadas (se permitido pela protecao da area)"
#: init.lua
msgid "tpr_mute: Failed to mute player @1: they have the tp_admin privilege."
msgstr ""
#: init.lua
msgid "You are not allowed to send requests because you're muted."
msgstr "Voce nao tem permissao para enviar solicitacoes porque esta' sem som."
#: init.lua
msgid "Cannot send request to @1 (you have been muted)."
msgstr ""
#: init.lua
msgid "tpr_mute: Player @1 is already muted."
msgstr ""
#: init.lua
msgid "tpr_mute: Player @1 successfully muted."
msgstr ""
#: init.lua
msgid "Usage: /tpr_unmute <player>"
msgstr ""
#: init.lua
msgid "tpr_mute: Player @1 is not muted yet."
msgstr ""
#: init.lua
msgid "tpr_mute: Player @1 successfully unmuted."
msgstr ""
#: init.lua
msgid "Usage: /tpr <Player name>"
msgstr "Use: /tpr <Nome do jogador>"
@ -204,6 +232,14 @@ msgstr "Aceitar pedidos de teleporte de outro jogador"
msgid "Deny teleport requests from another player"
msgstr "Negar pedidos de teleporte de outro jogador"
#: init.lua
msgid "Mutes a player: denies them from sending you teleport requests"
msgstr ""
#: init.lua
msgid "Unmutes a player: allow them to send you teleport requests again"
msgstr ""
#: init.lua
msgid "[Teleport Request] TPS Teleport v@1 Loaded!"
msgstr "[Solicitacao de Teleporte] Teletransporte TPS v@1 Carregado!"

@ -28,6 +28,10 @@ msgstr ""
msgid "Allow player to teleport to coordinates (if allowed by area protection)"
msgstr ""
#: init.lua
msgid "tpr_mute: Failed to mute player @1: they have the tp_admin privilege."
msgstr ""
#: init.lua
msgid "Wait @1 seconds before you can send teleport requests to @2 again."
msgstr ""
@ -40,6 +44,30 @@ msgstr ""
msgid "You are not allowed to send requests because you're muted."
msgstr ""
#: init.lua
msgid "Cannot send request to @1 (you have been muted)."
msgstr ""
#: init.lua
msgid "tpr_mute: Player @1 is already muted."
msgstr ""
#: init.lua
msgid "tpr_mute: Player @1 successfully muted."
msgstr ""
#: init.lua
msgid "Usage: /tpr_unmute <player>"
msgstr ""
#: init.lua
msgid "tpr_mute: Player @1 is not muted yet."
msgstr ""
#: init.lua
msgid "tpr_mute: Player @1 successfully unmuted."
msgstr ""
#: init.lua
msgid "Usage: /tpr <Player name>"
msgstr ""
@ -227,6 +255,14 @@ msgstr ""
msgid "Deny teleport requests from another player"
msgstr ""
#: init.lua
msgid "Mutes a player: denies them from sending you teleport requests"
msgstr ""
#: init.lua
msgid "Unmutes a player: allow them to send you teleport requests again"
msgstr ""
#: init.lua
msgid "[Teleport Request] TPS Teleport v@1 Loaded!"
msgstr ""