add player cleanup (auth. meta and inventory) if the xp is still 0 after logout
This commit is contained in:
parent
df0b906823
commit
cf894e0707
5
init.lua
5
init.lua
@ -21,6 +21,11 @@ if minetest.get_modpath("bucket") and minetest.get_modpath("xp_redo") then
|
||||
dofile(MP.."/xp_priv.lua")
|
||||
end
|
||||
|
||||
-- player cleanup
|
||||
if minetest.get_modpath("xp_redo") then
|
||||
dofile(MP.."/player_cleanup.lua")
|
||||
end
|
||||
|
||||
-- loot customization
|
||||
if minetest.get_modpath("loot") then
|
||||
dofile(MP.."/loot.lua")
|
||||
|
@ -1,6 +1,14 @@
|
||||
|
||||
|
||||
|
||||
-- TODO call on leave-player if the xp-value is around 0
|
||||
-- minetest.remove_player(name)
|
||||
-- minetest.remove_player_auth(name)
|
||||
-- remove player data if the xp-value is around 0 (auth, meta and inventory)
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user