@@ -59,7 +59,7 @@ s_protect.command_show = function(name)
5959 local player_pos = vector .round (player :getpos ())
6060 local data = s_protect .get_data (player_pos )
6161
62- minetest .add_entity (s_protect .get_center (player_pos ), " s_protect :marker" )
62+ minetest .add_entity (s_protect .get_center (player_pos ), " simple_protection :marker" )
6363 local axis = s_protect .get_y_axis (player_pos .y )
6464 local y_end = axis + s_protect .claim_height
6565 minetest .chat_send_player (name , " Vertical area limit from Y " .. axis .. " to " .. y_end )
@@ -180,23 +180,22 @@ s_protect.command_unshareall = function(name, param)
180180 removed = true
181181 end
182182
183- -- loops everywhere
183+ -- Unshare each single claim
184184 for pos , data in pairs (s_protect .claims ) do
185185 if data .owner == name then
186186 if table_delete (data .shared , param ) then
187187 removed = true
188188 end
189189 end
190190 end
191- s_protect .save ()
192191 if not removed then
193- minetest .chat_send_player (name , param .. " did not have access to any of your areas." )
194- return
192+ return false , param .. " did not have access to any of your areas."
195193 end
196- minetest . chat_send_player ( name , param .. " has no longer access to your areas. " )
194+ s_protect . save ( )
197195 if minetest .get_player_by_name (param ) then
198196 minetest .chat_send_player (param , name .. " unshared all areas with you." )
199197 end
198+ return true , param .. " has no longer access to your areas."
200199end
201200
202201s_protect .command_unclaim = function (name )
@@ -205,13 +204,11 @@ s_protect.command_unclaim = function(name)
205204 local pos = s_protect .get_location (player_pos )
206205 local data = s_protect .claims [pos ]
207206 if not data then
208- minetest .chat_send_player (name , " You do not own this area." )
209- return
207+ return false , " You do not own this area."
210208 end
211- local priv = minetest .check_player_privs (name , {simple_protection = true })
209+ local privs = minetest .check_player_privs (name , {simple_protection = true })
212210 if name ~= data .owner and not priv then
213- minetest .chat_send_player (name , " You do not own this area." )
214- return
211+ return false , " You do not own this area."
215212 end
216213 if not priv and s_protect .claim_return then
217214 local inv = player :get_inventory ()
@@ -221,5 +218,5 @@ s_protect.command_unclaim = function(name)
221218 end
222219 s_protect .claims [pos ] = nil
223220 s_protect .save ()
224- minetest . chat_send_player ( name , " This area is unowned now." )
221+ return true , " This area is unowned now."
225222end
0 commit comments