1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 00:20:17 +01:00

Merge pull request #359 from frodon1/server_crash

Fix calls to check_player_privs with player name instead of player userdata
This commit is contained in:
Vanessa Ezekowitz 2017-02-27 16:54:56 -05:00 committed by GitHub
commit f6701bd9cd
3 changed files with 19 additions and 15 deletions

View File

@ -119,7 +119,7 @@ function homedecor.handle_inventory(name, def, original_def)
local playername = player:get_player_name() local playername = player:get_player_name()
if playername == owner or if playername == owner or
minetest.check_player_privs(player, "protection_bypass") then minetest.check_player_privs(playername, "protection_bypass") then
return allow_move and return allow_move and
allow_move(pos, from_list, from_index, to_list, to_index, count, player) or allow_move(pos, from_list, from_index, to_list, to_index, count, player) or
count count
@ -138,7 +138,7 @@ function homedecor.handle_inventory(name, def, original_def)
local playername = player:get_player_name() local playername = player:get_player_name()
if playername == owner or if playername == owner or
minetest.check_player_privs(player, "protection_bypass") then minetest.check_player_privs(playername, "protection_bypass") then
return allow_put and allow_put(pos, listname, index, stack, player) or return allow_put and allow_put(pos, listname, index, stack, player) or
stack:get_count() stack:get_count()
end end
@ -156,7 +156,7 @@ function homedecor.handle_inventory(name, def, original_def)
local playername = player:get_player_name() local playername = player:get_player_name()
if playername == owner or if playername == owner or
minetest.check_player_privs(player, "protection_bypass") then minetest.check_player_privs(playername, "protection_bypass") then
return allow_take and allow_take(pos, listname, index, stack, player) or return allow_take and allow_take(pos, listname, index, stack, player) or
stack:get_count() stack:get_count()
end end

View File

@ -52,12 +52,12 @@ minetest.register_node("inbox:empty", {
minetest.check_player_privs(player, "protection_bypass") and minetest.check_player_privs(player, "protection_bypass") and
clicker:get_player_control().aux1 then clicker:get_player_control().aux1 then
minetest.show_formspec( minetest.show_formspec(
clicker:get_player_name(), player,
"inbox:mailbox", "inbox:mailbox",
inbox.get_inbox_formspec(pos)) inbox.get_inbox_formspec(pos))
else else
minetest.show_formspec( minetest.show_formspec(
clicker:get_player_name(), player,
"inbox:mailbox", "inbox:mailbox",
inbox.get_inbox_insert_formspec(pos)) inbox.get_inbox_insert_formspec(pos))
end end

View File

@ -129,8 +129,9 @@ minetest.register_node("itemframes:frame",{
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
if not itemstack then return end if not itemstack then return end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if clicker:get_player_name() == meta:get_string("owner") or local name = clicker and clicker:get_player_name()
minetest.check_player_privs(clicker, "protection_bypass") then if name == meta:get_string("owner") or
minetest.check_player_privs(name, "protection_bypass") then
drop_item(pos,node) drop_item(pos,node)
local s = itemstack:take_item() local s = itemstack:take_item()
meta:set_string("item",s:to_string()) meta:set_string("item",s:to_string())
@ -140,8 +141,9 @@ minetest.register_node("itemframes:frame",{
end, end,
on_punch = function(pos,node,puncher) on_punch = function(pos,node,puncher)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if puncher:get_player_name() == meta:get_string("owner") or local name = puncher and puncher:get_player_name()
minetest.check_player_privs(puncher, "protection_bypass") then if name == meta:get_string("owner") or
minetest.check_player_privs(name, "protection_bypass") then
drop_item(pos, node) drop_item(pos, node)
end end
end, end,
@ -150,7 +152,7 @@ minetest.register_node("itemframes:frame",{
local name = player and player:get_player_name() local name = player and player:get_player_name()
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
return name == meta:get_string("owner") or return name == meta:get_string("owner") or
minetest.check_player_privs(player, "protection_bypass") minetest.check_player_privs(name, "protection_bypass")
end, end,
on_destruct = function(pos) on_destruct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
@ -190,8 +192,9 @@ minetest.register_node("itemframes:pedestal",{
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
if not itemstack then return end if not itemstack then return end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if clicker:get_player_name() == meta:get_string("owner") or local name = clicker and clicker:get_player_name()
minetest.check_player_privs(clicker, "protection_bypass") then if name == meta:get_string("owner") or
minetest.check_player_privs(name, "protection_bypass") then
drop_item(pos,node) drop_item(pos,node)
local s = itemstack:take_item() local s = itemstack:take_item()
meta:set_string("item",s:to_string()) meta:set_string("item",s:to_string())
@ -201,8 +204,9 @@ minetest.register_node("itemframes:pedestal",{
end, end,
on_punch = function(pos,node,puncher) on_punch = function(pos,node,puncher)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if puncher:get_player_name() == meta:get_string("owner") or local name = puncher and puncher:get_player_name()
minetest.check_player_privs(puncher, "protection_bypass") then if name == meta:get_string("owner") or
minetest.check_player_privs(name, "protection_bypass") then
drop_item(pos,node) drop_item(pos,node)
end end
end, end,
@ -211,7 +215,7 @@ minetest.register_node("itemframes:pedestal",{
local name = player and player:get_player_name() local name = player and player:get_player_name()
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
return name == meta:get_string("owner") or return name == meta:get_string("owner") or
minetest.check_player_privs(player, "protection_bypass") minetest.check_player_privs(name, "protection_bypass")
end, end,
on_destruct = function(pos) on_destruct = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)