Conflicts:
	init.lua
	locale/rules.de.tr
	locale/rules.es.tr
	locale/rules.fr.tr
	locale/rules.it.tr
	locale/rules.nl.tr
This commit is contained in:
philipmi 2022-07-01 18:27:28 +02:00
commit 6be72af82c
7 changed files with 46 additions and 76 deletions

View file

@ -1,6 +1,3 @@
-- License: WTFPL
rules = {}
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(" (temp or permanent) depending on severity."),
"",
S("Developed by rubenwardy, hosted by philipmi"),
S("Created by rubenwardy. Hosted by philipmi."),
S("Moderators")..": philipmi",
"",
S("Though the server owner will not actively read private messages or disclose"),
@ -56,16 +53,9 @@ if minetest.global_exists("sfinv") then
})
end
local function can_grant_interact(player)
local pname = player:get_player_name()
local function need_to_accept(pname)
return not minetest.check_player_privs(pname, { interact = true }) and
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, "")
not minetest.check_player_privs(pname, { shout = true })
end
function rules.show(player)
@ -73,11 +63,7 @@ function rules.show(player)
local fs = "size[12,8.6]bgcolor[#080808BB;true]" ..
"textlist[0,0;12,7.9;msg;" .. rules.txt .. ";-1;true]"
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
if not need_to_accept(pname) then
fs = fs .. "button_exit[0.5,7.6;7,2;ok;Okay]"
else
local yes = minetest.formspec_escape("Yes, let me play!")
@ -90,18 +76,6 @@ function rules.show(player)
minetest.show_formspec(pname, "rules:rules", fs)
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", {
func = function(pname, param)
if param ~= "" and
@ -123,63 +97,38 @@ minetest.register_on_newplayer(function(player)
local pname = player:get_player_name()
local privs = minetest.get_player_privs(pname)
if privs.interact and privs.fly then
privs.interact = false
privs.shout = nil
privs.interact = nil
minetest.set_player_privs(pname, privs)
end
if not has_password(pname) then
privs.shout = false
privs.interact = false
privs.kick = false
privs.ban = false
minetest.set_player_privs(pname, privs)
rules.show_pwd(pname)
elseif can_grant_interact(player) then
rules.show(player)
end)
minetest.register_on_joinplayer(function(player)
if need_to_accept(player:get_player_name()) then
rules.show(player)
end
end)
minetest.register_on_player_receive_fields(function(player, form, fields)
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
return true
end
if form ~= "rules:rules" then
return
end
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
if not need_to_accept(pname) then
return true
end
if fields.msg then
return true
elseif not fields.yes or fields.no then
if fields.no then
minetest.kick_player(pname,
"You need to agree to the rules to play on this server. " ..
"Please rejoin and confirm another time.")
return true
end
if not fields.yes then
return true
end
local privs = minetest.get_player_privs(pname)
privs.shout = 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.
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.
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
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

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.
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.
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
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

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.
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é.
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
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,

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.
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à.
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
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

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.
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.
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
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