diff --git a/plugin/src/main/java/me/lucaaa/advanceddisplays/commands/subCommands/ConvertSubCommand.java b/plugin/src/main/java/me/lucaaa/advanceddisplays/commands/subCommands/ConvertSubCommand.java index 5c23808..41224ff 100644 --- a/plugin/src/main/java/me/lucaaa/advanceddisplays/commands/subCommands/ConvertSubCommand.java +++ b/plugin/src/main/java/me/lucaaa/advanceddisplays/commands/subCommands/ConvertSubCommand.java @@ -58,6 +58,7 @@ public void run(CommandSender sender, String[] args) { } else if (config.getString("item") != null) { config.set("type", DisplayType.ITEM.name()); settingsSection.set("item", config.getString("item")); + settingsSection.set("enchanted", false); settingsSection.set("itemTransformation", config.getString("itemTransformation")); config.set("item", null); config.set("itemTransformation", null); @@ -99,12 +100,19 @@ public void run(CommandSender sender, String[] args) { case "1.1" -> { for (File configFile : Objects.requireNonNull(new File(AdvancedDisplays.getPlugin().getDataFolder().getAbsolutePath() + File.separator + "displays").listFiles())) { YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); - if (DisplayType.valueOf(config.getString("type")) != DisplayType.TEXT) continue; + DisplayType type = DisplayType.valueOf(config.getString("type")); + if (type == DisplayType.BLOCK) continue; ConfigurationSection settingsSection = config.getConfigurationSection("settings"); - settingsSection.set("animationTime", 20); - settingsSection.set("refreshTime", 20); - settingsSection.set("text", List.of(settingsSection.get("text"))); + + if (type == DisplayType.TEXT) { + settingsSection.set("animationTime", 20); + settingsSection.set("refreshTime", 20); + settingsSection.set("text", List.of(settingsSection.get("text"))); + + } else if (type == DisplayType.ITEM) { + settingsSection.set("enchanted", false); + } try { config.save(configFile); @@ -117,11 +125,18 @@ public void run(CommandSender sender, String[] args) { case "1.2" -> { for (File configFile : Objects.requireNonNull(new File(AdvancedDisplays.getPlugin().getDataFolder().getAbsolutePath() + File.separator + "displays").listFiles())) { YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); - if (DisplayType.valueOf(config.getString("type")) != DisplayType.TEXT) continue; + DisplayType type = DisplayType.valueOf(config.getString("type")); + if (type == DisplayType.BLOCK) continue; ConfigurationSection settingsSection = config.getConfigurationSection("settings"); - settingsSection.set("animationTime", 20); - settingsSection.set("refreshTime", 20); + + if (type == DisplayType.TEXT) { + settingsSection.set("animationTime", 20); + settingsSection.set("refreshTime", 20); + + } else if (type == DisplayType.ITEM) { + settingsSection.set("enchanted", false); + } try { AdvancedDisplays.mainConfig.getConfig().set("text-update", null); @@ -133,6 +148,22 @@ public void run(CommandSender sender, String[] args) { } } + case "1.2.1" -> { + for (File configFile : Objects.requireNonNull(new File(AdvancedDisplays.getPlugin().getDataFolder().getAbsolutePath() + File.separator + "displays").listFiles())) { + YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); + if (DisplayType.valueOf(config.getString("type")) != DisplayType.ITEM) continue; + + ConfigurationSection settingsSection = config.getConfigurationSection("settings"); + settingsSection.set("enchanted", false); + + try { + config.save(configFile); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + default -> sender.sendMessage(MessagesManager.getColoredMessage("&b" + args[1] + " &cis not a valid version.", true)); }