diff --git a/src/main/java/de/fanta/challengesjoinentities/Server.java b/src/main/java/de/fanta/challengesjoinentities/Server.java index a98e007..995612e 100644 --- a/src/main/java/de/fanta/challengesjoinentities/Server.java +++ b/src/main/java/de/fanta/challengesjoinentities/Server.java @@ -3,6 +3,7 @@ import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; @@ -70,7 +71,7 @@ serverPlayers.put(this, p.getUniqueId()); UUID uuid = p.getUniqueId(); File dir; - dir = new File("/home/minecraft/" + this.serverType.getDir() + "/" + uuid + "/" + slot); + dir = new File("/home/minecraft/" + this.serverType.getDir() + "/" + uuid + "/" + slot); if (!dir.isDirectory()) { ChatUtil.sendErrorMessage(p, "Du hast noch keine Map gespeichert!"); @@ -80,7 +81,7 @@ } - load(p, this.serverType.getDir(), uuid + "/" + slot, getMapVersion(new File(dir + "/Challenges/serverconfig.yml"))); //TODO LOAD VERSION FROM ADVENTURE CONFIG + load(p, this.serverType.getDir(), uuid + "/" + slot, getMapVersion(new File(dir + "/Challenges/serverconfig.yml"))); //TODO LOAD VERSION FROM ADVENTURE CONFIG } @@ -88,8 +89,8 @@ this.online = true; serverPlayers.put(this, p.getUniqueId()); File dir; - dir = new File("/home/minecraft/" + this.serverType.getDir() + "/" + mapname + "/" + slot); - mapname = mapname + "/" + slot; + dir = new File("/home/minecraft/" + this.serverType.getDir() + "/" + mapname + "/" + slot); + mapname = mapname + "/" + slot; if (!dir.isDirectory()) { @@ -134,7 +135,7 @@ FileUtils.deleteDirectory(end); FileUtils.deleteDirectory(nether); } - if (mlgworld.isDirectory()){ + if (mlgworld.isDirectory()) { FileUtils.deleteDirectory(mlgworld); } if (serverJar.exists()) { @@ -145,7 +146,18 @@ FileUtils.copyDirectory(saveworld, world); FileUtils.copyDirectory(savenether, nether); FileUtils.copyDirectory(saveend, end); - } catch (IOException e) { + + File serverConfigFile = new File("/home/minecraft/" + this.dir + "/plugins/Challenges/serverconfig.yml"); + YamlConfiguration serverConfig = new YamlConfiguration(); + serverConfig.load(serverConfigFile); + String tempServerType = serverConfig.getString("servertype"); + if (tempServerType == null || tempServerType.equals("CHALLENGE")) { + serverConfig.set("servertype", "CHALLENGE_LOAD"); + serverConfig.save(serverConfigFile); + Bukkit.getLogger().info(serverConfigFile.getAbsolutePath()); + } + + } catch (IOException | InvalidConfigurationException e) { e.printStackTrace(); ChatUtil.sendErrorMessage(p, "Map konnte nicht geladen werden!"); this.online = false;