Fix crash when non-players dig or place nodes

master
PilzAdam 2014-01-01 21:44:44 +01:00
parent 80a18d267b
commit 547eb0ec61
1 changed files with 6 additions and 2 deletions

View File

@ -165,11 +165,15 @@ minetest.register_on_shutdown(function()
end)
minetest.register_on_dignode(function(pos, oldnode, player)
stats.increase_stat(player, "digged_nodes", 1)
if player and player:is_player() then
stats.increase_stat(player, "digged_nodes", 1)
end
end)
minetest.register_on_placenode(function(pos, newnode, player, oldnode, itemstack)
stats.increase_stat(player, "placed_nodes", 1)
if player and player:is_player() then
stats.increase_stat(player, "placed_nodes", 1)
end
end)
minetest.register_on_dieplayer(function(player)