g_settings->updateConfigFile(m_configpath.c_str());
}
+void Server::notifyPlayer(const char *name, const std::wstring msg)
+{
+ Player *player = m_env.getPlayer(name);
+ if(!player)
+ return;
+ SendChatMessage(player->peer_id, std::wstring(L"Server: -!- ")+msg);
+}
+
v3f findSpawnPos(ServerMap &map)
{
//return v3f(50,50,50)*BS;
{
return m_con.GetPeerNoEx(peer_id);
}
+
+ // Envlock and conlock should be locked when calling this
+ void notifyPlayer(const char *name, const std::wstring msg);
private:
u64 privs = ctx->server->getPlayerAuthPrivs(playername);
if(ctx->parms[0] == L"grant"){
+ privs |= newprivs;
actionstream<<ctx->player->getName()<<" grants "
<<wide_to_narrow(ctx->parms[2])<<" to "
<<playername<<std::endl;
- privs |= newprivs;
+
+ std::wstring msg;
+ msg += narrow_to_wide(ctx->player->getName());
+ msg += L" granted you the privilege \"";
+ msg += ctx->parms[2];
+ msg += L"\"";
+ ctx->server->notifyPlayer(playername.c_str(), msg);
} else {
+ privs &= ~newprivs;
actionstream<<ctx->player->getName()<<" revokes "
<<wide_to_narrow(ctx->parms[2])<<" from "
<<playername<<std::endl;
- privs &= ~newprivs;
+
+ std::wstring msg;
+ msg += narrow_to_wide(ctx->player->getName());
+ msg += L" revoked from you the privilege \"";
+ msg += ctx->parms[2];
+ msg += L"\"";
+ ctx->server->notifyPlayer(playername.c_str(), msg);
}
ctx->server->setPlayerAuthPrivs(playername, privs);