SteamWar/BauSystem2.0
Archiviert
12
0

Fix BauSystem
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-12-16 18:11:19 +01:00
Ursprung b3d0dd0f96
Commit 5420c69137

Datei anzeigen

@ -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();