Fixed config error

This commit is contained in:
WolverinDEV 2020-02-20 13:12:14 +01:00
parent aa08bfbf1b
commit fd36ce87cf

View File

@ -320,7 +320,7 @@ shared_ptr<VirtualServer> VirtualServerManager::create_server(std::string hosts,
auto prop_copy = sql::command(this->handle->getSql(), "INSERT INTO `properties` (`serverId`, `type`, `id`, `key`, `value`) SELECT :target_sid AS `serverId`, `type`, `id`, `key`, `value` FROM `properties` WHERE `type` = :type AND `id` = 0 AND `serverId` = 0;", auto prop_copy = sql::command(this->handle->getSql(), "INSERT INTO `properties` (`serverId`, `type`, `id`, `key`, `value`) SELECT :target_sid AS `serverId`, `type`, `id`, `key`, `value` FROM `properties` WHERE `type` = :type AND `id` = 0 AND `serverId` = 0;",
variable{":target_sid", serverId}, variable{":target_sid", serverId},
variable{":type", property::PROP_TYPE_SERVER}).execute(); variable{":type", property::PROP_TYPE_SERVER}).execute();
if(!prop_copy.success) if(!prop_copy)
logCritical(LOG_GENERAL, "Failed to copy default server properties: {}", prop_copy.fmtStr()); logCritical(LOG_GENERAL, "Failed to copy default server properties: {}", prop_copy.fmtStr());
auto server = make_shared<VirtualServer>(serverId, this->handle->getSql()); auto server = make_shared<VirtualServer>(serverId, this->handle->getSql());
@ -330,10 +330,12 @@ shared_ptr<VirtualServer> VirtualServerManager::create_server(std::string hosts,
} }
server->properties()[property::VIRTUALSERVER_HOST] = hosts; server->properties()[property::VIRTUALSERVER_HOST] = hosts;
server->properties()[property::VIRTUALSERVER_PORT] = port; server->properties()[property::VIRTUALSERVER_PORT] = port;
if(!config::server::default_music_bot) {
auto bot = server->musicManager->createBot(0); auto bot = server->musicManager->createBot(0);
if(!bot) { if(!bot) {
logCritical(server->getServerId(), "Failed to create default music bot!"); logCritical(server->getServerId(), "Failed to create default music bot!");
} }
}
{ {
threads::MutexLock l(this->instanceLock); threads::MutexLock l(this->instanceLock);
this->instances.push_back(server); this->instances.push_back(server);