From 64d914e9e9c2bf1d6594a766a2901c87fe2a4311 Mon Sep 17 00:00:00 2001 From: coil <51716565+coil0@users.noreply.github.com> Date: Fri, 17 Jan 2020 22:06:49 -0500 Subject: [PATCH] Fix crash on protection check (#27) --- functions.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/functions.lua b/functions.lua index 2316475..9a65904 100644 --- a/functions.lua +++ b/functions.lua @@ -345,8 +345,13 @@ function tp.tpc_send(player, coordinates) end else if minetest.check_player_privs(pname, {tp_tpc = true}) then - local protected = minetest.is_protected(target_coords, pname) - if protected and minetest.get_modpath("areas") then + local protected = minetest.is_protected(target_coords, player) + if protected then + minetest.record_protection_violation(target_coords, player) + return + end + + if minetest.get_modpath("areas") then if not areas:canInteract(target_coords, player) then local owners = areas:getNodeOwners(target_coords) minetest.chat_send_player(player, S("Error: @1 is protected by @2.", minetest.pos_to_string(target_coords), table.concat(owners, ", "))) @@ -356,6 +361,7 @@ function tp.tpc_send(player, coordinates) return end end + tp.tpc_teleport_player(player) minetest.chat_send_player(player, S("Teleporting to: @1, @2, @3", posx, posy, posz)) if minetest.get_modpath("chat2") then