From: rubenwardy Date: Tue, 25 Apr 2017 23:15:15 +0000 (+0100) Subject: Fix owner not being checked on write to book X-Git-Tag: 0.4.16~20 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2917562728927eda925d3e9ba17bd3cf945dae2a;p=oweals%2Fminetest_game.git Fix owner not being checked on write to book --- diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua index 0c42fc37..75ac5507 100644 --- a/mods/default/craftitems.lua +++ b/mods/default/craftitems.lua @@ -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()