commit
ba8152608f
|
@ -1,18 +1,20 @@
|
||||||
/============================\
|
/============================\
|
||||||
| Custom Minecraft Server |
|
| Custom Minecraft Server |
|
||||||
| Created by Kevin Bansberg |
|
| (MCServer) |
|
||||||
|
| |
|
||||||
|
| Founder: Kevin Bansberg |
|
||||||
| A.K.A. FakeTruth |
|
| A.K.A. FakeTruth |
|
||||||
|
| Lead dev: Mattes D |
|
||||||
|
| A.K.A. _Xoft(o) |
|
||||||
|
| A.K.A. xoft |
|
||||||
| Monsters by Alex Sonek |
|
| Monsters by Alex Sonek |
|
||||||
| A.K.A. Duralex |
|
| A.K.A. Duralex |
|
||||||
| Stuff by Mattes D |
|
|
||||||
| A.K.A. _Xoft(o) |
|
|
||||||
|============================|
|
|============================|
|
||||||
| Info: WWW.MC-SERVER.ORG |
|
| Info: www.mc-server.org |
|
||||||
| WWW.AE-C.NET\n") |
|
| www.ae-c.net |
|
||||||
| WWW.RBTHINKTANK.COM |
|
| www.rbthinktank.com |
|
||||||
| Mail: faketruth@gmail.com |
|
| Mail: faketruth@gmail.com |
|
||||||
\============================/
|
\============================/
|
||||||
|
|
||||||
|
Compatible clients: 1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5, 1.5.1, 1.5.2, 1.6.1, 1.6.2, 1.6.3, 1.6.4
|
||||||
Compatible clients: 1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.4.2, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.5, 1.5.1, 1.5.2, 1.6.1, 1.6.2
|
Compatible protocol versions: 29, 39, 47, 49, 51, 60, 61, 73, 74, 77, 78
|
||||||
Compatible protocol versions: 29, 39, 47, 49, 51, 60, 61, 73, 74
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ void cCraftingRecipes::GetRecipe(const cPlayer * a_Player, const cCraftingGrid &
|
||||||
|
|
||||||
void cCraftingRecipes::LoadRecipes(void)
|
void cCraftingRecipes::LoadRecipes(void)
|
||||||
{
|
{
|
||||||
LOG("-- Loading crafting recipes from crafting.txt --");
|
LOGD("Loading crafting recipes from crafting.txt...");
|
||||||
ClearRecipes();
|
ClearRecipes();
|
||||||
|
|
||||||
// Load the crafting.txt file:
|
// Load the crafting.txt file:
|
||||||
|
@ -338,7 +338,7 @@ void cCraftingRecipes::LoadRecipes(void)
|
||||||
}
|
}
|
||||||
AddRecipeLine(LineNum, Recipe);
|
AddRecipeLine(LineNum, Recipe);
|
||||||
} // for itr - Split[]
|
} // for itr - Split[]
|
||||||
LOG("-- %d crafting recipes loaded from crafting.txt --", m_Recipes.size());
|
LOG("Loaded %d crafting recipes", m_Recipes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ cFurnaceRecipe::~cFurnaceRecipe()
|
||||||
void cFurnaceRecipe::ReloadRecipes(void)
|
void cFurnaceRecipe::ReloadRecipes(void)
|
||||||
{
|
{
|
||||||
ClearRecipes();
|
ClearRecipes();
|
||||||
LOG("-- Loading furnace recipes --");
|
LOGD("Loading furnace recipes...");
|
||||||
|
|
||||||
std::ifstream f;
|
std::ifstream f;
|
||||||
char a_File[] = "furnace.txt";
|
char a_File[] = "furnace.txt";
|
||||||
|
@ -175,7 +175,7 @@ void cFurnaceRecipe::ReloadRecipes(void)
|
||||||
{
|
{
|
||||||
LOGERROR("ERROR: FurnaceRecipe, syntax error" );
|
LOGERROR("ERROR: FurnaceRecipe, syntax error" );
|
||||||
}
|
}
|
||||||
LOG("Got %u furnace recipes, and %u fuels.", m_pState->Recipes.size(), m_pState->Fuel.size());
|
LOG("Loaded %u furnace recipes and %u fuels", m_pState->Recipes.size(), m_pState->Fuel.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -294,7 +294,7 @@ void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile)
|
||||||
);
|
);
|
||||||
CacheSize = 4;
|
CacheSize = 4;
|
||||||
}
|
}
|
||||||
LOGINFO("Using a cache for Heightgen of size %d.", CacheSize);
|
LOGD("Using a cache for Heightgen of size %d.", CacheSize);
|
||||||
m_UnderlyingHeightGen = m_HeightGen;
|
m_UnderlyingHeightGen = m_HeightGen;
|
||||||
m_HeightGen = new cHeiGenCache(m_UnderlyingHeightGen, CacheSize);
|
m_HeightGen = new cHeiGenCache(m_UnderlyingHeightGen, CacheSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ cGroupManager::~cGroupManager()
|
||||||
cGroupManager::cGroupManager()
|
cGroupManager::cGroupManager()
|
||||||
: m_pState( new sGroupManagerState )
|
: m_pState( new sGroupManagerState )
|
||||||
{
|
{
|
||||||
LOG("-- Loading Groups --");
|
LOGD("-- Loading Groups --");
|
||||||
cIniFile IniFile("groups.ini");
|
cIniFile IniFile("groups.ini");
|
||||||
if (!IniFile.ReadFile())
|
if (!IniFile.ReadFile())
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ cGroupManager::cGroupManager()
|
||||||
std::string KeyName = IniFile.GetKeyName( i );
|
std::string KeyName = IniFile.GetKeyName( i );
|
||||||
cGroup* Group = GetGroup( KeyName.c_str() );
|
cGroup* Group = GetGroup( KeyName.c_str() );
|
||||||
|
|
||||||
LOG("Loading group: %s", KeyName.c_str() );
|
LOGD("Loading group: %s", KeyName.c_str() );
|
||||||
|
|
||||||
Group->SetName( KeyName );
|
Group->SetName( KeyName );
|
||||||
char Color = IniFile.GetValue( KeyName, "Color", "-" )[0];
|
char Color = IniFile.GetValue( KeyName, "Color", "-" )[0];
|
||||||
|
@ -73,7 +73,6 @@ cGroupManager::cGroupManager()
|
||||||
for( unsigned int i = 0; i < Split.size(); i++)
|
for( unsigned int i = 0; i < Split.size(); i++)
|
||||||
{
|
{
|
||||||
Group->AddCommand( Split[i] );
|
Group->AddCommand( Split[i] );
|
||||||
//LOG("%s", Split[i].c_str() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +83,6 @@ cGroupManager::cGroupManager()
|
||||||
for( unsigned int i = 0; i < Split.size(); i++)
|
for( unsigned int i = 0; i < Split.size(); i++)
|
||||||
{
|
{
|
||||||
Group->AddPermission( Split[i] );
|
Group->AddPermission( Split[i] );
|
||||||
//LOGINFO("Permission: %s", Split[i].c_str() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +96,7 @@ cGroupManager::cGroupManager()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG("-- Groups Successfully Loaded --");
|
LOGD("-- Groups Successfully Loaded --");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ void cPluginManager::FindPlugins(void)
|
||||||
|
|
||||||
void cPluginManager::ReloadPluginsNow(void)
|
void cPluginManager::ReloadPluginsNow(void)
|
||||||
{
|
{
|
||||||
LOG("Loading plugins");
|
LOG("-- Loading Plugins --");
|
||||||
m_bReloadPlugins = false;
|
m_bReloadPlugins = false;
|
||||||
UnloadPluginsNow();
|
UnloadPluginsNow();
|
||||||
|
|
||||||
|
@ -135,11 +135,15 @@ void cPluginManager::ReloadPluginsNow(void)
|
||||||
|
|
||||||
if (GetNumPlugins() == 0)
|
if (GetNumPlugins() == 0)
|
||||||
{
|
{
|
||||||
LOG("No plugins loaded");
|
LOG("-- No Plugins Loaded --");
|
||||||
|
}
|
||||||
|
else if ((GetNumPlugins() > 1) || (GetNumPlugins() == 0))
|
||||||
|
{
|
||||||
|
LOG("-- Loaded %i Plugins --", GetNumPlugins());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG("Loaded %i plugin(s)", GetNumPlugins());
|
LOG("-- Loaded 1 Plugin --");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "Protocol/ProtocolRecognizer.h" // for protocol version constants
|
#include "Protocol/ProtocolRecognizer.h" // for protocol version constants
|
||||||
#include "CommandOutput.h"
|
#include "CommandOutput.h"
|
||||||
#include "DeadlockDetect.h"
|
#include "DeadlockDetect.h"
|
||||||
|
#include "OSSupport/Timer.h"
|
||||||
|
|
||||||
#include "../iniFile/iniFile.h"
|
#include "../iniFile/iniFile.h"
|
||||||
|
|
||||||
|
@ -91,6 +92,10 @@ void cRoot::InputThread(void * a_Params)
|
||||||
|
|
||||||
void cRoot::Start(void)
|
void cRoot::Start(void)
|
||||||
{
|
{
|
||||||
|
cTimer Time;
|
||||||
|
|
||||||
|
long long mseconds = Time.GetNowTime();
|
||||||
|
|
||||||
cDeadlockDetect dd;
|
cDeadlockDetect dd;
|
||||||
delete m_Log;
|
delete m_Log;
|
||||||
m_Log = new cMCLogger();
|
m_Log = new cMCLogger();
|
||||||
|
@ -125,7 +130,7 @@ void cRoot::Start(void)
|
||||||
LOG("Starting server...");
|
LOG("Starting server...");
|
||||||
if (!m_Server->InitServer(IniFile))
|
if (!m_Server->InitServer(IniFile))
|
||||||
{
|
{
|
||||||
LOGERROR("Failed to start server, shutting down.");
|
LOGERROR("Failure starting server, aborting...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IniFile.WriteFile();
|
IniFile.WriteFile();
|
||||||
|
@ -138,45 +143,49 @@ void cRoot::Start(void)
|
||||||
|
|
||||||
if (WebIniFile.GetValueB("WebAdmin", "Enabled", false))
|
if (WebIniFile.GetValueB("WebAdmin", "Enabled", false))
|
||||||
{
|
{
|
||||||
LOG("Creating WebAdmin...");
|
LOGD("Creating WebAdmin...");
|
||||||
m_WebAdmin = new cWebAdmin(8080);
|
m_WebAdmin = new cWebAdmin(8080);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("Loading settings...");
|
LOGD("Loading settings...");
|
||||||
m_GroupManager = new cGroupManager();
|
m_GroupManager = new cGroupManager();
|
||||||
m_CraftingRecipes = new cCraftingRecipes;
|
m_CraftingRecipes = new cCraftingRecipes;
|
||||||
m_FurnaceRecipe = new cFurnaceRecipe();
|
m_FurnaceRecipe = new cFurnaceRecipe();
|
||||||
|
|
||||||
LOG("Loading worlds...");
|
LOGD("Loading worlds...");
|
||||||
LoadWorlds();
|
LoadWorlds();
|
||||||
|
|
||||||
LOG("Loading plugin manager...");
|
LOGD("Loading plugin manager...");
|
||||||
m_PluginManager = new cPluginManager();
|
m_PluginManager = new cPluginManager();
|
||||||
m_PluginManager->ReloadPluginsNow();
|
m_PluginManager->ReloadPluginsNow();
|
||||||
|
|
||||||
LOG("Loading MonsterConfig...");
|
LOGD("Loading MonsterConfig...");
|
||||||
m_MonsterConfig = new cMonsterConfig;
|
m_MonsterConfig = new cMonsterConfig;
|
||||||
|
|
||||||
// This sets stuff in motion
|
// This sets stuff in motion
|
||||||
LOG("Starting Authenticator...");
|
LOGD("Starting Authenticator...");
|
||||||
m_Authenticator.Start();
|
m_Authenticator.Start();
|
||||||
|
|
||||||
LOG("Starting worlds...");
|
LOGD("Starting worlds...");
|
||||||
StartWorlds();
|
StartWorlds();
|
||||||
|
|
||||||
LOG("Starting deadlock detector...");
|
LOGD("Starting deadlock detector...");
|
||||||
dd.Start();
|
dd.Start();
|
||||||
|
|
||||||
LOG("Starting server...");
|
LOGD("Finalising startup...");
|
||||||
m_Server->Start();
|
m_Server->Start();
|
||||||
|
|
||||||
#if !defined(ANDROID_NDK)
|
#if !defined(ANDROID_NDK)
|
||||||
LOG("Starting InputThread...");
|
LOGD("Starting InputThread...");
|
||||||
m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" );
|
m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" );
|
||||||
m_InputThread->Start( false ); // We should NOT wait? Otherwise we can´t stop the server from other threads than the input thread
|
m_InputThread->Start( false ); // We should NOT wait? Otherwise we can´t stop the server from other threads than the input thread
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOG("Initialization done, server running now.");
|
long long finishmseconds = Time.GetNowTime();
|
||||||
|
finishmseconds -= mseconds;
|
||||||
|
|
||||||
|
LOG("Startup complete, took %i ms!", finishmseconds);
|
||||||
|
|
||||||
while (!m_bStop && !m_bRestart) // These are modified by external threads
|
while (!m_bStop && !m_bRestart) // These are modified by external threads
|
||||||
{
|
{
|
||||||
cSleep::MilliSleep(1000);
|
cSleep::MilliSleep(1000);
|
||||||
|
@ -190,37 +199,37 @@ void cRoot::Start(void)
|
||||||
LOG("Shutting down server...");
|
LOG("Shutting down server...");
|
||||||
m_Server->Shutdown();
|
m_Server->Shutdown();
|
||||||
|
|
||||||
LOG("Shutting down deadlock detector...");
|
LOGD("Shutting down deadlock detector...");
|
||||||
dd.Stop();
|
dd.Stop();
|
||||||
|
|
||||||
LOG("Stopping world threads...");
|
LOGD("Stopping world threads...");
|
||||||
StopWorlds();
|
StopWorlds();
|
||||||
|
|
||||||
LOG("Stopping authenticator...");
|
LOGD("Stopping authenticator...");
|
||||||
m_Authenticator.Stop();
|
m_Authenticator.Stop();
|
||||||
|
|
||||||
LOG("Freeing MonsterConfig...");
|
LOGD("Freeing MonsterConfig...");
|
||||||
delete m_MonsterConfig; m_MonsterConfig = NULL;
|
delete m_MonsterConfig; m_MonsterConfig = NULL;
|
||||||
LOG("Stopping WebAdmin...");
|
LOGD("Stopping WebAdmin...");
|
||||||
delete m_WebAdmin; m_WebAdmin = NULL;
|
delete m_WebAdmin; m_WebAdmin = NULL;
|
||||||
LOG("Unloading recipes...");
|
LOGD("Unloading recipes...");
|
||||||
delete m_FurnaceRecipe; m_FurnaceRecipe = NULL;
|
delete m_FurnaceRecipe; m_FurnaceRecipe = NULL;
|
||||||
delete m_CraftingRecipes; m_CraftingRecipes = NULL;
|
delete m_CraftingRecipes; m_CraftingRecipes = NULL;
|
||||||
LOG("Forgetting groups...");
|
LOGD("Forgetting groups...");
|
||||||
delete m_GroupManager; m_GroupManager = 0;
|
delete m_GroupManager; m_GroupManager = 0;
|
||||||
LOG("Unloading worlds...");
|
LOGD("Unloading worlds...");
|
||||||
UnloadWorlds();
|
UnloadWorlds();
|
||||||
|
|
||||||
LOG("Stopping plugin manager...");
|
LOGD("Stopping plugin manager...");
|
||||||
delete m_PluginManager; m_PluginManager = NULL;
|
delete m_PluginManager; m_PluginManager = NULL;
|
||||||
|
|
||||||
cItemHandler::Deinit();
|
cItemHandler::Deinit();
|
||||||
cBlockHandler::Deinit();
|
cBlockHandler::Deinit();
|
||||||
|
|
||||||
LOG("Destroying server...");
|
LOG("Cleaning up...");
|
||||||
//delete HeartBeat; HeartBeat = 0;
|
//delete HeartBeat; HeartBeat = 0;
|
||||||
delete m_Server; m_Server = 0;
|
delete m_Server; m_Server = 0;
|
||||||
LOG("Shutdown done.");
|
LOG("Shutdown successful!");
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_Log; m_Log = 0;
|
delete m_Log; m_Log = 0;
|
||||||
|
|
|
@ -206,7 +206,6 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("Starting up server.");
|
|
||||||
LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS);
|
LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS);
|
||||||
LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS);
|
LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS);
|
||||||
|
|
||||||
|
@ -292,7 +291,7 @@ void cServer::PrepareKeys(void)
|
||||||
// TODO: Save and load key for persistence across sessions
|
// TODO: Save and load key for persistence across sessions
|
||||||
// But generating the key takes only a moment, do we even need that?
|
// But generating the key takes only a moment, do we even need that?
|
||||||
|
|
||||||
LOG("Generating protocol encryption keypair...");
|
LOGD("Generating protocol encryption keypair...");
|
||||||
|
|
||||||
time_t CurTime = time(NULL);
|
time_t CurTime = time(NULL);
|
||||||
CryptoPP::RandomPool rng;
|
CryptoPP::RandomPool rng;
|
||||||
|
|
|
@ -297,7 +297,7 @@ bool cWebAdmin::Init(int a_Port)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LOG("Starting WebAdmin on port %i", m_Port);
|
LOGINFO("Starting WebAdmin on port %i", m_Port);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HANDLE hThread = CreateThread(
|
HANDLE hThread = CreateThread(
|
||||||
|
|
Loading…
Reference in New Issue