summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorVincent <vincent.leung60@gmail.com>2014-12-08 23:33:59 +0100
committerVincent <vincent.leung60@gmail.com>2014-12-08 23:33:59 +0100
commit12c012fa01e719c7c103e36ae0407294a0d11bfb (patch)
tree0a7e64a44a7662c5a2eb3f17990c8bc918a1e8d4 /src/ClientHandle.cpp
parentcreated callback in Root and changed CheckMultiLogin() to use the DoWithPlayer function at Root instead of World. (diff)
downloadcuberite-12c012fa01e719c7c103e36ae0407294a0d11bfb.tar
cuberite-12c012fa01e719c7c103e36ae0407294a0d11bfb.tar.gz
cuberite-12c012fa01e719c7c103e36ae0407294a0d11bfb.tar.bz2
cuberite-12c012fa01e719c7c103e36ae0407294a0d11bfb.tar.lz
cuberite-12c012fa01e719c7c103e36ae0407294a0d11bfb.tar.xz
cuberite-12c012fa01e719c7c103e36ae0407294a0d11bfb.tar.zst
cuberite-12c012fa01e719c7c103e36ae0407294a0d11bfb.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 6fe7cbd4a..3bc17d1a9 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1790,31 +1790,34 @@ void cClientHandle::HandleKeepAlive(int a_KeepAliveID)
bool cClientHandle::CheckMultiLogin(const AString & a_Username)
{
- if (!(cRoot::Get()->GetServer()->IsAllowMultiLogin()))
+ // If the multilogin is allowed, skip this check entirely:
+ if ((cRoot::Get()->GetServer()->IsAllowMultiLogin()))
{
- if (cRoot::Get()->GetServer()->IsPlayerInQueue(a_Username))
- {
- Kick("A player of the username is already logged in");
- return false;
- }
-
- class cCallback :
- public cPlayerListCallback
- {
- virtual bool Item(cPlayer * a_Player) override
- {
- return true;
- }
- } Callback;
+ return true;
+ }
- if (cRoot::Get()->DoWithPlayer(a_Username, Callback))
- {
+ // Check if the player is waiting to be transferred to the World.
+ if (cRoot::Get()->GetServer()->IsPlayerInQueue(a_Username))
+ {
Kick("A player of the username is already logged in");
return false;
+ }
+
+ class cCallback :
+ public cPlayerListCallback
+ {
+ virtual bool Item(cPlayer * a_Player) override
+ {
+ return true;
}
+ } Callback;
+
+ // Check if the player is in any World.
+ if (cRoot::Get()->DoWithPlayer(a_Username, Callback))
+ {
+ Kick("A player of the username is already logged in");
+ return false;
}
-
- return true;
}