summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVincent <vincent.leung60@gmail.com>2014-12-08 09:16:09 +0100
committerVincent <vincent.leung60@gmail.com>2014-12-08 09:16:09 +0100
commited09e76023436c9414356921bc761618b3bb9341 (patch)
treeaa3cd9fcd3fd2f80b5eba4a96193e1cbd4f928ac /src
parentMoved the check into a new function and just calls that function and a blank FindAndDoWithPlayer added. (diff)
downloadcuberite-ed09e76023436c9414356921bc761618b3bb9341.tar
cuberite-ed09e76023436c9414356921bc761618b3bb9341.tar.gz
cuberite-ed09e76023436c9414356921bc761618b3bb9341.tar.bz2
cuberite-ed09e76023436c9414356921bc761618b3bb9341.tar.lz
cuberite-ed09e76023436c9414356921bc761618b3bb9341.tar.xz
cuberite-ed09e76023436c9414356921bc761618b3bb9341.tar.zst
cuberite-ed09e76023436c9414356921bc761618b3bb9341.zip
Diffstat (limited to 'src')
-rw-r--r--src/ClientHandle.cpp47
1 files changed, 23 insertions, 24 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 025588485..e60bb5373 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1790,30 +1790,33 @@ void cClientHandle::HandleKeepAlive(int a_KeepAliveID)
bool cClientHandle::CheckMultiLogin(void)
{
- std::list<AString> usernamesServer = cRoot::Get()->GetServer()->GetUsernames();
-
- for (auto item : usernamesServer)
+ if (!(cRoot::Get()->GetServer()->IsAllowMultiLogin()))
{
- if ((item).compare(a_Username) == 0)
+ std::list<AString> usernamesServer = cRoot::Get()->GetServer()->GetUsernames();
+
+ for (auto item : usernamesServer)
{
- Kick("A player of the username is already logged in");
- return false;
+ if ((item).compare(a_Username) == 0)
+ {
+ Kick("A player of the username is already logged in");
+ return false;
+ }
}
- }
- class cCallback :
- public cPlayerListCallback
- {
- virtual bool Item(cPlayer * a_Player) override
+ class cCallback :
+ public cPlayerListCallback
{
- return true;
- }
- } Callback;
+ virtual bool Item(cPlayer * a_Player) override
+ {
+ return true;
+ }
+ } Callback;
- if (cRoot::Get()->GetDefaultWorld()->DoWithPlayer(a_Username, Callback))
- {
- Kick("A player of the username is already logged in");
- return false;
+ if (cRoot::Get()->GetDefaultWorld()->DoWithPlayer(a_Username, Callback))
+ {
+ Kick("A player of the username is already logged in");
+ return false;
+ }
}
return true;
@@ -1833,13 +1836,9 @@ bool cClientHandle::HandleHandshake(const AString & a_Username)
return false;
}
}
+
+ return CheckMultiLogin();
- if (!(cRoot::Get()->GetServer()->IsAllowMultiLogin()))
- {
- return CheckMultiLogin();
- }
-
- return true;
}