summaryrefslogtreecommitdiffstats
path: root/src/Bindings/ManualBindings.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-09 14:25:37 +0100
committermadmaxoft <github@xoft.cz>2014-01-09 14:25:37 +0100
commitbb96737f455bbfb52864703e74397c61475936b4 (patch)
tree3c583e07c03b988e4234e9045c6ca244be09a963 /src/Bindings/ManualBindings.cpp
parentFixed wrong packet number for PluginMessage packet. (diff)
downloadcuberite-bb96737f455bbfb52864703e74397c61475936b4.tar
cuberite-bb96737f455bbfb52864703e74397c61475936b4.tar.gz
cuberite-bb96737f455bbfb52864703e74397c61475936b4.tar.bz2
cuberite-bb96737f455bbfb52864703e74397c61475936b4.tar.lz
cuberite-bb96737f455bbfb52864703e74397c61475936b4.tar.xz
cuberite-bb96737f455bbfb52864703e74397c61475936b4.tar.zst
cuberite-bb96737f455bbfb52864703e74397c61475936b4.zip
Diffstat (limited to 'src/Bindings/ManualBindings.cpp')
-rw-r--r--src/Bindings/ManualBindings.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 6221727c4..344d5d2e0 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -1904,6 +1904,35 @@ static int tolua_cWebPlugin_GetTabNames(lua_State * tolua_S)
+static int tolua_cClientHandle_SendPluginMessage(lua_State * L)
+{
+ cLuaState S(L);
+ if (
+ !S.CheckParamUserType(1, "cClientHandle") ||
+ !S.CheckParamString(2, 3) ||
+ !S.CheckParamEnd(4)
+ )
+ {
+ return 0;
+ }
+ cClientHandle * Client = (cClientHandle *)tolua_tousertype(L, 1, NULL);
+ if (Client == NULL)
+ {
+ LOGWARNING("ClientHandle is nil in cClientHandle:SendPluginMessage()");
+ S.LogStackTrace();
+ return 0;
+ }
+ AString Channel, Message;
+ Channel.assign(lua_tostring(L, 2), lua_strlen(L, 2));
+ Message.assign(lua_tostring(L, 3), lua_strlen(L, 3));
+ Client->SendPluginMessage(Channel, Message);
+ return 0;
+}
+
+
+
+
+
static int Lua_ItemGrid_GetSlotCoords(lua_State * L)
{
tolua_Error tolua_err;
@@ -2292,6 +2321,7 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_beginmodule(tolua_S, "cClientHandle");
tolua_constant(tolua_S, "MAX_VIEW_DISTANCE", cClientHandle::MAX_VIEW_DISTANCE);
tolua_constant(tolua_S, "MIN_VIEW_DISTANCE", cClientHandle::MIN_VIEW_DISTANCE);
+ tolua_function(tolua_S, "SendPluginMessage", tolua_cClientHandle_SendPluginMessage);
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cItemGrid");