diff options
author | Mattes D <github@xoft.cz> | 2016-10-06 21:24:31 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-10-06 21:24:31 +0200 |
commit | e0f158bba9aafbaeb3d9d91271a021635ecff6d9 (patch) | |
tree | c33ce6c1269d9cf038b0a3632d923302a3b27d03 /src | |
parent | Merge pull request #3391 from cuberite/ApiCheckTypes (diff) | |
download | cuberite-e0f158bba9aafbaeb3d9d91271a021635ecff6d9.tar cuberite-e0f158bba9aafbaeb3d9d91271a021635ecff6d9.tar.gz cuberite-e0f158bba9aafbaeb3d9d91271a021635ecff6d9.tar.bz2 cuberite-e0f158bba9aafbaeb3d9d91271a021635ecff6d9.tar.lz cuberite-e0f158bba9aafbaeb3d9d91271a021635ecff6d9.tar.xz cuberite-e0f158bba9aafbaeb3d9d91271a021635ecff6d9.tar.zst cuberite-e0f158bba9aafbaeb3d9d91271a021635ecff6d9.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Bindings/ManualBindings_RankManager.cpp | 87 |
1 files changed, 40 insertions, 47 deletions
diff --git a/src/Bindings/ManualBindings_RankManager.cpp b/src/Bindings/ManualBindings_RankManager.cpp index 7871c26ef..84ca67c4e 100644 --- a/src/Bindings/ManualBindings_RankManager.cpp +++ b/src/Bindings/ManualBindings_RankManager.cpp @@ -100,58 +100,58 @@ static int tolua_cRankManager_AddPermissionToGroup(lua_State * L) -/** Binds cRankManager::AddRestrictionToGroup */ -static int tolua_cRankManager_AddRestrictionToGroup(lua_State * L) +/** Binds cRankManager::AddRank */ +static int tolua_cRankManager_AddRank(lua_State * L) { // Function signature: - // cRankManager:AddRestrictionToGroup(Permission, GroupName) -> bool + // cRankManager:AddRank(RankName) cLuaState S(L); if ( !S.CheckParamUserTable(1, "cRankManager") || - !S.CheckParamString(2, 3) || - !S.CheckParamEnd(4) + !S.CheckParamString(2, 5) || + !S.CheckParamEnd(6) ) { return 0; } // Read the params: - AString GroupName, Permission; - S.GetStackValues(2, Permission, GroupName); + AString RankName, MsgPrefix, MsgSuffix, MsgNameColorCode; + S.GetStackValues(2, RankName, MsgPrefix, MsgSuffix, MsgNameColorCode); - // Add the group to the rank: - S.Push(cRoot::Get()->GetRankManager()->AddRestrictionToGroup(Permission, GroupName)); - return 1; + // Add the rank: + cRoot::Get()->GetRankManager()->AddRank(RankName, MsgPrefix, MsgSuffix, MsgNameColorCode); + return 0; } -/** Binds cRankManager::AddRank */ -static int tolua_cRankManager_AddRank(lua_State * L) +/** Binds cRankManager::AddRestrictionToGroup */ +static int tolua_cRankManager_AddRestrictionToGroup(lua_State * L) { // Function signature: - // cRankManager:AddRank(RankName) + // cRankManager:AddRestrictionToGroup(Restriction, GroupName) -> bool cLuaState S(L); if ( !S.CheckParamUserTable(1, "cRankManager") || - !S.CheckParamString(2, 5) || - !S.CheckParamEnd(6) + !S.CheckParamString(2, 3) || + !S.CheckParamEnd(4) ) { return 0; } // Read the params: - AString RankName, MsgPrefix, MsgSuffix, MsgNameColorCode; - S.GetStackValues(2, RankName, MsgPrefix, MsgSuffix, MsgNameColorCode); + AString GroupName, Restriction; + S.GetStackValues(2, Restriction, GroupName); - // Add the rank: - cRoot::Get()->GetRankManager()->AddRank(RankName, MsgPrefix, MsgSuffix, MsgNameColorCode); - return 0; + // Add the group to the rank: + S.Push(cRoot::Get()->GetRankManager()->AddRestrictionToGroup(Restriction, GroupName)); + return 1; } @@ -233,11 +233,11 @@ static int tolua_cRankManager_GetAllPermissions(lua_State * L) -/** Binds cRankManager::GetAllPermissions */ -static int tolua_cRankManager_GetAllRestrictions(lua_State * L) +/** Binds cRankManager::GetAllPermissionsRestrictions */ +static int tolua_cRankManager_GetAllPermissionsRestrictions(lua_State * L) { // Function signature: - // cRankManager:GetAllRestrictions() -> arraytable of Permissions + // cRankManager:GetAllPermissionsRestrictions() -> arraytable of Permissions and Restrictions together cLuaState S(L); if ( @@ -248,11 +248,9 @@ static int tolua_cRankManager_GetAllRestrictions(lua_State * L) return 0; } - // Get the permissions: - AStringVector Permissions = cRoot::Get()->GetRankManager()->GetAllRestrictions(); - // Push the results: - S.Push(Permissions); + S.Push(cRoot::Get()->GetRankManager()->GetAllPermissionsRestrictions()); + return 1; } @@ -260,11 +258,11 @@ static int tolua_cRankManager_GetAllRestrictions(lua_State * L) -/** Binds cRankManager::GetAllPermissionsRestrictions */ -static int tolua_cRankManager_GetAllPermissionsRestrictions(lua_State * L) +/** Binds cRankManager::GetAllPlayerUUIDs */ +static int tolua_cRankManager_GetAllPlayerUUIDs(lua_State * L) { // Function signature: - // cRankManager:GetAllPermissionsRestrictions() -> arraytable of Permissions and Restrictions + // cRankManager:GetAllPlayerUUIDs() -> arraytable of Player UUID's cLuaState S(L); if ( @@ -275,11 +273,11 @@ static int tolua_cRankManager_GetAllPermissionsRestrictions(lua_State * L) return 0; } - // Get the permissions: - AStringVector Permissions = cRoot::Get()->GetRankManager()->GetAllPermissionsRestrictions(); + // Get the player uuid's: + AStringVector Players = cRoot::Get()->GetRankManager()->GetAllPlayerUUIDs(); // Push the results: - S.Push(Permissions); + S.Push(Players); return 1; } @@ -287,11 +285,11 @@ static int tolua_cRankManager_GetAllPermissionsRestrictions(lua_State * L) -/** Binds cRankManager::GetAllPlayerUUIDs */ -static int tolua_cRankManager_GetAllPlayerUUIDs(lua_State * L) +/** Binds cRankManager::GetAllRanks */ +static int tolua_cRankManager_GetAllRanks(lua_State * L) { // Function signature: - // cRankManager:GetAllPlayerUUIDs() -> arraytable of Player UUID's + // cRankManager:GetAllRanks() -> arraytable of RankNames cLuaState S(L); if ( @@ -302,11 +300,8 @@ static int tolua_cRankManager_GetAllPlayerUUIDs(lua_State * L) return 0; } - // Get the player uuid's: - AStringVector Players = cRoot::Get()->GetRankManager()->GetAllPlayerUUIDs(); - // Push the results: - S.Push(Players); + S.Push(cRoot::Get()->GetRankManager()->GetAllRanks()); return 1; } @@ -314,11 +309,11 @@ static int tolua_cRankManager_GetAllPlayerUUIDs(lua_State * L) -/** Binds cRankManager::GetAllRanks */ -static int tolua_cRankManager_GetAllRanks(lua_State * L) +/** Binds cRankManager::GetAllRestrictions */ +static int tolua_cRankManager_GetAllRestrictions(lua_State * L) { // Function signature: - // cRankManager:GetAllRanks() -> arraytable of RankNames + // cRankManager:GetAllRestrictions() -> arraytable of Restrictions cLuaState S(L); if ( @@ -329,11 +324,9 @@ static int tolua_cRankManager_GetAllRanks(lua_State * L) return 0; } - // Get the ranks: - AStringVector Ranks = cRoot::Get()->GetRankManager()->GetAllRanks(); - // Push the results: - S.Push(Ranks); + S.Push(cRoot::Get()->GetRankManager()->GetAllRestrictions()); + return 1; } |