9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-04 15:41:38 +00:00

自动迁移

This commit is contained in:
XiaoMoMi
2025-09-29 01:54:45 +08:00
parent ef38e23040
commit 7d346b9779
2 changed files with 15 additions and 1 deletions

View File

@@ -55,6 +55,7 @@ import org.jspecify.annotations.Nullable;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Objects;
@@ -210,6 +211,19 @@ public class BukkitCraftEngine extends CraftEngine {
super.furnitureManager = new BukkitFurnitureManager(this);
super.onPluginEnable();
super.compatibilityManager().onEnable();
// todo 未来版本移除
Path legacyFile1 = this.dataFolderPath().resolve("additional-real-blocks.yml");
Path legacyFile2 = this.dataFolderPath().resolve("mappings.yml");
if (Files.exists(legacyFile1)) {
try {
Files.delete(legacyFile1);
Files.deleteIfExists(legacyFile2);
this.saveResource("resources/internal/configuration/mappings.yml");
} catch (IOException e) {
this.logger.warn("Failed to delete legacy files", e);
}
}
}
@Override