diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-28 02:17:32 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-28 02:17:32 +0200 |
commit | 2fb3eb3532c2c40e21def269cb9d5ca6eb11ef6d (patch) | |
tree | 1243615638ca28edc20ba62b8272d814f685aaa4 /src/Bindings/ManualBindings_RankManager.cpp | |
parent | 1.8: Fixed plugin messages. (diff) | |
download | cuberite-2fb3eb3532c2c40e21def269cb9d5ca6eb11ef6d.tar cuberite-2fb3eb3532c2c40e21def269cb9d5ca6eb11ef6d.tar.gz cuberite-2fb3eb3532c2c40e21def269cb9d5ca6eb11ef6d.tar.bz2 cuberite-2fb3eb3532c2c40e21def269cb9d5ca6eb11ef6d.tar.lz cuberite-2fb3eb3532c2c40e21def269cb9d5ca6eb11ef6d.tar.xz cuberite-2fb3eb3532c2c40e21def269cb9d5ca6eb11ef6d.tar.zst cuberite-2fb3eb3532c2c40e21def269cb9d5ca6eb11ef6d.zip |
Diffstat (limited to 'src/Bindings/ManualBindings_RankManager.cpp')
-rw-r--r-- | src/Bindings/ManualBindings_RankManager.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/Bindings/ManualBindings_RankManager.cpp b/src/Bindings/ManualBindings_RankManager.cpp index 2e93ad264..b43cd9ef2 100644 --- a/src/Bindings/ManualBindings_RankManager.cpp +++ b/src/Bindings/ManualBindings_RankManager.cpp @@ -183,6 +183,33 @@ static int tolua_cRankManager_GetAllPermissions(lua_State * L) +/** Binds cRankManager::GetAllPlayers */ +static int tolua_cRankManager_GetAllPlayers(lua_State * L) +{ + // Function signature: + // cRankManager:GetAllPlayers() -> arraytable of Player UUID's + + cLuaState S(L); + if ( + !S.CheckParamUserTable(1, "cRankManager") || + !S.CheckParamEnd(2) + ) + { + return 0; + } + + // Get the player uuid's: + AStringVector Players = cRoot::Get()->GetRankManager().GetAllPlayers(); + + // Push the results: + S.Push(Players); + return 1; +} + + + + + /** Binds cRankManager::GetAllRanks */ static int tolua_cRankManager_GetAllRanks(lua_State * L) { @@ -400,6 +427,38 @@ static int tolua_cRankManager_GetPlayerRankName(lua_State * L) +/** Binds cRankManager::GetPlayerName */ +static int tolua_cRankManager_GetPlayerName(lua_State * L) +{ + // Function signature: + // cRankManager:GetPlayerName(PlayerUUID) -> string + + cLuaState S(L); + if ( + !S.CheckParamUserTable(1, "cRankManager") || + !S.CheckParamString(2) || + !S.CheckParamEnd(3) + ) + { + return 0; + } + + // Get the params: + AString PlayerUUID; + S.GetStackValue(2, PlayerUUID); + + // Get the player name: + AString PlayerName = cRoot::Get()->GetRankManager().GetPlayerName(PlayerUUID); + + // Push the result: + S.Push(PlayerName); + return 1; +} + + + + + /** Binds cRankManager::GetRankGroups */ static int tolua_cRankManager_GetRankGroups(lua_State * L) { @@ -974,6 +1033,7 @@ void ManualBindings::BindRankManager(lua_State * tolua_S) tolua_function(tolua_S, "AddRank", tolua_cRankManager_AddRank); tolua_function(tolua_S, "GetAllGroups", tolua_cRankManager_GetAllGroups); tolua_function(tolua_S, "GetAllPermissions", tolua_cRankManager_GetAllPermissions); + tolua_function(tolua_S, "GetAllPlayers", tolua_cRankManager_GetAllPlayers); tolua_function(tolua_S, "GetAllRanks", tolua_cRankManager_GetAllRanks); tolua_function(tolua_S, "GetDefaultRank", tolua_cRankManager_GetDefaultRank); tolua_function(tolua_S, "GetGroupPermissions", tolua_cRankManager_GetGroupPermissions); @@ -981,6 +1041,7 @@ void ManualBindings::BindRankManager(lua_State * tolua_S) tolua_function(tolua_S, "GetPlayerMsgVisuals", tolua_cRankManager_GetPlayerMsgVisuals); tolua_function(tolua_S, "GetPlayerPermissions", tolua_cRankManager_GetPlayerPermissions); tolua_function(tolua_S, "GetPlayerRankName", tolua_cRankManager_GetPlayerRankName); + tolua_function(tolua_S, "GetPlayerName", tolua_cRankManager_GetPlayerName); tolua_function(tolua_S, "GetRankGroups", tolua_cRankManager_GetRankGroups); tolua_function(tolua_S, "GetRankPermissions", tolua_cRankManager_GetRankPermissions); tolua_function(tolua_S, "GetRankVisuals", tolua_cRankManager_GetRankVisuals); |