summaryrefslogtreecommitdiffstats
path: root/src/GroupManager.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-02-28 15:29:50 +0100
committerHowaner <franzi.moos@googlemail.com>2014-02-28 15:29:50 +0100
commit27b98dec2b62a1fe88130c6a5c2c840dde293a5e (patch)
tree6c92a2e4f8614e74362d2695961a9ffba8d08965 /src/GroupManager.cpp
parentFix Double Slabs, fix Slab Meta and add more things to burnable (diff)
parentMerge pull request #709 from Howaner/GlobalFixes (diff)
downloadcuberite-27b98dec2b62a1fe88130c6a5c2c840dde293a5e.tar
cuberite-27b98dec2b62a1fe88130c6a5c2c840dde293a5e.tar.gz
cuberite-27b98dec2b62a1fe88130c6a5c2c840dde293a5e.tar.bz2
cuberite-27b98dec2b62a1fe88130c6a5c2c840dde293a5e.tar.lz
cuberite-27b98dec2b62a1fe88130c6a5c2c840dde293a5e.tar.xz
cuberite-27b98dec2b62a1fe88130c6a5c2c840dde293a5e.tar.zst
cuberite-27b98dec2b62a1fe88130c6a5c2c840dde293a5e.zip
Diffstat (limited to 'src/GroupManager.cpp')
-rw-r--r--src/GroupManager.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/GroupManager.cpp b/src/GroupManager.cpp
index 723b86f94..5125e7586 100644
--- a/src/GroupManager.cpp
+++ b/src/GroupManager.cpp
@@ -46,6 +46,7 @@ cGroupManager::cGroupManager()
LOGD("-- Loading Groups --");
LoadGroups();
+ CheckUsers();
LOGD("-- Groups Successfully Loaded --");
}
@@ -54,6 +55,42 @@ cGroupManager::cGroupManager()
+void cGroupManager::CheckUsers(void)
+{
+ cIniFile IniFile;
+ if (!IniFile.ReadFile("users.ini"))
+ {
+ LOGWARN("Regenerating users.ini, all users will be reset");
+ IniFile.AddHeaderComment(" This is the file in which the group the player belongs to is stored");
+ IniFile.AddHeaderComment(" The format is: [PlayerName] | Groups=GroupName");
+
+ IniFile.WriteFile("users.ini");
+ return;
+ }
+
+ unsigned int NumKeys = IniFile.GetNumKeys();
+ for (size_t i = 0; i < NumKeys; i++)
+ {
+ AString Player = IniFile.GetKeyName( i );
+ AString Groups = IniFile.GetValue(Player, "Groups", "");
+ if (!Groups.empty())
+ {
+ AStringVector Split = StringSplit( Groups, "," );
+ for( unsigned int i = 0; i < Split.size(); i++ )
+ {
+ if (!ExistsGroup(Split[i]))
+ {
+ LOGWARNING("The group %s for player %s was not found!", Split[i].c_str(), Player.c_str());
+ }
+ }
+ }
+ }
+}
+
+
+
+
+
void cGroupManager::LoadGroups()
{
cIniFile IniFile;
@@ -137,6 +174,16 @@ void cGroupManager::LoadGroups()
+bool cGroupManager::ExistsGroup( const AString & a_Name )
+{
+ GroupMap::iterator itr = m_pState->Groups.find( a_Name );
+ return ( itr != m_pState->Groups.end() );
+}
+
+
+
+
+
cGroup* cGroupManager::GetGroup( const AString & a_Name )
{
GroupMap::iterator itr = m_pState->Groups.find( a_Name );