mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-11 19:53:52 +00:00
* Implement basic multiplayer functionality * Update README.md --------- Co-authored-by: Slenderman <ssimulpong@outlook.com>
This commit is contained in:
parent
15129932da
commit
8b28c20d7a
20 changed files with 1705 additions and 266 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue