mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-12-06 17:10:41 +01:00
Social System
+Discord account connection +Friends List +UPnP Connection +Cosmetics (Iggy menus need to be fixed up a little)
This commit is contained in:
1 parent
3ebbf6f243
commit
55c9b5c827
61 files changed
+7725
-1564
No files matched your search
@@ -21,6 +21,8 @@
|
||||
#include "../Minecraft.Server/ServerLogManager.h"
|
||||
#include "../Minecraft.Server/Access/Access.h"
|
||||
#include "../Minecraft.Server/Security/SecurityConfig.h"
|
||||
#include "../Minecraft.Server/Security/OnlineVerifier.h"
|
||||
#include "../Minecraft.Server/ServerLogger.h"
|
||||
#include "../Minecraft.World/Socket.h"
|
||||
#include "Windows64/Network/NetworkPlayerWindows.h"
|
||||
#include <FourKitBridge.h>
|
||||
@@ -67,6 +69,8 @@ PendingConnection::PendingConnection(MinecraftServer *server, Socket *socket, co
|
||||
name = L"";
|
||||
acceptedLogin = nullptr;
|
||||
loginKey = L"";
|
||||
m_verifiedXuid = INVALID_XUID;
|
||||
m_onlineVerified = false;
|
||||
|
||||
this->server = server;
|
||||
connection = new Connection(socket, id, this);
|
||||
@@ -85,6 +89,9 @@ void PendingConnection::tick()
|
||||
this->handleAcceptedLogin(acceptedLogin);
|
||||
acceptedLogin = nullptr;
|
||||
}
|
||||
tickOnlineVerify();
|
||||
if (done)
|
||||
return;
|
||||
if (_tick++ == MAX_TICKS_BEFORE_LOGIN)
|
||||
{
|
||||
disconnect(DisconnectPacket::eDisconnect_LoginTooLong);
|
||||
@@ -171,11 +178,52 @@ void PendingConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
|
||||
if (ServerRuntime::Security::GetSettings().onlineMode)
|
||||
{
|
||||
if (m_verifyTicket != nullptr || m_onlineVerified)
|
||||
return;
|
||||
m_verifyName = packet->loginKey;
|
||||
m_verifyTicket = ServerRuntime::Online::BeginVerify(packet->m_joinToken);
|
||||
tickOnlineVerify();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// printf("Server: handlePreLogin\n");
|
||||
name = packet->loginKey; // 4J Stu - Change from the login packet as we know better on client end during the pre-login packet
|
||||
sendPreLoginResponse();
|
||||
}
|
||||
|
||||
void PendingConnection::tickOnlineVerify()
|
||||
{
|
||||
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
|
||||
if (m_verifyTicket == nullptr || done)
|
||||
return;
|
||||
int state = m_verifyTicket->state.load();
|
||||
if (state == ServerRuntime::Online::eVerify_Pending)
|
||||
return;
|
||||
shared_ptr<ServerRuntime::Online::VerifyTicket> ticket = m_verifyTicket;
|
||||
m_verifyTicket = nullptr;
|
||||
if (state != ServerRuntime::Online::eVerify_Valid)
|
||||
{
|
||||
ServerRuntime::LogWarnf("online", "Rejected %ls: %s", m_verifyName.c_str(), ticket->error.c_str());
|
||||
disconnect(DisconnectPacket::eDisconnect_Kicked);
|
||||
return;
|
||||
}
|
||||
if (_wcsicmp(ticket->username.c_str(), m_verifyName.c_str()) != 0)
|
||||
{
|
||||
ServerRuntime::LogWarnf("online", "Rejected %ls: account name is %ls", m_verifyName.c_str(), ticket->username.c_str());
|
||||
disconnect(DisconnectPacket::eDisconnect_Kicked);
|
||||
return;
|
||||
}
|
||||
m_onlineVerified = true;
|
||||
m_verifiedXuid = static_cast<PlayerUID>(ticket->onlineId);
|
||||
name = ticket->username;
|
||||
sendPreLoginResponse();
|
||||
#endif
|
||||
}
|
||||
|
||||
void PendingConnection::sendPreLoginResponse()
|
||||
{
|
||||
// 4J Stu - Calculate the players with UGC privileges set
|
||||
@@ -257,6 +305,21 @@ void PendingConnection::handleLogin(shared_ptr<LoginPacket> packet)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(_WINDOWS64) && defined(MINECRAFT_SERVER_BUILD)
|
||||
if (ServerRuntime::Security::GetSettings().onlineMode)
|
||||
{
|
||||
if (!m_onlineVerified || packet->m_onlineXuid != m_verifiedXuid || _wcsicmp(packet->userName.c_str(), name.c_str()) != 0)
|
||||
{
|
||||
ServerRuntime::LogWarnf("online", "Rejected login for %ls: identity does not match verified account", packet->userName.c_str());
|
||||
disconnect(DisconnectPacket::eDisconnect_Kicked);
|
||||
return;
|
||||
}
|
||||
packet->userName = name;
|
||||
packet->m_offlineXuid = m_verifiedXuid;
|
||||
packet->m_onlineXuid = m_verifiedXuid;
|
||||
}
|
||||
#endif
|
||||
|
||||
//if (true)// 4J removed !server->onlineMode)
|
||||
bool sentDisconnect = false;
|
||||
|
||||
|
||||
Reference in new issue
Block a user