* Implement basic multiplayer functionality * Update README.md --------- Co-authored-by: Slenderman <ssimulpong@outlook.com>
This commit is contained in:
@@ -20,6 +20,10 @@
|
||||
|
||||
Random *PendingConnection::random = new Random();
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
bool g_bRejectDuplicateNames = true;
|
||||
#endif
|
||||
|
||||
PendingConnection::PendingConnection(MinecraftServer *server, Socket *socket, const wstring& id)
|
||||
{
|
||||
// 4J - added initialisers
|
||||
@@ -166,6 +170,30 @@ void PendingConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||
{
|
||||
disconnect(DisconnectPacket::eDisconnect_Banned);
|
||||
}
|
||||
#ifdef _WINDOWS64
|
||||
else if (g_bRejectDuplicateNames)
|
||||
{
|
||||
bool nameTaken = false;
|
||||
vector<shared_ptr<ServerPlayer> >& pl = server->getPlayers()->players;
|
||||
for (unsigned int i = 0; i < pl.size(); i++)
|
||||
{
|
||||
if (pl[i] != NULL && pl[i]->name == name)
|
||||
{
|
||||
nameTaken = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nameTaken)
|
||||
{
|
||||
app.DebugPrintf("Rejecting duplicate name: %ls\n", name.c_str());
|
||||
disconnect(DisconnectPacket::eDisconnect_Banned);
|
||||
}
|
||||
else
|
||||
{
|
||||
handleAcceptedLogin(packet);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
handleAcceptedLogin(packet);
|
||||
|
||||
Reference in New Issue
Block a user