Skip to content

Commit

Permalink
fix: настройки сохранений
Browse files Browse the repository at this point in the history
- Исправлены настройки сохранений
- Обновлён Nukkit-Mot
  • Loading branch information
Reider745 committed Dec 27, 2023
1 parent fe7a29b commit 758997e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Zote Core Loader

__Zote Core__ — серверное ядро, основанное на Inner Core 1.26.200, созданное для создания уникального геймплея с модами.
__Zote Core__ — серверное ядро, основанное на Inner Core 1.16.200, созданное для создания уникального геймплея с модами.

Основой серверного ядра послужил [Nukkit-MOT](https://github.com/MemoriesOfTime/Nukkit-MOT), его можно легко обновить, заменив соответствующую библиотеку.

Expand Down Expand Up @@ -53,6 +53,12 @@ allow-unsafe-scripting: on
# Режим разработчика позволяет получать дополнительную информацию
# о работе ядра, а также профайлинг методов.
developer-mode: off

# Период сохранения данных inner core
auto-save-period: 60

# Обновлять вместе с сохранениями inner core сохранения мира
auto-save-world: on
```
## Лицензия
Expand Down
Binary file modified iclibs/Nukkit-MOT-SNAPSHOT.jar
Binary file not shown.
10 changes: 10 additions & 0 deletions src/main/java/com/reider745/InnerCoreServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.zhekasmirnov.innercore.api.NativeCallback;
import com.zhekasmirnov.innercore.api.NativeFurnaceRegistry;
import com.zhekasmirnov.innercore.api.runtime.LoadingStage;
import com.zhekasmirnov.innercore.api.runtime.saver.world.WorldDataSaverHandler;
import com.zhekasmirnov.innercore.mod.build.ExtractionHelper;
import com.zhekasmirnov.innercore.modpack.ModPack;
import com.zhekasmirnov.innercore.modpack.ModPackContext;
Expand Down Expand Up @@ -281,6 +282,7 @@ public void preload(Server server) throws Exception {
});

NativeCallback.onLocalServerStarted();
WorldDataSaverHandler.getInstance().fetchParamsFromConfig();

Logger.info("INNERCORE", "preloaded in " + (System.currentTimeMillis() - startupMillis) + "ms");
}
Expand Down Expand Up @@ -418,6 +420,14 @@ public static boolean isDeveloperMode() {
return singleton.getPropertyBoolean("developer-mode", false);
}

public static int getAutoSavePeriod() {
return singleton.getPropertyInt("auto-save-period", 60);
}

public static boolean canAutoSaveWorld() {
return singleton.getPropertyBoolean("auto-save-world", true);
}

public static MethodHandling getUnsupportedMethodHandling() {
try {
return MethodHandling
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.zhekasmirnov.innercore.api.runtime.saver.world;

import com.reider745.InnerCoreServer;
import com.zhekasmirnov.apparatus.adapter.innercore.EngineConfig;
import com.zhekasmirnov.horizon.runtime.logger.Logger;
import com.zhekasmirnov.innercore.api.NativeAPI;
Expand All @@ -25,10 +26,13 @@ public static WorldDataSaverHandler getInstance() {
private long previousAutoSave = 0;

public void fetchParamsFromConfig() {
final int auto_save_period = InnerCoreServer.getAutoSavePeriod();

setParams(
EngineConfig.getBoolean("background.auto_save", true),
EngineConfig.getBoolean("background.auto_save_world", true),
EngineConfig.getInt("background.auto_save_period", 30) * 1000);
auto_save_period > 10,
InnerCoreServer.canAutoSaveWorld(),
auto_save_period * 1000
);
}

public void setParams(boolean autoSaveEnabled, boolean autoSaveMinecraftWorld, int autoSaveInterval) {
Expand Down

0 comments on commit 758997e

Please sign in to comment.