diff options
Diffstat (limited to 'Minecraft.Client/PendingConnection.cpp')
| -rw-r--r-- | Minecraft.Client/PendingConnection.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Minecraft.Client/PendingConnection.cpp b/Minecraft.Client/PendingConnection.cpp index e9b37fc6..8034dff2 100644 --- a/Minecraft.Client/PendingConnection.cpp +++ b/Minecraft.Client/PendingConnection.cpp @@ -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); |
