Add money3.delete()
This commit is contained in:
parent
79da086daf
commit
1c9e43d471
13
core.lua
13
core.lua
|
@ -51,6 +51,19 @@ function money3.user_exists(name)
|
|||
end
|
||||
money3.has_credit = money3.user_exists
|
||||
|
||||
-- Delete data associated with account
|
||||
function money3.delete(name)
|
||||
local lname = name:lower()
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
if player:get_player_name():lower() == lname then
|
||||
-- Deleting the accounts of online players will cause bugs
|
||||
return false
|
||||
end
|
||||
end
|
||||
storage:set_string("balance-" .. lname, "")
|
||||
return true
|
||||
end
|
||||
|
||||
-- Add money
|
||||
function money3.add(name, amount)
|
||||
if amount ~= amount or amount < 0 then
|
||||
|
|
9
init.lua
9
init.lua
|
@ -79,14 +79,7 @@ if minetest.get_modpath("um_core") then
|
|||
money3.set(name, default_balance or 0)
|
||||
return true
|
||||
end,
|
||||
delete_account = function(name)
|
||||
-- Deleting the accounts of online players will cause bugs
|
||||
if minetest.get_player_by_name(name) then
|
||||
return false
|
||||
end
|
||||
storage:set_string("balance-" .. name:lower(), "")
|
||||
return true
|
||||
end,
|
||||
delete_account = money3.delete,
|
||||
account_exists = money3.user_exists,
|
||||
list_accounts = function()
|
||||
local get_canonical_name = make_canonical_name_cache()
|
||||
|
|
Loading…
Reference in New Issue