diff --git a/twi_fx/init.lua b/prejoin_msg/init.lua similarity index 73% copy from twi_fx/init.lua copy to prejoin_msg/init.lua index 7b669bc..631a4b5 100644 --- a/twi_fx/init.lua +++ b/prejoin_msg/init.lua @@ -1,35 +1,33 @@ --- twi_mods/twi_fx/init.lua --- Common functions +-- twi_mods/prejoin_msg/init.lua +-- Send message to moderators on prejoin player --[[ Copyright © 2024 1F616EMO 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. ]] -twi_fx = {} - -function twi_fx.register_all_stairsplus(modname, name) - local nodename = modname .. ":" .. name - local def = table.copy(minetest.registered_nodes[nodename]) - - def.is_ground_content = false - def.sunlight_propagates = true - - stairsplus:register_all(modname, name, nodename, def) -end +local auth +minetest.register_on_prejoinplayer(function(name) + auth = auth or minetest.get_auth_handler() + if not auth.get_auth(name) then + twi_fx.chat_send_moderators("New player " .. name .. " is trying to join") + else + twi_fx.chat_send_moderators("Player " .. name .. " is trying to join") + end +end) diff --git a/prejoin_msg/mod.conf b/prejoin_msg/mod.conf new file mode 100644 index 0000000..6edd04d --- /dev/null +++ b/prejoin_msg/mod.conf @@ -0,0 +1,2 @@ +name = prejoin_msg +depends = twi_fx diff --git a/twi_fx/init.lua b/twi_fx/init.lua index 7b669bc..6c24a90 100644 --- a/twi_fx/init.lua +++ b/twi_fx/init.lua @@ -1,35 +1,39 @@ -- twi_mods/twi_fx/init.lua -- Common functions --[[ Copyright © 2024 1F616EMO 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. ]] twi_fx = {} function twi_fx.register_all_stairsplus(modname, name) local nodename = modname .. ":" .. name local def = table.copy(minetest.registered_nodes[nodename]) def.is_ground_content = false def.sunlight_propagates = true stairsplus:register_all(modname, name, nodename, def) end + +function twi_fx.chat_send_moderators(msg) + beerchat.on_channel_message("Moderators", "SYSTEM", msg) +end diff --git a/twi_fx/mod.conf b/twi_fx/mod.conf index ea1399c..c78bf85 100644 --- a/twi_fx/mod.conf +++ b/twi_fx/mod.conf @@ -1,2 +1,2 @@ name = twi_fx -depends = moreblocks +depends = moreblocks, beerchat