Changed HandleHandshake to return the result of CheckMultiLogin instead of just true since it already returns true if it finds and kicks the current player.
This commit is contained in:
parent
d8d3b9aec5
commit
ed09e76023
@ -1790,32 +1790,35 @@ 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)
|
||||
{
|
||||
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
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} Callback;
|
||||
|
||||
if (cRoot::Get()->GetDefaultWorld()->DoWithPlayer(a_Username, Callback))
|
||||
{
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user