summaryrefslogtreecommitdiffstats
path: root/source/cPlayer.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-01-30 17:47:26 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-01-30 17:47:26 +0100
commit9dfa0f1f15c413540e932a04e94419a8a3b37dcf (patch)
treec111ee0ad961aa365b2c681e486dae4ce7e09421 /source/cPlayer.cpp
parentMore cFile cleanup; removed old format writing for block entities (diff)
downloadcuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar.gz
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar.bz2
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar.lz
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar.xz
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.tar.zst
cuberite-9dfa0f1f15c413540e932a04e94419a8a3b37dcf.zip
Diffstat (limited to 'source/cPlayer.cpp')
-rw-r--r--source/cPlayer.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp
index c7ef8e56d..c3ba32840 100644
--- a/source/cPlayer.cpp
+++ b/source/cPlayer.cpp
@@ -732,8 +732,11 @@ bool cPlayer::MoveToWorld( const char* a_WorldName )
return false;
}
-bool cPlayer::LoadFromDisk() // TODO - This should also get/set/whatever the correct world for this player
+void cPlayer::LoadPermissionsFromDisk()
{
+ m_pState->Groups.clear();
+ m_pState->Permissions.clear();
+
cIniFile IniFile("users.ini");
if( IniFile.ReadFile() )
{
@@ -759,6 +762,11 @@ bool cPlayer::LoadFromDisk() // TODO - This should also get/set/whatever the cor
AddToGroup("Default");
}
ResolvePermissions();
+}
+
+bool cPlayer::LoadFromDisk() // TODO - This should also get/set/whatever the correct world for this player
+{
+ LoadPermissionsFromDisk();
// Log player permissions, cause it's what the cool kids do
LOGINFO("Player %s has permissions:", m_pState->PlayerName.c_str() );
@@ -891,6 +899,19 @@ const cPlayer::GroupList & cPlayer::GetGroups()
return m_pState->Groups;
}
+cPlayer::StringList cPlayer::GetResolvedPermissions()
+{
+ StringList Permissions;
+
+ const PermissionMap& ResolvedPermissions = m_pState->ResolvedPermissions;
+ for( PermissionMap::const_iterator itr = ResolvedPermissions.begin(); itr != ResolvedPermissions.end(); ++itr )
+ {
+ if( itr->second ) Permissions.push_back( itr->first );
+ }
+
+ return Permissions;
+}
+
const char* cPlayer::GetLoadedWorldName()
{
return m_pState->LoadedWorldName.c_str();