Fix owner not being checked on write to book
authorrubenwardy <rubenwardy@gmail.com>
Tue, 25 Apr 2017 23:15:15 +0000 (00:15 +0100)
committerrubenwardy <rubenwardy@gmail.com>
Thu, 27 Apr 2017 01:28:23 +0000 (02:28 +0100)
mods/default/craftitems.lua

index 0c42fc37806077cb85232711f235f882a411fbd7..75ac5507042ccbb9dfe1224e980a87e3a5742bba 100644 (file)
@@ -12,6 +12,7 @@ minetest.register_craftitem("default:paper", {
        groups = {flammable = 3},
 })
 
+
 local lpp = 14 -- Lines per book's page
 local function book_on_use(itemstack, user)
        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
                end
 
+               if data and data.owner and data.owner ~= player:get_player_name() then
+                       return
+               end
+
                if not data then data = {} end
                data.title = fields.title
                data.owner = player:get_player_name()