diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-11-11 00:01:41 +0100 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-11-11 00:01:41 +0100 |
commit | 7202b5373926a4c7dbc33e197e2aca19fee7d01d (patch) | |
tree | 269b96d1b925f28f77c5de2e3537663cd7e00545 | |
parent | 2f1e86fcf2e384fc42cf2dd6d1f337756499459f (diff) | |
download | xban2-7202b5373926a4c7dbc33e197e2aca19fee7d01d.tar.gz xban2-7202b5373926a4c7dbc33e197e2aca19fee7d01d.tar.bz2 xban2-7202b5373926a4c7dbc33e197e2aca19fee7d01d.zip |
Add setting to disallow new accounts while no moderators are online
-rw-r--r-- | init.lua | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -239,6 +239,15 @@ minetest.register_on_prejoinplayer(function(name, ip) return ("Banned: Expires: %s, Reason: %s"):format( date, e.reason) end + if minetest.settings:get("moderate_new_accounts") and not minetest.player_exists(name) then + local players = minetest.get_connected_players() + for i=1,#players do + if minetest.check_player_privs(players[i]:get_player_name(), {kick = true}) then + return + end + end + return "No new accounts are allowed while there is no moderator online. Please try rejoining later!" + end end) minetest.register_on_joinplayer(function(player) |