load static method
Implementation
static Future<SetonixServer> load({
String? worldFile,
bool disableLoading = false,
}) async {
final assetManager = ServerAssetManager();
final consoler = Consoler(
defaultProgramConfig: DefaultProgramConfiguration(
description: "Setonix server",
),
);
await _runStaticLogZone(
consoler, () => assetManager.init(console: consoler));
worldFile ??= defaultWorldFile;
final file = File(worldFile);
SetonixData? data;
if (!disableLoading && await file.exists()) {
final bytes = await file.readAsBytes();
data = SetonixData.fromData(bytes);
}
data ??= SetonixData.empty().setInfo(GameInfo(
packs: assetManager.getPackIds().toList(),
));
return SetonixServer._(worldFile, consoler, data, assetManager);
}