diff --git a/src/main/java/de/fanta/challengesjoinentities/Server.java b/src/main/java/de/fanta/challengesjoinentities/Server.java index 2756ed7..b60d69d 100644 --- a/src/main/java/de/fanta/challengesjoinentities/Server.java +++ b/src/main/java/de/fanta/challengesjoinentities/Server.java @@ -89,7 +89,7 @@ this.online = true; serverPlayers.put(this, p.getUniqueId()); File dir; - dir = new File("/home/minecraft/Server/" + this.serverType.getDir() + "/" + playerID + "/" + slot); + dir = new File("/home/minecraft/" + this.serverType.getDir() + "/" + playerID + "/" + slot); String path = playerID + "/" + slot; diff --git a/src/main/java/de/fanta/challengesjoinentities/commands/AdventureCommand/AdventureTempCommand.java b/src/main/java/de/fanta/challengesjoinentities/commands/AdventureCommand/AdventureTempCommand.java index 491a334..7242ed1 100644 --- a/src/main/java/de/fanta/challengesjoinentities/commands/AdventureCommand/AdventureTempCommand.java +++ b/src/main/java/de/fanta/challengesjoinentities/commands/AdventureCommand/AdventureTempCommand.java @@ -2,21 +2,15 @@ import de.fanta.challengesjoinentities.ChallengesJoinEntities; import de.fanta.challengesjoinentities.ChatUtil; -import de.fanta.challengesjoinentities.adventure.AdventureMap; import de.iani.cubesideutils.bukkit.commands.SubCommand; import de.iani.cubesideutils.commands.ArgsParser; import de.tr7zw.nbtapi.NBTCompound; import de.tr7zw.nbtapi.NBTFile; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.inventory.ItemStack; import java.io.File; import java.io.IOException; -import java.util.HashMap; -import java.util.logging.Level; public class AdventureTempCommand extends SubCommand { private final ChallengesJoinEntities plugin; @@ -26,52 +20,13 @@ } public boolean onCommand(CommandSender sender, Command command, String alias, String commandString, ArgsParser args) { - int count = 0; - HashMap list = new HashMap<>(); - File adventureMapsFolder = new File("/home/minecraft/Adventure-Maps/"); - File[] categories = adventureMapsFolder.listFiles(); - if (categories != null) { - for (File category : categories) { - ChatUtil.sendNormalMessage(sender, "- " + category.getName()); - File[] maps = category.listFiles(); - if (maps != null) { - for (File map : maps) { - ChatUtil.sendDebugMessage(sender, " - " + map.getName()); - AdventureMap adventureMap = plugin.getAdventureMapsConfig().getMap(map.getName()); - if (adventureMap != null) { - try { - NBTFile file = new NBTFile(new File(map, "/world/level.dat")); - NBTCompound data = file.getCompound("Data"); - NBTCompound worldgen = data.getCompound("WorldGenSettings"); - Long seed = null; - if (worldgen != null) { - seed = worldgen.getLong("seed"); - } - if (seed == null || seed == 0) { - seed = data.getLong("RandomSeed"); - } - - if (seed != null) { - count++; - list.put(seed, adventureMap.getItem()); - ChatUtil.sendWarningMessage(sender, " " + seed); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - } - } - } - } - } - ChatUtil.sendDebugMessage(sender, "Maps: " + count + " - List: " + list.size()); - - File adventureSaves = new File("/home/minecraft/Adventure-saves/"); + File adventureSaves = new File("/home/minecraft/saves/"); File[] players = adventureSaves.listFiles(); if (players != null) { for (File player : players) { ChatUtil.sendNormalMessage(sender, "- " + player.getName()); + File[] maps = player.listFiles(); if (maps != null) { for (File map : maps) { @@ -79,30 +34,17 @@ try { NBTFile file = new NBTFile(new File(map, "/world/level.dat")); NBTCompound data = file.getCompound("Data"); - NBTCompound worldgen = data.getCompound("WorldGenSettings"); - Long seed = null; - if (worldgen != null) { - seed = worldgen.getLong("seed"); - } - if (seed == null || seed == 0) { - seed = data.getLong("RandomSeed"); - } - if (seed != null && list.containsKey(seed)) { - ChatUtil.sendWarningMessage(sender, " " + seed); - File mapConfig = new File(map, "/Challenges/serverconfig.yml"); - ItemStack stack = list.get(seed); - ChatUtil.sendWarningMessage(sender, " " + stack.getType().toString()); - try { - YamlConfiguration serverConfig = new YamlConfiguration(); - serverConfig.load(mapConfig); - serverConfig.set("displayItem.item", stack.getType().toString()); - serverConfig.set("displayItem.name", stack.getItemMeta().getDisplayName()); - serverConfig.save(mapConfig); - } catch (IOException | InvalidConfigurationException ex) { - plugin.getLogger().log(Level.SEVERE, "Fehler beim ändern der Config", ex); - ChatUtil.sendErrorMessage(sender, " --- Map " + map.getName() + ": Fehler beim ändern der Config! ---"); - } - } + NBTCompound dataPacks = data.getCompound("DataPacks"); + + dataPacks.getStringList("Enabled").add("update_1_20"); + dataPacks.getStringList("Disabled").add("bundle"); + + data.getStringList("enabled_features").add("minecraft:update_1_20"); + data.getStringList("enabled_features").add("minecraft:vanilla"); + + + file.save(); + } catch (IOException e) { throw new RuntimeException(e); }