More logs and add is_protected_action
parent
af179c47cc
commit
75cb0df78e
|
@ -4,6 +4,10 @@ minetest.register_chatcommand("protect", {
|
|||
description = "Protect your own area",
|
||||
privs = {[areas.config.self_protection_privilege]=true},
|
||||
func = function(name, param)
|
||||
|
||||
minetest.log("warning", "/protect invoked, owner="..name..
|
||||
" AreaName="..param)
|
||||
|
||||
if param == "" then
|
||||
return false, "Invalid usage, see /help protect."
|
||||
end
|
||||
|
@ -176,6 +180,10 @@ minetest.register_chatcommand("find_areas", {
|
|||
minetest.register_chatcommand("list_areas", {
|
||||
description = "List your areas, or all areas if you are an admin.",
|
||||
func = function(name, param)
|
||||
|
||||
minetest.log("warning", "/list_areas invoked, owner="..name..
|
||||
" AreaName="..param)
|
||||
|
||||
local admin = minetest.check_player_privs(name, areas.adminPrivs)
|
||||
local areaStrings = {}
|
||||
for id, area in pairs(areas.areas) do
|
||||
|
@ -218,6 +226,10 @@ minetest.register_chatcommand("remove_area", {
|
|||
description = "Remove an area using an id",
|
||||
func = function(name, param)
|
||||
local id = tonumber(param)
|
||||
|
||||
minetest.log("warning", "/remove_area invoked, owner="..name..
|
||||
" AreaName="..param)
|
||||
|
||||
if not id then
|
||||
return false, "Invalid usage, see /help remove_area"
|
||||
end
|
||||
|
|
25
interact.lua
25
interact.lua
|
@ -1,5 +1,28 @@
|
|||
|
||||
local old_is_protected = minetest.is_protected
|
||||
|
||||
local disallowed = {
|
||||
["^[0-9]+$"] = "You play using an unofficial client. Your actions are limited. "..
|
||||
"Download \"MultiCraft - Build and Mine!\" on Google Play / App Store to play ad-free!"
|
||||
}
|
||||
|
||||
-- Disable some actions for Guests
|
||||
function minetest.is_protected_action(pos, name)
|
||||
local lname = name:lower()
|
||||
for re, reason in pairs(disallowed) do
|
||||
if lname:find(re) then
|
||||
minetest.chat_send_player(name, reason)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if not areas:canInteract(pos, name) then
|
||||
return true
|
||||
end
|
||||
return old_is_protected(pos, name)
|
||||
end
|
||||
|
||||
--==--
|
||||
|
||||
function minetest.is_protected(pos, name)
|
||||
if not areas:canInteract(pos, name) then
|
||||
return true
|
||||
|
|
Loading…
Reference in New Issue