diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 3cbd13e5..f2f656ac 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -40,6 +40,10 @@ import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.attribute.BasicFileAttributes; +import java.nio.file.attribute.FileTime; import java.util.logging.Level; public class BauSystem extends JavaPlugin implements Listener { @@ -114,12 +118,30 @@ public class BauSystem extends JavaPlugin implements Listener { } private void fixBauSystem() { + if (!new File(world.getWorldFolder(), "sections.yml").exists()) { + try { + Path path = new File(world.getWorldFolder(), "region").toPath(); + BasicFileAttributes attributes = Files.readAttributes(path, BasicFileAttributes.class); + FileTime creationTime = attributes.creationTime(); + long millis = creationTime.toMillis(); + if (millis < 1611081960) { + createLink("sections3.yml", "sections.yml"); + } else { + createLink("sections4.yml", "sections.yml"); + } + } catch (IOException e) { + Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); + Bukkit.shutdown(); + return; + } + } int number = -1; try { String string = new File(world.getWorldFolder(), "sections.yml").getCanonicalPath(); if (string.endsWith("/sections2.yml")) number = 2; if (string.endsWith("/sections3.yml")) number = 3; if (string.endsWith("/sections4.yml")) number = 4; + Bukkit.getLogger().log(Level.INFO, "SectionFile: " + string); } catch (IOException e) { Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e); Bukkit.shutdown();