summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-02-28 15:31:20 +0100
committermadmaxoft <github@xoft.cz>2014-02-28 15:31:20 +0100
commit35def963f06dd46823300aebf09af0009189328b (patch)
treefc0d265c181ccd5025e790b23db0f760eaa85232 /src/Entities
parentMerge pull request #709 from Howaner/GlobalFixes (diff)
downloadcuberite-35def963f06dd46823300aebf09af0009189328b.tar
cuberite-35def963f06dd46823300aebf09af0009189328b.tar.gz
cuberite-35def963f06dd46823300aebf09af0009189328b.tar.bz2
cuberite-35def963f06dd46823300aebf09af0009189328b.tar.lz
cuberite-35def963f06dd46823300aebf09af0009189328b.tar.xz
cuberite-35def963f06dd46823300aebf09af0009189328b.tar.zst
cuberite-35def963f06dd46823300aebf09af0009189328b.zip
Diffstat (limited to 'src/Entities')
-rw-r--r--src/Entities/Player.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index e0f0b9222..f419ee09c 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1529,14 +1529,14 @@ void cPlayer::LoadPermissionsFromDisk()
std::string Groups = IniFile.GetValue(m_PlayerName, "Groups", "");
if (!Groups.empty())
{
- AStringVector Split = StringSplit( Groups, "," );
- for( unsigned int i = 0; i < Split.size(); i++ )
+ AStringVector Split = StringSplitAndTrim(Groups, ",");
+ for (AStringVector::const_iterator itr = Split.begin(), end = Split.end(); itr != end; ++itr)
{
- if (!cRoot::Get()->GetGroupManager()->ExistsGroup(Split[i]))
+ if (!cRoot::Get()->GetGroupManager()->ExistsGroup(*itr))
{
- LOGWARNING("The group %s for player %s was not found!", Split[i].c_str(), m_PlayerName.c_str());
+ LOGWARNING("The group %s for player %s was not found!", itr->c_str(), m_PlayerName.c_str());
}
- AddToGroup(Split[i].c_str());
+ AddToGroup(*itr);
}
}
else
@@ -1544,11 +1544,15 @@ void cPlayer::LoadPermissionsFromDisk()
AddToGroup("Default");
}
- m_Color = IniFile.GetValue(m_PlayerName, "Color", "-")[0];
+ AString Color = IniFile.GetValue(m_PlayerName, "Color", "-");
+ if (!Color.empty())
+ {
+ m_Color = Color[0];
+ }
}
else
{
- cRoot::Get()->GetGroupManager()->CheckUsers();
+ cGroupManager::GenerateDefaultUsersIni(IniFile);
AddToGroup("Default");
}
ResolvePermissions();