diff options
author | Mattes D <github@xoft.cz> | 2015-04-25 22:32:13 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-04-25 22:32:13 +0200 |
commit | 0de768b56dd4fb8eb89c3ebe4051e2a0681ccd7b (patch) | |
tree | 3a675c7945da7c96f9e4629b2e795027a88e8bc8 /src/Bindings/ManualBindings.cpp | |
parent | Merge pull request #1896 from mc-server/FindAndDoWithPlayerRace (diff) | |
parent | cPlayer now checks restrictions. (diff) | |
download | cuberite-0de768b56dd4fb8eb89c3ebe4051e2a0681ccd7b.tar cuberite-0de768b56dd4fb8eb89c3ebe4051e2a0681ccd7b.tar.gz cuberite-0de768b56dd4fb8eb89c3ebe4051e2a0681ccd7b.tar.bz2 cuberite-0de768b56dd4fb8eb89c3ebe4051e2a0681ccd7b.tar.lz cuberite-0de768b56dd4fb8eb89c3ebe4051e2a0681ccd7b.tar.xz cuberite-0de768b56dd4fb8eb89c3ebe4051e2a0681ccd7b.tar.zst cuberite-0de768b56dd4fb8eb89c3ebe4051e2a0681ccd7b.zip |
Diffstat (limited to 'src/Bindings/ManualBindings.cpp')
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 253d57297..c4b12aa84 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -2125,6 +2125,37 @@ static int tolua_cPlayer_GetPermissions(lua_State * tolua_S) +static int tolua_cPlayer_GetRestrictions(lua_State * tolua_S) +{ + // Function signature: cPlayer:GetRestrictions() -> {restrictions-array} + + // Check the params: + cLuaState L(tolua_S); + if ( + !L.CheckParamUserType(1, "cPlayer") || + !L.CheckParamEnd (2) + ) + { + return 0; + } + + // Get the params: + cPlayer * self = (cPlayer *)tolua_tousertype(tolua_S, 1, nullptr); + if (self == nullptr) + { + LOGWARNING("%s: invalid self (%p)", __FUNCTION__, self); + return 0; + } + + // Push the permissions: + L.Push(self->GetRestrictions()); + return 1; +} + + + + + static int tolua_cPlayer_OpenWindow(lua_State * tolua_S) { // Function signature: cPlayer:OpenWindow(Window) @@ -3756,6 +3787,7 @@ void ManualBindings::Bind(lua_State * tolua_S) tolua_beginmodule(tolua_S, "cPlayer"); tolua_function(tolua_S, "GetPermissions", tolua_cPlayer_GetPermissions); + tolua_function(tolua_S, "GetRestrictions", tolua_cPlayer_GetRestrictions); tolua_function(tolua_S, "OpenWindow", tolua_cPlayer_OpenWindow); tolua_function(tolua_S, "PermissionMatches", tolua_cPlayer_PermissionMatches); tolua_endmodule(tolua_S); |