diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2018-09-26 11:29:55 +0200 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2018-09-26 11:29:55 +0200 |
commit | d42923c85fe063901d36fd95ab49339db33910ed (patch) | |
tree | 8a736df36d35490b8c2f015d4b9bbbfa43eb8d0c | |
parent | 563e0a7bca093aae8ddc0e1af73083b406b809f1 (diff) |
Added alt-accounts to /xban_record
/xban_record now returns a list of other names used by the player.
-rw-r--r-- | init.lua | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -176,6 +176,20 @@ function xban.add_whitelist(name_or_ip, source) return true end +function xban.get_alt_accounts(player) + local e = xban.find_entry(player) + local names = {} + if not e then + return nil, ("No entry for `%s'"):format(player) + end + for name in pairs(e.names) do + if not string.match(name, "%.") and name ~= player then + table.insert(names, name) + end + end + return names +end + function xban.get_record(player) local e = xban.find_entry(player) if not e then @@ -200,6 +214,7 @@ function xban.get_record(player) last_pos = ("User was last seen at %s"):format( minetest.pos_to_string(e.last_pos)) end + return record, last_pos end @@ -325,6 +340,10 @@ minetest.register_chatcommand("xban_record", { for _, e in ipairs(record) do minetest.chat_send_player(name, "[xban] "..e) end + local alt_accounts = xban.get_alt_accounts(plname) + local msg = "Alt accounts: " + msg = msg .. table.concat(alt_accounts, ", ") + minetest.chat_send_player(name, "[xban] "..msg) if last_pos then minetest.chat_send_player(name, "[xban] "..last_pos) end |