Revert LCEMP dedicated server changes

Apparently smartcmd used their own dedicated server and not LCEMP's, starting from scratch!
This commit is contained in:
pieeebot committed 2026-08-15 03:28:51 +03:00
1 parent 9e3077c3bc
commit a1541c590d
29 files changed
+58 -283

No files matched your search

-25
View File
@@ -1,7 +1,5 @@

#include "stdafx.h"
#include <time.h>
#include "..\..\Minecraft.World\net.minecraft.world.entity.item.h"
#include "..\..\Minecraft.World\net.minecraft.world.entity.player.h"
#include "..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
@@ -238,26 +236,6 @@ void CMinecraftApp::DebugPrintf(const char *szFormat, ...)
vsnprintf(buf, sizeof(buf), szFormat, ap);
va_end(ap);
OutputDebugStringA(buf);
#ifdef _DEDICATED_SERVER
bool hasContent = false;
for (const char *p = buf; *p; p++) {
if (*p != ' ' && *p != '\t' && *p != '\n' && *p != '\r' && *p != '=') {
hasContent = true;
break;
}
}
if (hasContent)
{
size_t len = strlen(buf);
while (len > 0 && (buf[len-1] == '\n' || buf[len-1] == '\r'))
buf[--len] = '\0';
time_t now = time(NULL);
struct tm t;
localtime_s(&t, &now);
printf("[%02d:%02d:%02d] [Server thread/INFO]: %s\n", t.tm_hour, t.tm_min, t.tm_sec, buf);
}
#endif
#endif
}
@@ -320,9 +298,6 @@ LPCWSTR CMinecraftApp::GetString(int iID)
{
//return L"Değişiklikler ve Yenilikler";
//return L"ÕÕÕÕÖÖÖÖ";
#ifdef _DEDICATED_SERVER
if (!app.m_stringTable) return L"";
#endif
return app.m_stringTable->getString(iID);
}
@@ -873,14 +873,12 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
void CGameNetworkManager::UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving)
{
#ifndef _DEDICATED_SERVER
Minecraft *pMinecraft = Minecraft::GetInstance();
TexturePack *tPack = pMinecraft->skins->getSelected();
s_pPlatformNetworkManager->SetSessionTexturePackParentId( tPack->getDLCParentPackId() );
s_pPlatformNetworkManager->SetSessionSubTexturePackId( tPack->getDLCSubPackId() );
s_pPlatformNetworkManager->UpdateAndSetGameSessionData( pNetworkPlayerLeaving );
#endif
}
void CGameNetworkManager::SendInviteGUI(int quadrant)
@@ -1542,7 +1540,6 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
// Add this user to the game server if the game is started already
if( g_NetworkManager.IsHost() && g_NetworkManager.IsInGameplay() )
{
app.DebugPrintf("Adding incoming socket for smallId=%d\n", pNetworkPlayer->GetSmallId());
Socket::addIncomingSocket(socket);
}
@@ -61,9 +61,6 @@ std::vector<BYTE> NetworkSocketLayer::s_pendingJoinSmallIds;
CRITICAL_SECTION NetworkSocketLayer::s_freeSmallIdLock;
std::vector<BYTE> NetworkSocketLayer::s_freeSmallIds;
CRITICAL_SECTION NetworkSocketLayer::s_earlyDataLock;
std::vector<BYTE> NetworkSocketLayer::s_earlyDataBuffers[NETWORK_LAN_MAX_CLIENTS + 1];
// only goes true on a successful Initialize(), and a failed one gets retried
static bool s_locksCreated = false;
#if defined _WINDOWS64
@@ -91,7 +88,6 @@ bool NetworkSocketLayer::Initialize()
InitializeCriticalSection(&s_disconnectLock);
InitializeCriticalSection(&s_pendingJoinLock);
InitializeCriticalSection(&s_freeSmallIdLock);
InitializeCriticalSection(&s_earlyDataLock);
for (int i = 0; i < NETWORK_LAN_MAX_CLIENTS + 1; i++)
{
@@ -143,9 +139,7 @@ bool NetworkSocketLayer::Initialize()
s_initialized = true;
#ifndef _DEDICATED_SERVER
StartDiscovery();
#endif
return true;
}
@@ -807,9 +801,6 @@ bool NetworkSocketLayer::JoinGame(const char *ip, int port)
}
s_localSmallId = assignedSmallId;
DWORD noTimeout = 0;
setsockopt(s_hostConnectionSocket, SOL_SOCKET, SO_RCVTIMEO, (const char *)&noTimeout, sizeof(noTimeout));
app.DebugPrintf("LAN: Connected to %s:%d, assigned smallId=%d\n", ip, port, s_localSmallId);
s_active = true;
@@ -935,13 +926,9 @@ void NetworkSocketLayer::HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, un
if (pPlayerFrom == NULL || pPlayerTo == NULL)
{
if (s_isHost && fromSmallId > 0 && fromSmallId < NETWORK_LAN_MAX_CLIENTS + 1)
{
EnterCriticalSection(&s_earlyDataLock);
s_earlyDataBuffers[fromSmallId].insert(
s_earlyDataBuffers[fromSmallId].end(), data, data + dataSize);
LeaveCriticalSection(&s_earlyDataLock);
}
// dropping here is silent and looks identical to the peer never sending
app.DebugPrintf("LAN: DROPPED %u bytes - from smallId=%d(%s) to smallId=%d(%s)\n",
dataSize, fromSmallId, pPlayerFrom ? "ok" : "NULL", toSmallId, pPlayerTo ? "ok" : "NULL");
return;
}
@@ -950,13 +937,6 @@ void NetworkSocketLayer::HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, un
::Socket *pSocket = pPlayerFrom->GetSocket();
if (pSocket != NULL)
pSocket->pushDataToQueue(data, dataSize, false);
else
{
EnterCriticalSection(&s_earlyDataLock);
s_earlyDataBuffers[fromSmallId].insert(
s_earlyDataBuffers[fromSmallId].end(), data, data + dataSize);
LeaveCriticalSection(&s_earlyDataLock);
}
}
else
{
@@ -966,26 +946,6 @@ void NetworkSocketLayer::HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, un
}
}
void NetworkSocketLayer::FlushPendingData()
{
EnterCriticalSection(&s_earlyDataLock);
for (int i = 1; i < NETWORK_LAN_MAX_CLIENTS + 1; i++)
{
if (s_earlyDataBuffers[i].empty()) continue;
INetworkPlayer *pPlayer = g_NetworkManager.GetPlayerBySmallId((BYTE)i);
if (pPlayer == NULL) continue;
::Socket *pSocket = pPlayer->GetSocket();
if (pSocket == NULL) continue;
pSocket->pushDataToQueue(s_earlyDataBuffers[i].data(),
(DWORD)s_earlyDataBuffers[i].size(), false);
s_earlyDataBuffers[i].clear();
}
LeaveCriticalSection(&s_earlyDataLock);
}
int NetworkSocketLayer::AcceptThreadProc(LPVOID param)
{
while (s_active)
@@ -1212,11 +1172,6 @@ void NetworkSocketLayer::CloseConnectionBySmallId(BYTE smallId)
app.DebugPrintf("Win64 LAN: Force-closed TCP connection for smallId=%d\n", smallId);
}
LeaveCriticalSection(&s_connectionsLock);
EnterCriticalSection(&s_earlyDataLock);
if (smallId < NETWORK_LAN_MAX_CLIENTS + 1)
s_earlyDataBuffers[smallId].clear();
LeaveCriticalSection(&s_earlyDataLock);
}
int NetworkSocketLayer::ClientRecvThreadProc(LPVOID param)
@@ -1288,11 +1243,6 @@ bool NetworkSocketLayer::StartAdvertising(int gamePort, const wchar_t *hostName,
s_advertiseData.texturePackParentId = texPackId;
s_advertiseData.subTexturePackId = subTexId;
s_advertiseData.isJoinable = 0;
#ifdef _DEDICATED_SERVER
s_advertiseData.isDedicatedServer = 1;
#else
s_advertiseData.isDedicatedServer = 0;
#endif
s_hostGamePort = gamePort;
LeaveCriticalSection(&s_advertiseLock);
@@ -1673,7 +1623,6 @@ int NetworkSocketLayer::DiscoveryThreadProc(LPVOID param)
s_discoveredSessions[i].texturePackParentId = broadcast->texturePackParentId;
s_discoveredSessions[i].subTexturePackId = broadcast->subTexturePackId;
s_discoveredSessions[i].isJoinable = (broadcast->isJoinable != 0);
s_discoveredSessions[i].isDedicatedServer = (broadcast->isDedicatedServer != 0);
s_discoveredSessions[i].lastSeenTick = now;
memcpy(s_discoveredSessions[i].playerNames, broadcast->playerNames, sizeof(broadcast->playerNames));
found = true;
@@ -1707,7 +1656,6 @@ int NetworkSocketLayer::DiscoveryThreadProc(LPVOID param)
session.texturePackParentId = broadcast->texturePackParentId;
session.subTexturePackId = broadcast->subTexturePackId;
session.isJoinable = (broadcast->isJoinable != 0);
session.isDedicatedServer = (broadcast->isDedicatedServer != 0);
session.lastSeenTick = now;
memcpy(session.playerNames, broadcast->playerNames, sizeof(broadcast->playerNames));
s_discoveredSessions.push_back(session);
@@ -116,7 +116,6 @@ struct LANBroadcast
DWORD texturePackParentId;
BYTE subTexturePackId;
BYTE isJoinable;
BYTE isDedicatedServer;
char playerNames[NETWORK_LAN_BROADCAST_PLAYERS][NETWORK_LAN_PLAYER_NAME_SIZE];
};
#pragma pack(pop)
@@ -133,7 +132,6 @@ struct LANSession
unsigned int texturePackParentId;
unsigned char subTexturePackId;
bool isJoinable;
bool isDedicatedServer;
DWORD lastSeenTick;
char playerNames[NETWORK_LAN_BROADCAST_PLAYERS][NETWORK_LAN_PLAYER_NAME_SIZE];
};
@@ -169,7 +167,6 @@ public:
static SOCKET GetSocketForSmallId(BYTE smallId);
static void HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, unsigned char *data, unsigned int dataSize);
static void FlushPendingData();
static bool PopDisconnectedSmallId(BYTE *outSmallId);
static void PushFreeSmallId(BYTE smallId);
@@ -238,9 +235,6 @@ private:
static CRITICAL_SECTION s_freeSmallIdLock;
static std::vector<BYTE> s_freeSmallIds;
static CRITICAL_SECTION s_earlyDataLock;
static std::vector<BYTE> s_earlyDataBuffers[NETWORK_LAN_MAX_CLIENTS + 1];
};
extern bool g_MultiplayerHost;
@@ -354,10 +354,6 @@ bool CPlatformNetworkManagerStub::LeaveGame(bool bMigrateHost)
if( m_bLeavingGame ) return true;
m_bLeavingGame = true;
extern bool g_connectedToDedicatedServer;
g_connectedToDedicatedServer = false;
NetworkSocketLayer::StopAdvertising();
// If we are the host wait for the game server to end
@@ -407,10 +403,10 @@ void CPlatformNetworkManagerStub::HostGame(int localUsersMask, bool bOnlineGame,
IQNet::m_player[0].m_smallId = 0;
IQNet::m_player[0].m_isRemote = false;
IQNet::m_player[0].m_isHostPlayer = true;
IQNet::s_playerCount = 1;
#if defined _WINDOWS64 && !defined WITH_SERVER_CODE
#ifdef _WINDOWS64
extern wchar_t g_Win64UsernameW[17];
wcscpy_s(IQNet::m_player[0].m_gamertag, 32, g_Win64UsernameW);
IQNet::s_playerCount = 1;
#endif
if (getNetworkPlayer(&IQNet::m_player[0]) == NULL)
@@ -458,9 +454,6 @@ int CPlatformNetworkManagerStub::JoinGame(FriendSessionInfo *searchResult, int l
wcsncpy(IQNet::m_player[0].m_gamertag, searchResult->data.hostName, 31);
IQNet::m_player[0].m_gamertag[31] = L'\0';
extern bool g_connectedToDedicatedServer;
g_connectedToDedicatedServer = searchResult->data.isDedicatedServer;
NetworkSocketLayer::StopDiscovery();
if (!NetworkSocketLayer::JoinGame(hostIP, hostPort))
@@ -808,7 +801,6 @@ void CPlatformNetworkManagerStub::SearchForGames()
info->data.subTexturePackId = lanSessions[i].subTexturePackId;
info->data.isReadyToJoin = lanSessions[i].isJoinable;
info->data.isJoinable = lanSessions[i].isJoinable;
info->data.isDedicatedServer = lanSessions[i].isDedicatedServer;
strncpy(info->data.hostIP, lanSessions[i].hostIP, sizeof(info->data.hostIP) - 1);
info->data.hostIP[sizeof(info->data.hostIP) - 1] = '\0';
info->data.hostPort = lanSessions[i].hostPort;
@@ -79,7 +79,6 @@ typedef struct _GameSessionData
bool isReadyToJoin; // 1 byte
bool isJoinable; // 1 byte
bool isDedicatedServer; // 1 byte
char hostIP[64]; // 64 bytes
int hostPort; // 4 bytes
@@ -98,7 +97,6 @@ typedef struct _GameSessionData
subTexturePackId = 0;
isReadyToJoin = false;
isJoinable = true;
isDedicatedServer = false;
memset(hostIP, 0, sizeof(hostIP));
hostPort = 0;
memset(hostName, 0, sizeof(hostName));
+1 -9
View File
@@ -547,8 +547,6 @@ bool IQNet::s_isHosting = true;
QNET_STATE _iQNetStubState = QNET_STATE_IDLE;
bool g_connectedToDedicatedServer = false;
void Win64_SetupRemoteQNetPlayer(IQNetPlayer *player, BYTE smallId, bool isHost, bool isLocal)
{
player->m_smallId = smallId;
@@ -599,13 +597,7 @@ IQNetPlayer *IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex)
}
static bool Win64_IsActivePlayer(IQNetPlayer *p, DWORD index)
{
if (index == 0)
{
extern bool g_connectedToDedicatedServer;
if (g_connectedToDedicatedServer && !IQNet::s_isHosting)
return false;
return true;
}
if (index == 0) return true;
if (p->GetCustomDataValue() != 0) return true;
return (p->m_isRemote && p->m_gamertag[0] != 0);
}
-8
View File
@@ -4963,18 +4963,11 @@ void Minecraft::handleClientTextureReceived(const wstring &textureName)
unsigned int Minecraft::getCurrentTexturePackId()
{
#ifdef _DEDICATED_SERVER
return 0;
#else
return skins->getSelected()->getId();
#endif
}
ColourTable *Minecraft::getColourTable()
{
#ifdef _DEDICATED_SERVER
return NULL;
#else
TexturePack *selected = skins->getSelected();
ColourTable *colours = selected->getColourTable();
@@ -4985,7 +4978,6 @@ ColourTable *Minecraft::getColourTable()
}
return colours;
#endif
}
#if defined __ORBIS__
+17 -77
View File
@@ -35,11 +35,7 @@
#include "..\Minecraft.World\net.minecraft.world.entity.h"
#include "ProgressRenderer.h"
#include "ServerPlayer.h"
#include "PlayerConnection.h"
#include "GameRenderer.h"
#if defined(_WINDOWS64) || defined(DISABLE_PSN) || defined(_DISABLE_XBLIVE)
#include "Common\Network\NetworkSocketLayer.h"
#endif
#include "..\Minecraft.World\ThreadName.h"
#include "..\Minecraft.World\IntCache.h"
#include "..\Minecraft.World\CompressedTileStorage.h"
@@ -51,11 +47,6 @@
#endif
#include "PS3\PS3Extras\ShutdownManager.h"
#include "ServerCommandDispatcher.h"
#ifdef _DEDICATED_SERVER
#include "..\Minecraft.Server\Commands\ServerCommands.h"
#endif
#include "..\Minecraft.World\BiomeSource.h"
#include "PlayerChunkMap.h"
#include "Common\Telemetry\TelemetryManager.h"
@@ -159,11 +150,13 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
#endif
settings = new Settings(new File(L"server.properties"));
app.DebugPrintf("host-friends-only is %s",(app.GetGameHostOption(eGameHostOption_FriendsOfFriends)>0)?"on":"off");
app.DebugPrintf("game-type is %s",(app.GetGameHostOption(eGameHostOption_GameType)==0)?"Survival Mode":"Creative Mode");
app.DebugPrintf("pvp is %s",(app.GetGameHostOption(eGameHostOption_PvP)>0)?"on":"off");
app.DebugPrintf("fire-spreads is %s",(app.GetGameHostOption(eGameHostOption_FireSpreads)>0)?"on":"off");
app.DebugPrintf("tnt-explodes is %s",(app.GetGameHostOption(eGameHostOption_TNT)>0)?"on":"off");
app.DebugPrintf("\n*** SERVER SETTINGS ***\n");
app.DebugPrintf("ServerSettings: host-friends-only is %s\n",(app.GetGameHostOption(eGameHostOption_FriendsOfFriends)>0)?"on":"off");
app.DebugPrintf("ServerSettings: game-type is %s\n",(app.GetGameHostOption(eGameHostOption_GameType)==0)?"Survival Mode":"Creative Mode");
app.DebugPrintf("ServerSettings: pvp is %s\n",(app.GetGameHostOption(eGameHostOption_PvP)>0)?"on":"off");
app.DebugPrintf("ServerSettings: fire spreads is %s\n",(app.GetGameHostOption(eGameHostOption_FireSpreads)>0)?"on":"off");
app.DebugPrintf("ServerSettings: tnt explodes is %s\n",(app.GetGameHostOption(eGameHostOption_TNT)>0)?"on":"off");
app.DebugPrintf("\n");
// TODO 4J Stu - Init a load of settings based on data passed as params
//settings->setBooleanAndSave( L"host-friends-only", (app.GetGameHostOption(eGameHostOption_FriendsOfFriends)>0) );
@@ -290,14 +283,6 @@ bool MinecraftServer::initServer(__int64 seed, NetworkGameInitData *initData, DW
}
g_NetworkManager.ServerReady(); // 4J added
#ifdef _DEDICATED_SERVER
{
extern QNET_STATE _iQNetStubState;
_iQNetStubState = QNET_STATE_GAME_PLAY;
}
#endif
return m_bLoaded;
}
@@ -420,7 +405,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
int gameTypeId = settings->getInt(L"gamemode", app.GetGameHostOption(eGameHostOption_GameType));//LevelSettings::GAMETYPE_SURVIVAL);
GameType *gameType = LevelSettings::validateGameType(gameTypeId);
app.DebugPrintf("Default game type: %d" , gameTypeId);
app.DebugPrintf("Default game type: %d\n" , gameTypeId);
LevelSettings *levelSettings = new LevelSettings(levelSeed, gameType, app.GetGameHostOption(eGameHostOption_Structures)>0?true:false, isHardcore(), true, pLevelType, initData->xzSize, initData->hellScale);
if( app.GetGameHostOption(eGameHostOption_BonusChest ) ) levelSettings->enableStartingBonusItems();
@@ -512,7 +497,7 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
Minecraft *pMinecraft = Minecraft::GetInstance();
// m_lastSentDifficulty = pMinecraft->options->difficulty;
levels[i]->difficulty = app.GetGameHostOption(eGameHostOption_Difficulty); //pMinecraft->options->difficulty;
app.DebugPrintf("MinecraftServer::loadLevel - Difficulty = %d",levels[i]->difficulty);
app.DebugPrintf("MinecraftServer::loadLevel - Difficulty = %d\n",levels[i]->difficulty);
#if DEBUG_SERVER_DONT_SPAWN_MOBS
levels[i]->setSpawnSettings(false, false);
@@ -586,13 +571,6 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
csf->closeHandle(fe);
}
#ifdef _DEDICATED_SERVER
{
__int64 doneTime = System::currentTimeMillis();
app.DebugPrintf("Done! For help, type \"help\" or \"?\"");
}
#endif
__int64 lastTime = System::currentTimeMillis();
#ifdef _LARGE_WORLDS
if(app.GetGameNewWorldSize() > levels[0]->getLevelData()->getXZSizeOld())
@@ -715,6 +693,9 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
// stronghold position?
if(levels[0]->dimension->id==0)
{
app.DebugPrintf("===================================\n");
if(!levels[0]->getLevelData()->getHasStronghold())
{
int x,z;
@@ -724,19 +705,20 @@ bool MinecraftServer::loadLevel(LevelStorageSource *storageSource, const wstring
levels[0]->getLevelData()->setZStronghold(z);
levels[0]->getLevelData()->setHasStronghold();
app.DebugPrintf("FOUND stronghold in terrain features list\n");
app.DebugPrintf("=== FOUND stronghold in terrain features list\n");
}
else
{
// can't find the stronghold position in the terrain feature list. Do we have to run a post-process?
app.DebugPrintf("Can't find stronghold in terrain features list\n");
app.DebugPrintf("=== Can't find stronghold in terrain features list\n");
}
}
else
{
app.DebugPrintf("Leveldata has stronghold position\n");
app.DebugPrintf("=== Leveldata has stronghold position\n");
}
app.DebugPrintf("===================================\n");
}
// printf("Post processing complete at %dms\n",System::currentTimeMillis() - startTime);
@@ -1006,16 +988,12 @@ void MinecraftServer::stopServer(bool didInit)
// 4J-PB - If the primary player has signed out, then don't attempt to save anything
// also need to check for a profile switch here - primary player signs out, and another player signs in before dismissing the dash
#ifdef _DEDICATED_SERVER
{
{
#elif defined(_DURANGO)
#ifdef _DURANGO
// On Durango check if the primary user is signed in OR mid-sign-out
if(ProfileManager.GetUser(0, true) != nullptr)
#else
if((m_bPrimaryPlayerSignedOut==false) && ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()))
#endif
#ifndef _DEDICATED_SERVER
{
#if defined(_XBOX_ONE) || defined(__ORBIS__)
// Always save on exit! Except if saves are disabled.
@@ -1024,7 +1002,6 @@ void MinecraftServer::stopServer(bool didInit)
// if trial version or saving is disabled, then don't save anything. Also don't save anything if we didn't actually get through the server initialisation.
if(m_saveOnExit && ProfileManager.IsFullVersion() && (!StorageManager.GetSaveDisabled()) && didInit)
{
#endif
if (players != NULL)
{
players->saveAll(Minecraft::GetInstance()->progressRenderer, true);
@@ -1634,33 +1611,6 @@ void MinecraftServer::tick()
tickCount++;
#ifdef _DEDICATED_SERVER
if (tickCount % 6000 == 0 && !s_bServerHalted)
{
app.DebugPrintf("Auto-saving world...\n");
if (players != NULL)
{
players->saveAll(NULL);
}
for (unsigned int j = 0; j < levels.length; j++)
{
if (s_bServerHalted) break;
ServerLevel *level = levels[levels.length - 1 - j];
if (level) level->save(false, NULL, true);
}
if (!s_bServerHalted)
{
saveGameRules();
levels[0]->saveToDisc(NULL, true);
}
while (StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle)
{
Sleep(10);
}
app.DebugPrintf("Auto-save complete\n");
}
#endif
// 4J We need to update client difficulty levels based on the servers
Minecraft *pMinecraft = Minecraft::GetInstance();
// 4J-PB - sending this on the host changing the difficulty in the menus
@@ -1733,10 +1683,6 @@ void MinecraftServer::tick()
}
}
Entity::tickExtraWandering(); // 4J added
#ifdef _DEDICATED_SERVER
g_NetworkManager.DoWork();
NetworkSocketLayer::FlushPendingData();
#endif
PIXBeginNamedEvent(0,"Connection tick");
connection->tick();
@@ -1771,12 +1717,6 @@ void MinecraftServer::handleConsoleInputs()
AUTO_VAR(it, consoleInput.begin());
ConsoleInput *input = *it;
consoleInput.erase(it);
#ifdef _DEDICATED_SERVER
HandleServerCommand(input->msg, input->source, this);
delete input;
#else
delete input;
#endif
// commands->handleCommand(input); // 4J - removed - TODO - do we want equivalent of console commands?
}
}
+2 -3
View File
@@ -175,11 +175,10 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z)
if (MinecraftServer::getInstance()->serverHalted()) return NULL;
// If we're the host, then don't create the chunk, share data from the server's copy
int dimId = level->dimension->id;
#ifdef _LARGE_WORLDS
LevelChunk *serverChunk = MinecraftServer::getInstance()->getLevel(dimId)->cache->getChunkLoadedOrUnloaded(x,z);
LevelChunk *serverChunk = MinecraftServer::getInstance()->getLevel(level->dimension->id)->cache->getChunkLoadedOrUnloaded(x,z);
#else
LevelChunk *serverChunk = MinecraftServer::getInstance()->getLevel(dimId)->cache->getChunk(x,z);
LevelChunk *serverChunk = MinecraftServer::getInstance()->getLevel(level->dimension->id)->cache->getChunk(x,z);
#endif
chunk = new LevelChunk(level, x, z, serverChunk);
// Let renderer know that this chunk has been created - it might have made render data from the EmptyChunk if it got to a chunk before the server sent it
-2
View File
@@ -85,7 +85,6 @@ void PendingConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
return;
}
// printf("Server: handlePreLogin\n");
app.DebugPrintf("PreLogin received from \"%ls\"\n", packet->loginKey.c_str());
name = packet->loginKey; // 4J Stu - Change from the login packet as we know better on client end during the pre-login packet
sendPreLoginResponse();
}
@@ -140,7 +139,6 @@ void PendingConnection::sendPreLoginResponse()
void PendingConnection::handleLogin(shared_ptr<LoginPacket> packet)
{
app.DebugPrintf("Login received from \"%ls\" (protocol %d)\n", name.c_str(), packet->clientVersion);
// printf("Server: handleLogin\n");
//name = packet->userName;
if (packet->clientVersion != SharedConstants::NETWORK_PROTOCOL_VERSION)
+1 -7
View File
@@ -116,7 +116,7 @@ void PlayerConnection::disconnect(DisconnectPacket::eDisconnectReason reason)
return;
}
app.DebugPrintf("PlayerConnection disconect reason: %d", reason );
app.DebugPrintf("PlayerConnection disconect reason: %d\n", reason );
player->disconnect();
// 4J Stu - Need to remove the player from the receiving list before their socket is NULLed so that we can find another player on their system
@@ -543,16 +543,10 @@ void PlayerConnection::onDisconnect(DisconnectPacket::eDisconnectReason reason,
if(getWasKicked())
{
server->getPlayers()->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerKickedFromGame) ) );
#ifdef _DEDICATED_SERVER
app.DebugPrintf("%ls was kicked from the game", player->name.c_str());
#endif
}
else
{
server->getPlayers()->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerLeftGame) ) );
#ifdef _DEDICATED_SERVER
app.DebugPrintf("%ls left the game", player->name.c_str());
#endif
}
server->getPlayers()->remove(player);
done = true;
-1
View File
@@ -1,4 +1,3 @@
#pragma once
#include "ConsoleInputSource.h"
#include "..\Minecraft.World\PacketListener.h"
#include "..\Minecraft.World\JavaIntHash.h"
-4
View File
@@ -243,10 +243,6 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
//server->players->broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(L"§e" + playerEntity->name + L" joined the game.") ) );
broadcastAll( shared_ptr<ChatPacket>( new ChatPacket(player->name, ChatPacket::e_ChatPlayerJoinedGame) ) );
#ifdef _DEDICATED_SERVER
app.DebugPrintf("%ls joined the game", player->name.c_str());
#endif
MemSect(14);
add(player);
MemSect(0);
-2
View File
@@ -151,10 +151,8 @@ LevelChunk *ServerChunkCache::create(int x, int z, bool asyncPostProcess) // 4J
if( ( chunk == NULL ) || ( chunk->x != x ) || ( chunk->z != z ) )
{
bool wasLoaded = false;
EnterCriticalSection(&m_csLoadCreate);
chunk = load(x, z);
wasLoaded = (chunk != NULL);
if (chunk == NULL)
{
if (source == NULL)
-2
View File
@@ -1026,7 +1026,6 @@ void ServerLevel::saveToDisc(ProgressListener *progressListener, bool autosave)
// 4J-PB - check that saves are enabled
if(StorageManager.GetSaveDisabled()) return;
#ifndef _DEDICATED_SERVER
// Check if we are using a trial version of a texture pack (which will be the case for going into the mash-up pack world with a trial version)
if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin())
{
@@ -1040,7 +1039,6 @@ void ServerLevel::saveToDisc(ProgressListener *progressListener, bool autosave)
return;
}
}
#endif
if (progressListener != NULL) progressListener->progressStage(IDS_PROGRESS_SAVING_TO_DISC);
levelStorage->flushSaveFile(autosave);