Added ability to inspect other players money if have server priv

This commit is contained in:
James David Clarke 2024-01-14 22:00:44 +00:00 committed by impulse
parent 7b826ac527
commit c33c4be134

@ -45,15 +45,24 @@ core.register_chatcommand("pay", {
core.register_chatcommand("money", { core.register_chatcommand("money", {
description = S("Return your emeralds in your bank account."), description = S("Return your emeralds in your bank account."),
func = function(name, param) func = function(name, param)
local emeralds = emeraldbank.get_emeralds(name) -- Determine the target player: either the command issuer or the specified player
local target_player = param ~= "" and minetest.check_player_privs(name, {server=true}) and param or name
-- Check and return the emerald balance
local emeralds = emeraldbank.get_emeralds(target_player)
if emeralds then if emeralds then
if target_player == name then
minetest.chat_send_player(name, S("Emeralds in Bank: @1", emeralds)) minetest.chat_send_player(name, S("Emeralds in Bank: @1", emeralds))
else
minetest.chat_send_player(name, S("@1's Emeralds in Bank: @2", target_player, emeralds))
end
return true return true
end end
return false return false
end end
}) })
-- admin chat command -- admin chat command
core.register_chatcommand("emeralds", { core.register_chatcommand("emeralds", {
params = "<player> <num>", params = "<player> <num>",