summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorVincent <vincent.leung60@gmail.com>2014-11-29 09:36:15 +0100
committerVincent <vincent.leung60@gmail.com>2014-11-29 09:36:15 +0100
commit61e761fdc2bfa5c77002d68bb24e0470def37b48 (patch)
treeefb8e5a7b544f9402d186201c1f9150511bcc1a9 /src/ClientHandle.cpp
parentMerge pull request #1619 from mc-server/WarningFixes (diff)
downloadcuberite-61e761fdc2bfa5c77002d68bb24e0470def37b48.tar
cuberite-61e761fdc2bfa5c77002d68bb24e0470def37b48.tar.gz
cuberite-61e761fdc2bfa5c77002d68bb24e0470def37b48.tar.bz2
cuberite-61e761fdc2bfa5c77002d68bb24e0470def37b48.tar.lz
cuberite-61e761fdc2bfa5c77002d68bb24e0470def37b48.tar.xz
cuberite-61e761fdc2bfa5c77002d68bb24e0470def37b48.tar.zst
cuberite-61e761fdc2bfa5c77002d68bb24e0470def37b48.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index a6cbad32a..ae794d7cb 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1798,6 +1798,24 @@ bool cClientHandle::HandleHandshake(const AString & a_Username)
return false;
}
}
+ if (!(cRoot::Get()->GetServer()->isAllowMultiLogin()))
+ {
+ std::list<std::string> usernamesServer = cRoot::Get()->GetServer()->GetUsernames();
+ std::list<std::string> usernamesWorld = cRoot::Get()->GetDefaultWorld()-> GetUsernames();
+
+ usernamesServer.sort();
+ usernamesWorld.sort();
+ usernamesServer.merge(usernamesWorld);
+
+ for (std::list<std::string>::iterator itr = usernamesServer.begin(); itr != usernamesServer.end(); ++itr)
+ {
+ if ((*itr).compare(a_Username) == 0)
+ {
+ Kick("User already logged in.");
+ return false;
+ }
+ }
+ }
return true;
}