summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorVincent <vincent.leung60@gmail.com>2014-11-30 00:44:38 +0100
committerVincent <vincent.leung60@gmail.com>2014-11-30 00:44:38 +0100
commit72797b14fe5f83a7a27df17d5b733048d13d5d1b (patch)
tree10c4e59e5b4b6969515a26b91cc9d4b84f504206 /src/ClientHandle.cpp
parentfixed naming of strings and changed from i to I (diff)
downloadcuberite-72797b14fe5f83a7a27df17d5b733048d13d5d1b.tar
cuberite-72797b14fe5f83a7a27df17d5b733048d13d5d1b.tar.gz
cuberite-72797b14fe5f83a7a27df17d5b733048d13d5d1b.tar.bz2
cuberite-72797b14fe5f83a7a27df17d5b733048d13d5d1b.tar.lz
cuberite-72797b14fe5f83a7a27df17d5b733048d13d5d1b.tar.xz
cuberite-72797b14fe5f83a7a27df17d5b733048d13d5d1b.tar.zst
cuberite-72797b14fe5f83a7a27df17d5b733048d13d5d1b.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 3c06f3401..f63754aab 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -1790,6 +1790,7 @@ void cClientHandle::HandleKeepAlive(int a_KeepAliveID)
bool cClientHandle::HandleHandshake(const AString & a_Username)
{
+
if (!cRoot::Get()->GetPluginManager()->CallHookHandshake(*this, a_Username))
{
if (cRoot::Get()->GetServer()->GetNumPlayers() >= cRoot::Get()->GetServer()->GetMaxPlayers())
@@ -1801,11 +1802,6 @@ bool cClientHandle::HandleHandshake(const AString & a_Username)
if (!(cRoot::Get()->GetServer()->IsAllowMultiLogin()))
{
std::list<AString> usernamesServer = cRoot::Get()->GetServer()->GetUsernames();
- std::list<AString> usernamesWorld = cRoot::Get()->GetDefaultWorld()-> GetUsernames();
-
- usernamesServer.sort();
- usernamesWorld.sort();
- usernamesServer.merge(usernamesWorld);
for (std::list<AString>::iterator itr = usernamesServer.begin(); itr != usernamesServer.end(); ++itr)
{
@@ -1815,6 +1811,17 @@ bool cClientHandle::HandleHandshake(const AString & a_Username)
return false;
}
}
+ class cCallback : public cPlayerListCallback
+ {
+ virtual bool Item(cPlayer * a_Player) override
+ {
+ return false;
+ }
+ } Callback;
+ if (cRoot::Get()->GetDefaultWorld()->DoWithPlayer(a_Username, Callback))
+ {
+ Kick("User already logged in.");
+ }
}
return true;
}