add player cleanup (auth. meta and inventory) if the xp is still 0 after logout

This commit is contained in:
BuckarooBanzay 2020-03-05 15:08:44 +01:00
parent df0b906823
commit cf894e0707
2 changed files with 16 additions and 3 deletions

View File

@ -21,6 +21,11 @@ if minetest.get_modpath("bucket") and minetest.get_modpath("xp_redo") then
dofile(MP.."/xp_priv.lua") dofile(MP.."/xp_priv.lua")
end end
-- player cleanup
if minetest.get_modpath("xp_redo") then
dofile(MP.."/player_cleanup.lua")
end
-- loot customization -- loot customization
if minetest.get_modpath("loot") then if minetest.get_modpath("loot") then
dofile(MP.."/loot.lua") dofile(MP.."/loot.lua")

View File

@ -1,6 +1,14 @@
-- TODO call on leave-player if the xp-value is around 0 -- remove player data if the xp-value is around 0 (auth, meta and inventory)
-- minetest.remove_player(name) minetest.register_on_leaveplayer(function(player)
-- minetest.remove_player_auth(name) local playername = player:get_player_name()
local xp = xp_redo.get_xp(playername)
if xp < 10 then
minetest.after(1.0, function()
minetest.remove_player(playername)
minetest.remove_player_auth(playername)
end)
end
end)