summaryrefslogtreecommitdiffstats
path: root/src/Bindings/ManualBindings.cpp
diff options
context:
space:
mode:
authorsatoshinm <snmatsutake@yahoo.co.jp>2017-08-27 23:10:20 +0200
committerMattes D <github@xoft.cz>2017-08-27 23:10:20 +0200
commit6bc503151746ea05842009983c7de932fa80cd03 (patch)
treea7ce87c25b2acb9c5f76cd1a25180b77ebf16f26 /src/Bindings/ManualBindings.cpp
parentImplement anvil chunk sparsing (diff)
downloadcuberite-6bc503151746ea05842009983c7de932fa80cd03.tar
cuberite-6bc503151746ea05842009983c7de932fa80cd03.tar.gz
cuberite-6bc503151746ea05842009983c7de932fa80cd03.tar.bz2
cuberite-6bc503151746ea05842009983c7de932fa80cd03.tar.lz
cuberite-6bc503151746ea05842009983c7de932fa80cd03.tar.xz
cuberite-6bc503151746ea05842009983c7de932fa80cd03.tar.zst
cuberite-6bc503151746ea05842009983c7de932fa80cd03.zip
Diffstat (limited to '')
-rw-r--r--src/Bindings/ManualBindings.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index c87e9ed20..ee9cb61e9 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -33,6 +33,7 @@
#include "../HTTP/UrlParser.h"
#include "../Item.h"
#include "../LineBlockTracer.h"
+#include "../Server.h"
#include "../Root.h"
#include "../StringCompression.h"
#include "../WebAdmin.h"
@@ -2365,6 +2366,27 @@ static int tolua_cClientHandle_SendPluginMessage(lua_State * L)
+static int tolua_cClientHandle_GetForgeMods(lua_State * L)
+{
+ cLuaState S(L);
+ if (
+ !S.CheckParamSelf("cClientHandle") ||
+ !S.CheckParamEnd(2)
+ )
+ {
+ return 0;
+ }
+ cClientHandle * Client;
+ S.GetStackValue(1, Client);
+
+ S.Push(Client->GetForgeMods());
+ return 1;
+}
+
+
+
+
+
static int tolua_cClientHandle_GetUUID(lua_State * tolua_S)
{
// Check the params:
@@ -3399,6 +3421,37 @@ static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
+static int tolua_cServer_RegisterForgeMod(lua_State * a_LuaState)
+{
+ cLuaState L(a_LuaState);
+ if (
+ !L.CheckParamSelf("cServer") ||
+ !L.CheckParamString(2, 3) ||
+ !L.CheckParamNumber(4) ||
+ !L.CheckParamEnd(5)
+ )
+ {
+ return 0;
+ }
+
+ cServer * Server;
+ AString Name, Version;
+ UInt32 Protocol;
+ L.GetStackValues(1, Server, Name, Version, Protocol);
+
+ if (!Server->RegisterForgeMod(Name, Version, Protocol))
+ {
+ tolua_error(L, "duplicate Forge mod name registration", nullptr);
+ return 0;
+ }
+
+ return 0;
+}
+
+
+
+
+
static int tolua_cScoreboard_GetTeamNames(lua_State * L)
{
cLuaState S(L);
@@ -4007,6 +4060,8 @@ void cManualBindings::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, "GetForgeMods", tolua_cClientHandle_GetForgeMods);
tolua_function(tolua_S, "SendPluginMessage", tolua_cClientHandle_SendPluginMessage);
tolua_function(tolua_S, "GetUUID", tolua_cClientHandle_GetUUID);
tolua_function(tolua_S, "GenerateOfflineUUID", tolua_cClientHandle_GenerateOfflineUUID);
@@ -4164,6 +4219,10 @@ void cManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "GetTeamNames", tolua_cScoreboard_GetTeamNames);
tolua_endmodule(tolua_S);
+ tolua_beginmodule(tolua_S, "cServer");
+ tolua_function(tolua_S, "RegisterForgeMod", tolua_cServer_RegisterForgeMod);
+ tolua_endmodule(tolua_S);
+
tolua_beginmodule(tolua_S, "cStringCompression");
tolua_function(tolua_S, "CompressStringZLIB", tolua_CompressStringZLIB);
tolua_function(tolua_S, "UncompressStringZLIB", tolua_UncompressStringZLIB);