Compare commits

..

No commits in common. "6be72af82cfdffbd4fe5afc20a8ea40123326d15" and "1076047ad36b46935b6ad71624adadc83f4f0b43" have entirely different histories.

7 changed files with 77 additions and 47 deletions

View file

@ -1,3 +1,6 @@
-- License: WTFPL
rules = {} rules = {}
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
@ -27,7 +30,7 @@ local items = {
S("Failure to follow these rules may result in a kick or ban"), S("Failure to follow these rules may result in a kick or ban"),
S(" (temp or permanent) depending on severity."), S(" (temp or permanent) depending on severity."),
"", "",
S("Created by rubenwardy. Hosted by philipmi."), S("Developed by rubenwardy, hosted by philipmi"),
S("Moderators")..": philipmi", S("Moderators")..": philipmi",
"", "",
S("Though the server owner will not actively read private messages or disclose"), S("Though the server owner will not actively read private messages or disclose"),
@ -53,9 +56,16 @@ if minetest.global_exists("sfinv") then
}) })
end end
local function need_to_accept(pname) local function can_grant_interact(player)
local pname = player:get_player_name()
return not minetest.check_player_privs(pname, { interact = true }) and return not minetest.check_player_privs(pname, { interact = true }) and
not minetest.check_player_privs(pname, { shout = true }) not minetest.check_player_privs(pname, { fly = true })
end
local function has_password(pname)
local handler = minetest.get_auth_handler()
local auth = handler.get_auth(pname)
return auth and not minetest.check_password_entry(pname, auth.password, "")
end end
function rules.show(player) function rules.show(player)
@ -63,7 +73,11 @@ function rules.show(player)
local fs = "size[12,8.6]bgcolor[#080808BB;true]" .. local fs = "size[12,8.6]bgcolor[#080808BB;true]" ..
"textlist[0,0;12,7.9;msg;" .. rules.txt .. ";-1;true]" "textlist[0,0;12,7.9;msg;" .. rules.txt .. ";-1;true]"
if not need_to_accept(pname) then if not has_password(pname) then
fs = fs .. "box[4,8.1;3.1,0.7;#900]"
fs = fs .. "label[4.2,8.2;Please set a password]"
fs = fs .. "button_exit[0.5,7.6;3.5,2;ok;Okay]"
elseif not can_grant_interact(player) then
fs = fs .. "button_exit[0.5,7.6;7,2;ok;Okay]" fs = fs .. "button_exit[0.5,7.6;7,2;ok;Okay]"
else else
local yes = minetest.formspec_escape("Yes, let me play!") local yes = minetest.formspec_escape("Yes, let me play!")
@ -76,6 +90,18 @@ function rules.show(player)
minetest.show_formspec(pname, "rules:rules", fs) minetest.show_formspec(pname, "rules:rules", fs)
end end
function rules.show_pwd(pname, msg)
msg = msg or "You must set a password to be able to play"
minetest.show_formspec(pname, "rules:pwd", [[
size[8,3]
no_prepends[]
bgcolor[#600]
pwdfield[0.8,1.5;7,1;pwd;Password]
button[0.5,2;7,2;setpwd;Set]
label[0.2,0.2;]] .. minetest.formspec_escape(msg) .. "]")
end
minetest.register_chatcommand("rules", { minetest.register_chatcommand("rules", {
func = function(pname, param) func = function(pname, param)
if param ~= "" and if param ~= "" and
@ -97,38 +123,63 @@ minetest.register_on_newplayer(function(player)
local pname = player:get_player_name() local pname = player:get_player_name()
local privs = minetest.get_player_privs(pname) local privs = minetest.get_player_privs(pname)
privs.shout = nil if privs.interact and privs.fly then
privs.interact = nil privs.interact = false
minetest.set_player_privs(pname, privs) minetest.set_player_privs(pname, privs)
end
rules.show(player) if not has_password(pname) then
end) privs.shout = false
privs.interact = false
minetest.register_on_joinplayer(function(player) privs.kick = false
if need_to_accept(player:get_player_name()) then privs.ban = false
minetest.set_player_privs(pname, privs)
rules.show_pwd(pname)
elseif can_grant_interact(player) then
rules.show(player) rules.show(player)
end end
end) end)
minetest.register_on_player_receive_fields(function(player, form, fields) minetest.register_on_player_receive_fields(function(player, form, fields)
if form ~= "rules:rules" then return end if form == "rules:pwd" then
local pname = player:get_player_name()
if fields.setpwd then
local handler = minetest.get_auth_handler()
if not fields.pwd or fields.pwd:trim() == "" then
rules.show_pwd(pname)
elseif #fields.pwd < 5 then
rules.show_pwd(pname, "Needs at least 5 characters")
else
handler.set_password(pname,
minetest.get_password_hash(pname, fields.pwd))
rules.show(player)
end
else
minetest.kick_player(pname,
"You need to set a password to play on this server.")
end
local pname = player:get_player_name()
if not need_to_accept(pname) then
return true return true
end end
if fields.no then if form ~= "rules:rules" then
return
end
local pname = player:get_player_name()
if not can_grant_interact(player) or not has_password(pname) then
return true
end
if fields.msg then
return true
elseif not fields.yes or fields.no then
minetest.kick_player(pname, minetest.kick_player(pname,
"You need to agree to the rules to play on this server. " .. "You need to agree to the rules to play on this server. " ..
"Please rejoin and confirm another time.") "Please rejoin and confirm another time.")
return true return true
end end
if not fields.yes then
return true
end
local privs = minetest.get_player_privs(pname) local privs = minetest.get_player_privs(pname)
privs.shout = true privs.shout = true
privs.interact = true privs.interact = true

View file

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2022 MT-CTF
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -20,7 +20,7 @@ Excessive camping near the enemy base is also considered spawnkilling!=Übermä
10. Moderator decisions are final.=10. Entscheidungen der Moderatoren sind endgültig. 10. Moderator decisions are final.=10. Entscheidungen der Moderatoren sind endgültig.
Failure to follow these rules may result in a kick or ban=Solltest du diese Regeln brechen kann das durchaus zu einem Kick (Rauswurf) Failure to follow these rules may result in a kick or ban=Solltest du diese Regeln brechen kann das durchaus zu einem Kick (Rauswurf)
(temp or permanent) depending on severity.=oder Ban (Bann) führen, (temporär oder permanent) je nach Schweregrad des Verstoßes. (temp or permanent) depending on severity.=oder Ban (Bann) führen, (temporär oder permanent) je nach Schweregrad des Verstoßes.
Created by rubenwardy. Hosted by philipmi.=Erstellt von rubenwardy. Gehostet von philipmi. Developed by rubenwardy, hosted by philipmi=Entwickelt von rubenwardy, gehostet von philipmi
Moderators=Moderatoren Moderators=Moderatoren
Though the server owner will not actively read private messages or disclose=Auch wenn der Server Besitzer normalerweise nicht aktiv private Nachrichten lesen Though the server owner will not actively read private messages or disclose=Auch wenn der Server Besitzer normalerweise nicht aktiv private Nachrichten lesen
their content outside the mod team, random checks will be done to make sure=oder deren deren Inhalte außerhalb des Moderatoren Teams veröffentlichen their content outside the mod team, random checks will be done to make sure=oder deren deren Inhalte außerhalb des Moderatoren Teams veröffentlichen

View file

@ -20,7 +20,7 @@ Excessive camping near the enemy base is also considered spawnkilling!=¡La acam
10. Moderator decisions are final.=10. Las desiciones de los moderadores son lo final. 10. Moderator decisions are final.=10. Las desiciones de los moderadores son lo final.
Failure to follow these rules may result in a kick or ban=El incumplimiento de estas reglas puede resultar en una expulsión o prohibición Failure to follow these rules may result in a kick or ban=El incumplimiento de estas reglas puede resultar en una expulsión o prohibición
(temp or permanent) depending on severity.=(temporal o permanente) dependiendo de la severidad. (temp or permanent) depending on severity.=(temporal o permanente) dependiendo de la severidad.
Created by rubenwardy. Hosted by philipmi.=Creado por rubenwardy. Hospedado por philipmi. Developed by rubenwardy, hosted by philipmi=Desarrollado por rubenwardy, hospedado por philipmi
Moderators=Moderadores Moderators=Moderadores
Though the server owner will not actively read private messages or disclose=Aunque el dueño del servidor no va a leer activamente los mensajes privados ni divulgará Though the server owner will not actively read private messages or disclose=Aunque el dueño del servidor no va a leer activamente los mensajes privados ni divulgará
their content outside the mod team, random checks will be done to make sure=su contenido fuera del equipo de mods, se realizarán comprobaciones aleatorias para asegurarse their content outside the mod team, random checks will be done to make sure=su contenido fuera del equipo de mods, se realizarán comprobaciones aleatorias para asegurarse

View file

@ -7,7 +7,7 @@ By playing on this server you agree to these rules:=En jouant sur ce serveur, vo
contribute to the goal of the game in a proper way. Consequently,=si ça ne contribue pas à l'objectif du jeu d'une manière correcte. contribute to the goal of the game in a proper way. Consequently,=si ça ne contribue pas à l'objectif du jeu d'une manière correcte.
spawnkilling can already be punished if only two kills are made,=Par conséquent, dépendant de la situation, spawnkill peut déjà spawnkilling can already be punished if only two kills are made,=Par conséquent, dépendant de la situation, spawnkill peut déjà
depending on the situation.=être puni à partir de deux meurtres. depending on the situation.=être puni à partir de deux meurtres.
Excessive camping near the enemy base is also considered spawnkilling!=Le fait de camper excessivement près de la base ennemie est également considéré comme du spawnkilling! Excessive camping near the enemy base is also considered spawnkilling!=Le fait de camper excessivement près de la base ennemie est également considéré comme du spawnkilling !
5. Don't be a traitor. Don't:=5. Ne soyez pas un traître. Il est interdit de: 5. Don't be a traitor. Don't:=5. Ne soyez pas un traître. Il est interdit de:
a. Dig blocks in your base to make it less secure or=a. Détruire des blocs dans la base pour diminuer la sécurité ou a. Dig blocks in your base to make it less secure or=a. Détruire des blocs dans la base pour diminuer la sécurité ou
to trap team mates on purpose.=pour délibérément piéger des membres de votre équipe. to trap team mates on purpose.=pour délibérément piéger des membres de votre équipe.
@ -20,7 +20,7 @@ Excessive camping near the enemy base is also considered spawnkilling!=Le fait d
10. Moderator decisions are final.=10. Les décisions de moderateurs sont irrévocables. 10. Moderator decisions are final.=10. Les décisions de moderateurs sont irrévocables.
Failure to follow these rules may result in a kick or ban=Manquement aux règles peut se résulter d'un kick ou ban Failure to follow these rules may result in a kick or ban=Manquement aux règles peut se résulter d'un kick ou ban
(temp or permanent) depending on severity.=(temporaire ou permanent) dépendant de la sévérité. (temp or permanent) depending on severity.=(temporaire ou permanent) dépendant de la sévérité.
Created by rubenwardy. Hosted by philipmi.=Créé par rubenwardy. Hébergé par philipmi. Developed by rubenwardy, hosted by philipmi=Développé par rubenwardy, hébergé par philipmi
Moderators=Moderateurs Moderators=Moderateurs
Though the server owner will not actively read private messages or disclose=Même si le propriétaire du serveur ne lira pas activement des messages Though the server owner will not actively read private messages or disclose=Même si le propriétaire du serveur ne lira pas activement des messages
their content outside the mod team, random checks will be done to make sure=privés ou révélera leur contenu à personne sauf aux moderateurs, their content outside the mod team, random checks will be done to make sure=privés ou révélera leur contenu à personne sauf aux moderateurs,

View file

@ -20,7 +20,7 @@ Excessive camping near the enemy base is also considered spawnkilling!=Anche il
10. Moderator decisions are final.=10. Le decisioni dei moderatori sono definitive. 10. Moderator decisions are final.=10. Le decisioni dei moderatori sono definitive.
Failure to follow these rules may result in a kick or ban=Mancato rispetto di queste regole può comportare una cacciata (kick) o un'esclusione completa (ban) dal gioco, Failure to follow these rules may result in a kick or ban=Mancato rispetto di queste regole può comportare una cacciata (kick) o un'esclusione completa (ban) dal gioco,
(temp or permanent) depending on severity.=(temporaneamente o permanente) a seconda della gravità. (temp or permanent) depending on severity.=(temporaneamente o permanente) a seconda della gravità.
Created by rubenwardy. Hosted by philipmi.=Creato da rubenwardy. Ospitato da philipmi. Developed by rubenwardy, hosted by philipmi=Sviluppato da rubenwardy, ospitato da philipmi
Moderators=Moderatori Moderators=Moderatori
Though the server owner will not actively read private messages or disclose=Anche se il proprietario del server non leggerà attivamente i messaggi privati o divulgherà Though the server owner will not actively read private messages or disclose=Anche se il proprietario del server non leggerà attivamente i messaggi privati o divulgherà
their content outside the mod team, random checks will be done to make sure=il loro contenuto fuori del team dei moderatori, verranno effettuati controlli casuali per assicurarsi their content outside the mod team, random checks will be done to make sure=il loro contenuto fuori del team dei moderatori, verranno effettuati controlli casuali per assicurarsi

View file

@ -20,7 +20,7 @@ Excessive camping near the enemy base is also considered spawnkilling!=Overdadig
10. Moderator decisions are final.=10. Beslissingen van moderators zijn onherroepelijk. 10. Moderator decisions are final.=10. Beslissingen van moderators zijn onherroepelijk.
Failure to follow these rules may result in a kick or ban=Het falen om deze regels te volgen kan resulteren in een kick of ban Failure to follow these rules may result in a kick or ban=Het falen om deze regels te volgen kan resulteren in een kick of ban
(temp or permanent) depending on severity.=(tijdelijk of permanent), afhangend van de ernstigheid. (temp or permanent) depending on severity.=(tijdelijk of permanent), afhangend van de ernstigheid.
Created by rubenwardy. Hosted by philipmi.=Gemaakt door rubenwardy. Gehost door philipmi. Developed by rubenwardy, hosted by philipmi=Ontworpen door rubenwardy, gehost door philipmi
Moderators=Moderators Moderators=Moderators
Though the server owner will not actively read private messages or disclose=Ook al zal de server eigenaar niet actief privéberichten lezen of Though the server owner will not actively read private messages or disclose=Ook al zal de server eigenaar niet actief privéberichten lezen of
their content outside the mod team, random checks will be done to make sure=hun inhoud onthullen buiten het mod team, toch zullen willekeurige their content outside the mod team, random checks will be done to make sure=hun inhoud onthullen buiten het mod team, toch zullen willekeurige