|
|
|
@ -33,6 +33,7 @@ using namespace std;
|
|
|
|
|
Networking *Networking::sThis = 0;
|
|
|
|
|
|
|
|
|
|
static int currentMpNum = 0;
|
|
|
|
|
static bool pluginEnforcementState = true;
|
|
|
|
|
|
|
|
|
|
Networking::Networking(RakNet::RakPeerInterface *peer) : mclient(nullptr)
|
|
|
|
|
{
|
|
|
|
@ -232,14 +233,16 @@ void Networking::update(RakNet::Packet *packet)
|
|
|
|
|
packetPreInit.SetSendStream(&bs);
|
|
|
|
|
|
|
|
|
|
// If the loop above was broken, then the client's plugins do not match the server's
|
|
|
|
|
if (plugin != plugins.end())
|
|
|
|
|
if (pluginEnforcementState && plugin != plugins.end())
|
|
|
|
|
{
|
|
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s was not allowed to connect due to incompatible plugins", packet->systemAddress.ToString());
|
|
|
|
|
packetPreInit.setChecksums(&samples);
|
|
|
|
|
packetPreInit.Send(packet->systemAddress);
|
|
|
|
|
peer->CloseConnection(packet->systemAddress, true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "%s was allowed to connect", packet->systemAddress.ToString());
|
|
|
|
|
PacketPreInit::PluginContainer tmp;
|
|
|
|
|
packetPreInit.setChecksums(&tmp);
|
|
|
|
|
packetPreInit.Send(packet->systemAddress);
|
|
|
|
@ -373,6 +376,16 @@ int Networking::incrementMpNum()
|
|
|
|
|
return currentMpNum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Networking::getPluginEnforcementState()
|
|
|
|
|
{
|
|
|
|
|
return pluginEnforcementState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Networking::setPluginEnforcementState(bool state)
|
|
|
|
|
{
|
|
|
|
|
pluginEnforcementState = state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Networking &Networking::get()
|
|
|
|
|
{
|
|
|
|
|
return *sThis;
|
|
|
|
|