diff --git a/paper/src/main/java/com/badbones69/crazycrates/api/enums/Messages.java b/paper/src/main/java/com/badbones69/crazycrates/api/enums/Messages.java index 59c511276..fcb1061a5 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/api/enums/Messages.java +++ b/paper/src/main/java/com/badbones69/crazycrates/api/enums/Messages.java @@ -4,6 +4,7 @@ import ch.jalu.configme.properties.Property; import com.badbones69.crazycrates.CrazyCrates; import com.badbones69.crazycrates.api.enums.misc.State; +import com.badbones69.crazycrates.api.utils.MiscUtils; import com.ryderbelserion.vital.common.utils.StringUtil; import com.ryderbelserion.vital.paper.api.enums.Support; import com.ryderbelserion.vital.paper.util.AdvUtil; @@ -231,6 +232,16 @@ public void sendRichMessage(final CommandSender sender) { sender.sendRichMessage(msg); } + public void migrate() { + if (this.isList) { + this.config.setProperty(this.properties, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(this.properties)))); + + return; + } + + this.config.setProperty(this.property, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(this.property)))); + } + private @NotNull String parse(@NotNull final CommandSender sender, @NotNull final Map placeholders) { String message; diff --git a/paper/src/main/java/com/badbones69/crazycrates/commands/crates/types/admin/crates/migrator/ICrateMigrator.java b/paper/src/main/java/com/badbones69/crazycrates/commands/crates/types/admin/crates/migrator/ICrateMigrator.java index dc95fadb4..188232224 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/commands/crates/types/admin/crates/migrator/ICrateMigrator.java +++ b/paper/src/main/java/com/badbones69/crazycrates/commands/crates/types/admin/crates/migrator/ICrateMigrator.java @@ -30,6 +30,8 @@ public abstract class ICrateMigrator { protected final SettingsManager config = ConfigManager.getConfig(); + protected final SettingsManager messages = ConfigManager.getMessages(); + protected final FileManager fileManager = this.plugin.getFileManager(); protected final CommandSender sender; diff --git a/paper/src/main/java/com/badbones69/crazycrates/commands/crates/types/admin/crates/migrator/types/deprecation/LegacyColorMigrator.java b/paper/src/main/java/com/badbones69/crazycrates/commands/crates/types/admin/crates/migrator/types/deprecation/LegacyColorMigrator.java index 983f95e1a..a0d614b66 100644 --- a/paper/src/main/java/com/badbones69/crazycrates/commands/crates/types/admin/crates/migrator/types/deprecation/LegacyColorMigrator.java +++ b/paper/src/main/java/com/badbones69/crazycrates/commands/crates/types/admin/crates/migrator/types/deprecation/LegacyColorMigrator.java @@ -1,13 +1,16 @@ package com.badbones69.crazycrates.commands.crates.types.admin.crates.migrator.types.deprecation; +import com.badbones69.crazycrates.api.enums.Messages; import com.badbones69.crazycrates.api.utils.MiscUtils; import com.badbones69.crazycrates.commands.crates.types.admin.crates.migrator.ICrateMigrator; import com.badbones69.crazycrates.commands.crates.types.admin.crates.migrator.enums.MigrationType; +import com.badbones69.crazycrates.config.impl.ConfigKeys; import com.ryderbelserion.vital.paper.api.files.CustomFile; import org.bukkit.command.CommandSender; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -24,6 +27,28 @@ public void run() { final List failed = new ArrayList<>(); final List success = new ArrayList<>(); + this.config.setProperty(ConfigKeys.command_prefix, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(ConfigKeys.command_prefix)))); + this.config.setProperty(ConfigKeys.inventory_name, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(ConfigKeys.inventory_name)))); + + this.config.setProperty(ConfigKeys.menu_button_name, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(ConfigKeys.menu_button_name)))); + this.config.setProperty(ConfigKeys.menu_button_lore, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(ConfigKeys.menu_button_lore)))); + + this.config.setProperty(ConfigKeys.next_button_name, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(ConfigKeys.next_button_name)))); + this.config.setProperty(ConfigKeys.next_button_lore, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(ConfigKeys.next_button_lore)))); + + this.config.setProperty(ConfigKeys.back_button_name, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(ConfigKeys.back_button_name)))); + this.config.setProperty(ConfigKeys.back_button_lore, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(ConfigKeys.back_button_lore)))); + + this.config.setProperty(ConfigKeys.filler_name, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(ConfigKeys.filler_name)))); + this.config.setProperty(ConfigKeys.filler_lore, MiscUtils.fromComponent(MiscUtils.toComponent(this.config.getProperty(ConfigKeys.filler_lore)))); + + for (Messages message : Messages.values()) { + message.migrate(); + } + + this.config.reload(); + this.messages.reload(); + customFiles.forEach(customFile -> { try { final YamlConfiguration configuration = customFile.getConfiguration();