in skyblock player can only protect areas above his island ( if not admin)

This commit is contained in:
rnd 2018-07-01 10:19:18 +02:00
parent 4413ce64f6
commit 8f2cb95196

View File

@ -155,14 +155,14 @@ basic_protect.protect_new = function(p,name)
if skyblock and skyblock.players and skyblock.get_island_pos then if skyblock and skyblock.players and skyblock.get_island_pos then
local skyid = skyblock.players[name].id; local skyid = skyblock.players[name].id;
local skypos = skyblock.get_island_pos(skyid); local skypos = skyblock.get_island_pos(skyid);
local dist = math.max(math.abs(p.x-skypos.x),math.abs(p.y-skypos.y),math.abs(p.z-skypos.z)); local dist = math.max(math.abs(p.x-skypos.x),math.abs(p.z-skypos.z));
if dist>skyblock.islands_gap then if dist>skyblock.islands_gap then
local privs = minetest.get_player_privs(name); local privs = minetest.get_player_privs(name);
if not privs.kick then if not privs.kick then
local meta = minetest.get_meta(skypos); local meta = minetest.get_meta(skypos);
local mstring = meta:get_string("infotext"); local mstring = meta:get_string("infotext");
if string.find(mstring,"ISLAND") then -- tried to protect other island if string.find(mstring,"ISLAND") then -- tried to protect other island
minetest.chat_send_player(name, "#PROTECTOR: you can only protect empty space or your island") minetest.chat_send_player(name, "#PROTECTOR: you can only protect empty space or your island or above it")
minetest.set_node(p,{name = "air"}) -- clear protector minetest.set_node(p,{name = "air"}) -- clear protector
return return
end end