Override minetest.get_server_status()

Override minetest.get_server_status() instead of /status in a futile attempt to get the initial status message hiding cloaked players.
This commit is contained in:
luk3yx 2018-04-02 06:57:11 +12:00
parent e90e1d7583
commit 3df9c5cdd7
1 changed files with 12 additions and 15 deletions

View File

@ -10,6 +10,7 @@ cloaking = {}
-- can use them.
cloaking.get_connected_players = minetest.get_connected_players
cloaking.get_player_by_name = minetest.get_player_by_name
cloaking.get_server_status = minetest.get_server_status
local cloaked_players = {}
@ -32,11 +33,8 @@ minetest.get_player_by_name = function(player)
end
end
-- Override chatcommands
minetest.register_chatcommand("status", {
description = "Print server status",
func = function(name, param)
local status = minetest.get_server_status()
minetest.get_server_status = function()
local status = cloaking.get_server_status()
status = status:sub(1, status:find('{', 1, true))
local players = {}
for _, player in ipairs(minetest.get_connected_players()) do
@ -44,9 +42,8 @@ minetest.register_chatcommand("status", {
end
players = table.concat(players, ', ')
status = status .. players .. '}'
return true, status
return status
end
})
-- The cloak and uncloak functions
cloaking.cloak = function(player)