Class ConfigEditorUtils

java.lang.Object
com.ultikits.ultitools.utils.ConfigEditorUtils

public class ConfigEditorUtils extends Object
Utility class for configuration editor operations. Provides methods to get and update configuration data in JSON format. This class is used internally by the configuration editor system.
配置编辑器操作的实用工具类。 提供以JSON格式获取和更新配置数据的方法。 此类由配置编辑器系统内部使用。
Since:
6.0.0
Author:
wisdomme
  • Constructor Details

    • ConfigEditorUtils

      public ConfigEditorUtils()
  • Method Details

    • getConfigMapString

      protected static String getConfigMapString()
      Get the configuration map as a JSON string.
      获取配置映射的JSON字符串。
      Returns:
      JSON string representation of the configuration map
      配置映射的JSON字符串表示
    • getCommentMapString

      protected static String getCommentMapString()
      Get the comment map as a JSON string.
      获取注释映射的JSON字符串。
      Returns:
      JSON string representation of the comment map
      注释映射的JSON字符串表示
    • updateConfigMap

      protected static void updateConfigMap(String configMapString) throws IOException
      Update the configuration map from a JSON string.
      从JSON字符串更新配置映射。
      Parameters:
      configMapString - JSON string containing the new configuration
      包含新配置的JSON字符串
      Throws:
      IOException - if an I/O error occurs during update
      如果更新过程中发生I/O错误
    • updateConfigMap

      protected static void updateConfigMap(String fileName, String configMapString) throws IOException
      Update a single configuration file from a JSON string.
      从JSON字符串更新单个配置文件。

      面板按文件名下发配置时走这条:configMapString 是该文件自己的 {配置项: 值},而不是 updateConfigMap(String) 那种 {插件名: {配置路径: {...}}} 的全量结构。两种形状对应面板上两个不同的入口, 混用会写不进去且不报错——见 issue #236。

      Parameters:
      fileName - config file path as registered, e.g. config/lang.yml
      注册时使用的配置文件路径
      configMapString - JSON string containing that file's entries
      该文件配置项的JSON字符串
      Throws:
      IOException - if the file is unknown or ambiguous, or the update fails
      如果文件找不到、跨插件重名或更新失败
      Since:
      6.2.5