Fix owner not being checked on write to book
This commit is contained in:
parent
c2d1a5ed4b
commit
2917562728
|
@ -12,6 +12,7 @@ minetest.register_craftitem("default:paper", {
|
||||||
groups = {flammable = 3},
|
groups = {flammable = 3},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
local lpp = 14 -- Lines per book's page
|
local lpp = 14 -- Lines per book's page
|
||||||
local function book_on_use(itemstack, user)
|
local function book_on_use(itemstack, user)
|
||||||
local player_name = user:get_player_name()
|
local player_name = user:get_player_name()
|
||||||
|
@ -93,6 +94,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
data = stack:get_meta():to_table().fields
|
data = stack:get_meta():to_table().fields
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if data and data.owner and data.owner ~= player:get_player_name() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if not data then data = {} end
|
if not data then data = {} end
|
||||||
data.title = fields.title
|
data.title = fields.title
|
||||||
data.owner = player:get_player_name()
|
data.owner = player:get_player_name()
|
||||||
|
|
Loading…
Reference in New Issue