mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
- Introduced ServerLogger for logging startup steps and world I/O operations. - Implemented ServerProperties for loading and saving server configuration from `server.properties`. - Added WorldManager to handle world loading and creation based on server properties. - Updated ServerMain to integrate server properties loading and world management. - Enhanced project files to include new source and header files for the server components.
40 lines
906 B
C++
40 lines
906 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
namespace ServerRuntime
|
|
{
|
|
/**
|
|
* `server.properties`
|
|
*/
|
|
struct ServerPropertiesConfig
|
|
{
|
|
/** world name `level-name` */
|
|
std::wstring worldName;
|
|
/** world save id `level-id` */
|
|
std::string worldSaveId;
|
|
};
|
|
|
|
/**
|
|
* server.properties loader
|
|
*
|
|
* - ファイル欠損時はデフォルト値で新規作成
|
|
* - 必須キー不足時は補完して再保存
|
|
* - `level-id` は保存先として安全な形式へ正規化
|
|
*
|
|
* @return `WorldManager` が利用するワールド設定
|
|
*/
|
|
ServerPropertiesConfig LoadServerPropertiesConfig();
|
|
|
|
/**
|
|
* server.properties saver
|
|
*
|
|
* - `level-name` と `level-id` を更新
|
|
* - それ以外の既存キーは極力保持
|
|
*
|
|
* @param config 保存するワールド識別情報
|
|
* @return 書き込み成功時 `true`
|
|
*/
|
|
bool SaveServerPropertiesConfig(const ServerPropertiesConfig &config);
|
|
}
|