2013-09-03 01:16:14 +02:00
|
|
|
|
2013-12-18 02:31:11 +01:00
|
|
|
local old_is_protected = minetest.is_protected
|
2013-12-15 23:47:56 +01:00
|
|
|
function minetest.is_protected(pos, name)
|
|
|
|
if not areas:canInteract(pos, name) then
|
|
|
|
return true
|
2013-09-03 23:09:11 +02:00
|
|
|
end
|
2013-12-15 23:47:56 +01:00
|
|
|
return old_is_protected(pos, name)
|
|
|
|
end
|
2013-09-03 23:09:11 +02:00
|
|
|
|
2013-12-15 23:47:56 +01:00
|
|
|
minetest.register_on_protection_violation(function(pos, name)
|
2018-02-05 23:49:18 +01:00
|
|
|
local player = minetest.get_player_by_name(name)
|
|
|
|
local playerpos = player:getpos()
|
2013-12-15 23:47:56 +01:00
|
|
|
if not areas:canInteract(pos, name) then
|
|
|
|
local owners = areas:getNodeOwners(pos)
|
|
|
|
minetest.chat_send_player(name,
|
|
|
|
("%s is protected by %s."):format(
|
|
|
|
minetest.pos_to_string(pos),
|
|
|
|
table.concat(owners, ", ")))
|
2018-02-05 23:52:01 +01:00
|
|
|
minetest.after(1,anti_lag,{player=player,playerpos=playerpos})
|
|
|
|
--player:setpos(playerpos)
|
2013-09-03 01:16:14 +02:00
|
|
|
end
|
2013-12-15 23:47:56 +01:00
|
|
|
end)
|
2013-09-03 01:16:14 +02:00
|
|
|
|
2018-02-05 23:49:18 +01:00
|
|
|
function anti_lag(player)
|
|
|
|
player.player:setpos(player.playerpos)
|
|
|
|
end
|