From f94456dd3eccc65a6f304d4b804ca09a67fa6008 Mon Sep 17 00:00:00 2001 From: faketruth Date: Wed, 5 Sep 2012 20:30:27 +0000 Subject: Added the possibility of reserved player slots by implementing the HandleHandshake hook! More info: http://forum.mc-server.org/showthread.php?tid=555 git-svn-id: http://mc-server.googlecode.com/svn/trunk@836 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cClientHandle.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/cClientHandle.cpp') diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 06325785e..c62be45ac 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -918,6 +918,23 @@ void cClientHandle::HandleKeepAlive(int a_KeepAliveID) +bool cClientHandle::HandleHandshake(const AString & a_Username) +{ + if (!cRoot::Get()->GetPluginManager()->CallHookHandshake(this, a_Username)) + { + if (cRoot::Get()->GetDefaultWorld()->GetNumPlayers() >= cRoot::Get()->GetDefaultWorld()->GetMaxPlayers()) + { + Kick("The server is currently full :(-- Try again later"); + return false; + } + } + return true; +} + + + + + void cClientHandle::SendData(const char * a_Data, int a_Size) { { -- cgit v1.2.3