forked from cafeberry/cafeberry
Revert LCEMP dedicated server changes
Apparently smartcmd used their own dedicated server and not LCEMP's, starting from scratch!
This commit is contained in:
@@ -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?
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user