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:
parent
e90e1d7583
commit
3df9c5cdd7
11
core.lua
11
core.lua
|
@ -10,6 +10,7 @@ cloaking = {}
|
||||||
-- can use them.
|
-- can use them.
|
||||||
cloaking.get_connected_players = minetest.get_connected_players
|
cloaking.get_connected_players = minetest.get_connected_players
|
||||||
cloaking.get_player_by_name = minetest.get_player_by_name
|
cloaking.get_player_by_name = minetest.get_player_by_name
|
||||||
|
cloaking.get_server_status = minetest.get_server_status
|
||||||
|
|
||||||
local cloaked_players = {}
|
local cloaked_players = {}
|
||||||
|
|
||||||
|
@ -32,11 +33,8 @@ minetest.get_player_by_name = function(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Override chatcommands
|
minetest.get_server_status = function()
|
||||||
minetest.register_chatcommand("status", {
|
local status = cloaking.get_server_status()
|
||||||
description = "Print server status",
|
|
||||||
func = function(name, param)
|
|
||||||
local status = minetest.get_server_status()
|
|
||||||
status = status:sub(1, status:find('{', 1, true))
|
status = status:sub(1, status:find('{', 1, true))
|
||||||
local players = {}
|
local players = {}
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
|
@ -44,9 +42,8 @@ minetest.register_chatcommand("status", {
|
||||||
end
|
end
|
||||||
players = table.concat(players, ', ')
|
players = table.concat(players, ', ')
|
||||||
status = status .. players .. '}'
|
status = status .. players .. '}'
|
||||||
return true, status
|
return status
|
||||||
end
|
end
|
||||||
})
|
|
||||||
|
|
||||||
-- The cloak and uncloak functions
|
-- The cloak and uncloak functions
|
||||||
cloaking.cloak = function(player)
|
cloaking.cloak = function(player)
|
||||||
|
|
Loading…
Reference in New Issue