Created
February 24, 2014 18:43
-
-
Save ShadowNinja/9194308 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/doc/lua_api.txt b/doc/lua_api.txt | |
index 5536d0b..105843b 100644 | |
--- a/doc/lua_api.txt | |
+++ b/doc/lua_api.txt | |
@@ -1305,8 +1305,7 @@ minetest.get_player_ip(name) -> IP address string | |
Chat: | |
minetest.chat_send_all(text) | |
-minetest.chat_send_player(name, text, prepend) | |
-^ prepend: optional, if it is set to false "Server -!- " will not be prepended to the message | |
+minetest.chat_send_player(name, text) | |
Environment access: | |
diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp | |
index dc05ccb..bbf5a70 100644 | |
--- a/src/script/lua_api/l_server.cpp | |
+++ b/src/script/lua_api/l_server.cpp | |
@@ -52,21 +52,17 @@ int ModApiServer::l_chat_send_all(lua_State *L) | |
return 0; | |
} | |
-// chat_send_player(name, text, prepend) | |
+// chat_send_player(name, text) | |
int ModApiServer::l_chat_send_player(lua_State *L) | |
{ | |
NO_MAP_LOCK_REQUIRED; | |
const char *name = luaL_checkstring(L, 1); | |
const char *text = luaL_checkstring(L, 2); | |
- bool prepend = true; | |
- | |
- if (lua_isboolean(L, 3)) | |
- prepend = lua_toboolean(L, 3); | |
// Get server from registry | |
Server *server = getServer(L); | |
// Send | |
- server->notifyPlayer(name, narrow_to_wide(text), prepend); | |
+ server->notifyPlayer(name, narrow_to_wide(text)); | |
return 0; | |
} | |
diff --git a/src/server.cpp b/src/server.cpp | |
index 42ac6ae..865c84d 100644 | |
--- a/src/server.cpp | |
+++ b/src/server.cpp | |
@@ -4385,7 +4385,7 @@ void Server::unsetIpBanned(const std::string &ip_or_name) | |
return m_banmanager->getBanDescription(ip_or_name); | |
} | |
-void Server::notifyPlayer(const char *name, const std::wstring msg, const bool prepend = true) | |
+void Server::notifyPlayer(const char *name, const std::wstring msg) | |
{ | |
Player *player = m_env->getPlayer(name); | |
if(!player) | |
@@ -4394,10 +4394,7 @@ void Server::notifyPlayer(const char *name, const std::wstring msg, const bool p | |
if (player->peer_id == PEER_ID_INEXISTENT) | |
return; | |
- if (prepend) | |
- SendChatMessage(player->peer_id, std::wstring(L"Server -!- ")+msg); | |
- else | |
- SendChatMessage(player->peer_id, msg); | |
+ SendChatMessage(player->peer_id, msg); | |
} | |
bool Server::showFormspec(const char *playername, const std::string &formspec, const std::string &formname) | |
diff --git a/src/server.h b/src/server.h | |
index 19bedf7..6ca8f8f 100644 | |
--- a/src/server.h | |
+++ b/src/server.h | |
@@ -229,7 +229,7 @@ class Server : public con::PeerHandler, public MapEventReceiver, | |
void unsetIpBanned(const std::string &ip_or_name); | |
std::string getBanDescription(const std::string &ip_or_name); | |
- void notifyPlayer(const char *name, const std::wstring msg, const bool prepend); | |
+ void notifyPlayer(const char *name, const std::wstring msg); | |
void notifyPlayers(const std::wstring msg); | |
void spawnParticle(const char *playername, | |
v3f pos, v3f velocity, v3f acceleration, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment