SteamWar/BauSystem2.0
Archiviert
12
0

Fix BauSystem for old BauWorld

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-07-11 17:10:24 +02:00
Ursprung afd292851d
Commit fe4542c67b

Datei anzeigen

@ -108,18 +108,32 @@ public class BauSystem extends JavaPlugin implements Listener {
} }
private void fixBauSystem() { private void fixBauSystem() {
int number = -1;
try {
String string = new File(world.getWorldFolder(), "sections.yapion").getCanonicalPath();
if (string.endsWith("/sections3.yml")) number = 3;
if (string.endsWith("/sections4.yml")) number = 4;
} catch (IOException e) {
Bukkit.getLogger().log(Level.SEVERE, e.getMessage(), e);
Bukkit.shutdown();
return;
}
if (number == -1) {
Bukkit.shutdown();
return;
}
if (!new File(world.getWorldFolder(),"prototypes.yapion").exists()) { if (!new File(world.getWorldFolder(),"prototypes.yapion").exists()) {
createLink("prototypes.yapion"); createLink("prototypes" + number + ".yapion", "prototypes.yapion");
} }
if (!new File(world.getWorldFolder(),"regions.yapion").exists()) { if (!new File(world.getWorldFolder(),"regions.yapion").exists()) {
createLink("regions.yapion"); createLink("regions" + number + ".yapion", "regions.yapion");
} }
} }
private void createLink(String name) { private void createLink(String source, String destination) {
try { try {
Bukkit.getLogger().log(Level.INFO, "Executing: ln -s /home/minecraft/backbone/server/Bau15/{0} .", new String[]{name}); Bukkit.getLogger().log(Level.INFO, "Executing: ln -s /home/minecraft/backbone/server/Bau15/{0} {1}", new String[]{source, destination});
ProcessBuilder processBuilder = new ProcessBuilder("ln", "-s", "/home/minecraft/backbone/server/Bau15/" + name, "."); ProcessBuilder processBuilder = new ProcessBuilder("ln", "-s", "/home/minecraft/backbone/server/Bau15/" + source, destination);
processBuilder.directory(world.getWorldFolder()); processBuilder.directory(world.getWorldFolder());
processBuilder.inheritIO(); processBuilder.inheritIO();