From 1b5eaa92b562c09ed7cea4de7186ff6541e65e5f Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 18 Aug 2012 10:38:15 +0000 Subject: Chat packet handled in the new way; fixed missing packet sending for inventory slot. Again, API change! cPlugin:OnChat() has had its parameters swapped, to match all the other callbacks - Player first, Message second git-svn-id: http://mc-server.googlecode.com/svn/trunk@751 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cPlugin_NewLua.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'source/cPlugin_NewLua.cpp') diff --git a/source/cPlugin_NewLua.cpp b/source/cPlugin_NewLua.cpp index 51d2dc9df..55010c3b2 100644 --- a/source/cPlugin_NewLua.cpp +++ b/source/cPlugin_NewLua.cpp @@ -260,20 +260,23 @@ bool cPlugin_NewLua::OnBlockDig(cPlayer * a_Player, int a_BlockX, int a_BlockY, -bool cPlugin_NewLua::OnChat( const char* a_Chat, cPlayer* a_Player ) +bool cPlugin_NewLua::OnChat(cPlayer * a_Player, const AString & a_Message) { - cCSLock Lock( m_CriticalSection ); - if( !PushFunction("OnChat") ) + cCSLock Lock(m_CriticalSection); + if (!PushFunction("OnChat")) + { return false; + } - tolua_pushstring( m_LuaState, a_Chat ); tolua_pushusertype(m_LuaState, a_Player, "cPlayer"); + tolua_pushstring (m_LuaState, a_Message.c_str()); - if( !CallFunction(2, 1, "OnChat") ) + if (!CallFunction(2, 1, "OnChat")) + { return false; + } - bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0); - return bRetVal; + return (tolua_toboolean( m_LuaState, -1, 0) > 0); } -- cgit v1.2.3