#include "ban.h"
#include "environment.h"
#include "map.h"
-#include "jmutexautolock.h"
+#include "jthread/jmutexautolock.h"
#include "main.h"
#include "constants.h"
#include "voxel.h"
#include "config.h"
+#include "version.h"
#include "filesys.h"
#include "mapblock.h"
#include "serverobject.h"
m_objectdata_timer = 0.0;
m_emergethread_trigger_timer = 0.0;
m_savemap_timer = 0.0;
- m_clients_number = 0;
m_env_mutex.Init();
m_con_mutex.Init();
counter = 0.0;
JMutexAutoLock lock2(m_con_mutex);
- m_clients_number = 0;
+ m_clients_names.clear();
if(m_clients.size() != 0)
infostream<<"Players:"<<std::endl;
for(std::map<u16, RemoteClient*>::iterator
continue;
infostream<<"* "<<player->getName()<<"\t";
client->PrintInfo(infostream);
- ++m_clients_number;
+ m_clients_names.push_back(player->getName());
}
}
}
float &counter = m_masterserver_timer;
if(!isSingleplayer() && (!counter || counter >= 300.0) && g_settings->getBool("server_announce") == true)
{
- ServerList::sendAnnounce(!counter ? "start" : "update", m_clients_number, m_uptime.get(), m_gamespec.id, m_mods);
+ ServerList::sendAnnounce(!counter ? "start" : "update", m_clients_names, m_uptime.get(), m_env->getGameTime(), m_gamespec.id, m_mods);
counter = 0.01;
}
counter += dtime;
DenyAccess(peer_id, std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
- + narrow_to_wide(VERSION_STRING) + L"."
+ + narrow_to_wide(minetest_version_simple) + L"."
);
return;
}
DenyAccess(peer_id, std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
- + narrow_to_wide(VERSION_STRING) + L",\n"
+ + narrow_to_wide(minetest_version_simple) + L",\n"
+ L"server's PROTOCOL_VERSION is "
+ narrow_to_wide(itos(SERVER_PROTOCOL_VERSION_MIN))
+ L"..."
DenyAccess(peer_id, std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
- + narrow_to_wide(VERSION_STRING) + L",\n"
+ + narrow_to_wide(minetest_version_simple) + L",\n"
+ L"server's PROTOCOL_VERSION (strict) is "
+ narrow_to_wide(itos(LATEST_PROTOCOL_VERSION))
+ L", client's PROTOCOL_VERSION is "
client->denied = true;
// If there are way too many clients, get rid of denied new ones immediately
- if(m_clients.size() > 2 * g_settings->getU16("max_users")){
+ if((int)m_clients.size() > 2 * g_settings->getU16("max_users")){
verbosestream<<"Server: DenyAccess: Too many clients; getting rid of "
<<"peer_id="<<peer_id<<" immediately"<<std::endl;
// Delete peer to stop sending it data
std::wostringstream os(std::ios_base::binary);
os<<L"# Server: ";
// Version
- os<<L"version="<<narrow_to_wide(VERSION_STRING);
+ os<<L"version="<<narrow_to_wide(minetest_version_simple);
// Uptime
os<<L", uptime="<<m_uptime.get();
// Max lag estimate
return true;
}
+void Server::hudSetHotbarImage(Player *player, std::string name) {
+ if (!player)
+ return;
+
+ SendHUDSetParam(player->peer_id, HUD_PARAM_HOTBAR_IMAGE, name);
+}
+
+void Server::hudSetHotbarSelectedImage(Player *player, std::string name) {
+ if (!player)
+ return;
+
+ SendHUDSetParam(player->peer_id, HUD_PARAM_HOTBAR_SELECTED_IMAGE, name);
+}
+
void Server::notifyPlayers(const std::wstring msg)
{
BroadcastChatMessage(msg);