Compare commits

..

7 commits

Author SHA1 Message Date
philipmi
6be72af82c Merge branch 'master' of https://github.com/MT-CTF/rules
 Conflicts:
	init.lua
	locale/rules.de.tr
	locale/rules.es.tr
	locale/rules.fr.tr
	locale/rules.it.tr
	locale/rules.nl.tr
2022-07-01 18:27:28 +02:00
savilli
bc0e386237 Add myself 2022-05-09 22:20:19 +00:00
savilli
c8af94235d Show rules for players on join if they didn't accept them 2022-05-09 20:23:52 +00:00
LoneWolfHT
62fad3d1e7
Update translations 2022-05-02 16:33:03 -07:00
LoneWolfHT
0e9f0808c0
Update init.lua 2022-05-02 16:26:16 -07:00
LoneWolfHT
c8d4b195af
Remove WTFPL as license 2022-05-02 16:24:13 -07:00
LoneWolfHT
8e1c52b110
Create license.txt 2022-05-02 16:23:51 -07:00
7 changed files with 46 additions and 76 deletions

View file

@ -1,6 +1,3 @@
-- License: WTFPL
rules = {} rules = {}
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
@ -30,7 +27,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("Developed by rubenwardy, hosted by philipmi"), S("Created 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"),
@ -56,16 +53,9 @@ if minetest.global_exists("sfinv") then
}) })
end end
local function can_grant_interact(player) local function need_to_accept(pname)
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, { fly = true }) not minetest.check_player_privs(pname, { shout = 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)
@ -73,11 +63,7 @@ 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 has_password(pname) then if not need_to_accept(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!")
@ -90,18 +76,6 @@ 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
@ -123,63 +97,38 @@ 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)
if privs.interact and privs.fly then privs.shout = nil
privs.interact = false privs.interact = nil
minetest.set_player_privs(pname, privs) minetest.set_player_privs(pname, privs)
end
if not has_password(pname) then rules.show(player)
privs.shout = false end)
privs.interact = false
privs.kick = false minetest.register_on_joinplayer(function(player)
privs.ban = false if need_to_accept(player:get_player_name()) then
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:pwd" then if form ~= "rules:rules" then return end
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
return true
end
if form ~= "rules:rules" then
return
end
local pname = player:get_player_name() local pname = player:get_player_name()
if not can_grant_interact(player) or not has_password(pname) then if not need_to_accept(pname) then
return true return true
end end
if fields.msg then if fields.no 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

21
license.txt Normal file
View file

@ -0,0 +1,21 @@
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.
Developed by rubenwardy, hosted by philipmi=Entwickelt von rubenwardy, gehostet von philipmi Created by rubenwardy. Hosted by philipmi.=Erstellt 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.
Developed by rubenwardy, hosted by philipmi=Desarrollado por rubenwardy, hospedado por philipmi Created by rubenwardy. Hosted by philipmi.=Creado 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

@ -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é.
Developed by rubenwardy, hosted by philipmi=Développé par rubenwardy, hébergé par philipmi Created by rubenwardy. Hosted by philipmi.=Créé 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à.
Developed by rubenwardy, hosted by philipmi=Sviluppato da rubenwardy, ospitato da philipmi Created by rubenwardy. Hosted by philipmi.=Creato 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.
Developed by rubenwardy, hosted by philipmi=Ontworpen door rubenwardy, gehost door philipmi Created by rubenwardy. Hosted by philipmi.=Gemaakt 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