Add canonical_name function for unified_money

This commit is contained in:
luk3yx 2023-08-14 20:40:47 +12:00
parent ae27316629
commit c24bf6ebe3
1 changed files with 12 additions and 1 deletions

View File

@ -64,7 +64,7 @@ if minetest.get_modpath("um_core") and
names[name:lower()] = name
end
return function(name)
return names[name:lower()]
return names[name]
end
end
@ -93,6 +93,17 @@ if minetest.get_modpath("um_core") and
end
return accounts
end,
canonical_name = function(name)
-- Non-player accounts are stored with lowercase names
if name:find(":", 1, true) then
return name:lower()
end
-- While player accounts are stored with lowercase names as well,
-- the check for the "money" privilege makes them effectively case
-- sensitive.
return name
end,
})
end