core.register_chatcommand("status", {
description = "Show server status",
func = function(name, param)
- return true, core.get_server_status()
+ local status = core.get_server_status(name, false)
+ if status and status ~= "" then
+ return true, status
+ end
+ return false, "This command was disabled by a mod or game"
end,
})
core.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
player_list[player_name] = player
+ if not minetest.is_singleplayer() then
+ local status = core.get_server_status(player_name, true)
+ if status and status ~= "" then
+ core.chat_send_player(player_name, status)
+ end
+ end
core.send_join_message(player_name)
end)
# Setting it to -1 disables the feature.
item_entity_ttl (Item entity TTL) int 900
-# If enabled, show the server status message on player connection.
-show_statusline_on_connect (Status message on connection) bool true
-
# Enable players getting damage and dying.
enable_damage (Damage) bool false
Negative delay cancels the current active shutdown.
Zero delay triggers an immediate shutdown.
* `minetest.cancel_shutdown_requests()`: cancel current delayed shutdown
-* `minetest.get_server_status()`: returns server status string
+* `minetest.get_server_status(name, joined)`
+ * Returns the server status string when a player joins or when the command
+ `/status` is called. Returns `nil` or an empty string when the message is
+ disabled.
+ * `joined`: Boolean value, indicates whether the function was called when
+ a player joined.
+ * This function may be overwritten by mods to customize the status message.
* `minetest.get_server_uptime()`: returns the server uptime in seconds
* `minetest.remove_player(name)`: remove player from database (if they are not
connected).
# type: int
# item_entity_ttl = 900
-# If enabled, show the server status message on player connection.
-# type: bool
-# show_statusline_on_connect = true
-
# Enable players getting damage and dying.
# type: bool
# enable_damage = false
settings->setDefault("motd", "");
settings->setDefault("max_users", "15");
settings->setDefault("creative_mode", "false");
- settings->setDefault("show_statusline_on_connect", "true");
settings->setDefault("enable_damage", "true");
settings->setDefault("default_password", "");
settings->setDefault("default_privs", "interact, shout");
// Send Breath
SendPlayerBreath(playersao);
- // Note things in chat if not in simple singleplayer mode
- if (!m_simple_singleplayer_mode && g_settings->getBool("show_statusline_on_connect")) {
- // Send information about server to player in chat
- SendChatMessage(peer_id, ChatMessage(CHATMESSAGE_TYPE_SYSTEM, getStatusString()));
- }
Address addr = getPeerAddress(player->getPeerId());
std::string ip_str = addr.serializeString();
actionstream<<player->getName() <<" [" << ip_str << "] joins game. " << std::endl;