diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua index 7a1b4b6b..bb5b905d 100644 --- a/builtin/client/chatcommands.lua +++ b/builtin/client/chatcommands.lua @@ -34,3 +34,18 @@ core.register_on_sending_chat_messages(function(message) return true end) + +core.register_chatcommand("list_players", { + description = "List online players", + func = function(param) + local players = table.concat(core.get_player_names(), ", ") + core.display_chat_message("Online players: " .. players) + end +}) + +core.register_chatcommand("disconnect", { + description = "Exit to main menu", + func = function(param) + core.disconnect() + end, +}) diff --git a/clientmods/preview/init.lua b/clientmods/preview/init.lua index 5c0628bf..df07f8c3 100644 --- a/clientmods/preview/init.lua +++ b/clientmods/preview/init.lua @@ -126,16 +126,3 @@ core.register_on_punchnode(function(pos, node) return false end) --- This is an example function to ensure it's working properly, should be removed before merge -core.register_chatcommand("list_players", { - func = function(param) - core.display_chat_message(dump(core.get_player_names())) - end -}) - -core.register_chatcommand("disconnect", { - description = "Exit to main menu", - func = function(param) - core.disconnect() - end, -})