类 ModuleUtil


  • public class ModuleUtil
    extends java.lang.Object
    模块工具类
    作者:
    FzmXer 2023年02月03日 20时59分
    • 构造器概要

      构造器 
      构造器 说明
      ModuleUtil()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static double download​(@NotNull java.lang.String urlStr, @NotNull java.io.File dir)
      远程下载
      static RedisBase getRedisBase​(YamlBase base, java.lang.String root)
      加载Redis
      static java.io.InputStream getResource​(@NotNull BootModule module, @NotNull java.lang.String fileName)
      从模块中获取文件输入流
      static java.io.InputStream getResource​(@NotNull java.io.File file, @NotNull java.lang.String fileName)
      从模块中获取文件输入流
      static boolean hasJarFile​(BootModule module, java.lang.String fileName)
      Jar中是否存在该文件
      static boolean hasJarFile​(java.io.File file, java.lang.String fileName)
      Jar中是否存在该文件
      static boolean loadBootModule​(BootModule module)
      加载模块(PlugManX)
      static boolean loadBootModule​(java.lang.String moduleName)
      加载模块(PlugManX)
      static void loadBootModules()
      加载Module目录下所有模块
      static RedisBase loadRedis​(BootModule module)
      加载Redis(使用默认文件)
      static RedisBase loadRedis​(BootModule module, java.lang.String path, java.lang.String fileName, java.lang.String root)
      加载Redis
      static StorageBase loadStorage​(BootModule module)
      加载数据源(使用默认文件)
      static StorageBase loadStorage​(BootModule module, java.lang.String path, java.lang.String fileName, java.lang.String root)
      加载数据源
      static com.google.gson.JsonObject readGson​(@NotNull BootModule module, java.lang.String path, @NotNull java.lang.String fileName)
      读取Json文件
      static com.google.gson.JsonArray readGsonArr​(@NotNull BootModule module, java.lang.String path, @NotNull java.lang.String fileName)
      读取Json文件
      static YamlBase readJarYml​(BootModule module, java.lang.String fileName)
      从Jar中读取.yml文件
      static YamlBase readJarYml​(java.io.File file, java.lang.String fileName)
      从Jar中读取.yml文件
      static YamlBase readJarYml​(org.bukkit.plugin.Plugin plugin, java.lang.String fileName)
      从Jar中读取.yml文件
      static com.alibaba.fastjson2.JSONObject readJson​(@NotNull BootModule module, java.lang.String path, @NotNull java.lang.String fileName)
      读取Json文件
      static com.alibaba.fastjson2.JSONArray readJsonArr​(@NotNull BootModule module, java.lang.String path, @NotNull java.lang.String fileName)
      读取Json文件
      static YamlBase readYaml​(@NotNull BootModule module, java.lang.String path, @NotNull java.lang.String fileName)
      读取Yaml文件
      static YamlBase readYaml​(@NotNull org.bukkit.plugin.Plugin plugin, java.lang.String path, @NotNull java.lang.String fileName)
      读取Yaml文件
      static void reloadBootModule​(BootModule module)
      重载模块
      static boolean saveConfig​(@NotNull BootModule module, @NotNull java.lang.String filePath, @NotNull java.lang.String fileName)
      保存配置文件
      static boolean saveConfig​(org.bukkit.plugin.Plugin plugin, @NotNull BootModule module, @NotNull java.lang.String filePath, @NotNull java.lang.String fileName)
      保存配置文件
      static boolean unloadBootModule​(BootModule module)
      卸载模块
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • ModuleUtil

        public ModuleUtil()
    • 方法详细资料

      • download

        public static double download​(@NotNull
                                      @NotNull java.lang.String urlStr,
                                      @NotNull
                                      @NotNull java.io.File dir)
        远程下载
        参数:
        urlStr - 下载链接
        dir - 下载到文件夹
        返回:
        时间戳
      • readYaml

        public static YamlBase readYaml​(@NotNull
                                        @NotNull BootModule module,
                                        java.lang.String path,
                                        @NotNull
                                        @NotNull java.lang.String fileName)
        读取Yaml文件
        参数:
        module - 模块
        path - 路径
        fileName - 文件名
        返回:
        YamlBase
      • readYaml

        public static YamlBase readYaml​(@NotNull
                                        @NotNull org.bukkit.plugin.Plugin plugin,
                                        java.lang.String path,
                                        @NotNull
                                        @NotNull java.lang.String fileName)
        读取Yaml文件
        参数:
        plugin - 插件
        path - 路径
        fileName - 文件名
        返回:
        YamlBase
      • readGson

        public static com.google.gson.JsonObject readGson​(@NotNull
                                                          @NotNull BootModule module,
                                                          java.lang.String path,
                                                          @NotNull
                                                          @NotNull java.lang.String fileName)
        读取Json文件
        参数:
        module - 模块
        path - 路径
        fileName - 文件名
        返回:
        JsonObject
      • readGsonArr

        public static com.google.gson.JsonArray readGsonArr​(@NotNull
                                                            @NotNull BootModule module,
                                                            java.lang.String path,
                                                            @NotNull
                                                            @NotNull java.lang.String fileName)
        读取Json文件
        参数:
        module - 模块
        path - 路径
        fileName - 文件名
        返回:
        JsonArray
      • readJson

        public static com.alibaba.fastjson2.JSONObject readJson​(@NotNull
                                                                @NotNull BootModule module,
                                                                java.lang.String path,
                                                                @NotNull
                                                                @NotNull java.lang.String fileName)
        读取Json文件
        参数:
        module - 模块
        path - 路径
        fileName - 文件名
        返回:
        JSONObject
      • readJsonArr

        public static com.alibaba.fastjson2.JSONArray readJsonArr​(@NotNull
                                                                  @NotNull BootModule module,
                                                                  java.lang.String path,
                                                                  @NotNull
                                                                  @NotNull java.lang.String fileName)
        读取Json文件
        参数:
        module - 模块
        path - 路径
        fileName - 文件名
        返回:
        JSONArray
      • saveConfig

        public static boolean saveConfig​(@NotNull
                                         @NotNull BootModule module,
                                         @NotNull
                                         @NotNull java.lang.String filePath,
                                         @NotNull
                                         @NotNull java.lang.String fileName)
        保存配置文件
        参数:
        module - 模块
        filePath - 输出目录
        fileName - 文件名
        返回:
        是否成功
      • saveConfig

        public static boolean saveConfig​(org.bukkit.plugin.Plugin plugin,
                                         @NotNull
                                         @NotNull BootModule module,
                                         @NotNull
                                         @NotNull java.lang.String filePath,
                                         @NotNull
                                         @NotNull java.lang.String fileName)
        保存配置文件
        参数:
        plugin - 插件
        module - 模块
        filePath - 输出目录
        fileName - 文件名
        返回:
        是否成功
      • readJarYml

        public static YamlBase readJarYml​(org.bukkit.plugin.Plugin plugin,
                                          java.lang.String fileName)
        从Jar中读取.yml文件
        参数:
        plugin - 插件
        fileName - 文件名
        返回:
        YamlBase
      • readJarYml

        public static YamlBase readJarYml​(BootModule module,
                                          java.lang.String fileName)
        从Jar中读取.yml文件
        参数:
        module - 模块
        fileName - 文件名
        返回:
        YamlBase
      • readJarYml

        public static YamlBase readJarYml​(java.io.File file,
                                          java.lang.String fileName)
        从Jar中读取.yml文件
        参数:
        file - 文件
        fileName - 文件名
        返回:
        YamlBase
      • hasJarFile

        public static boolean hasJarFile​(java.io.File file,
                                         java.lang.String fileName)
        Jar中是否存在该文件
        参数:
        file - 文件
        fileName - 文件名
        返回:
        存在返回true
      • hasJarFile

        public static boolean hasJarFile​(BootModule module,
                                         java.lang.String fileName)
        Jar中是否存在该文件
        参数:
        module - 模块
        fileName - 文件名
        返回:
        存在返回true
      • getResource

        public static java.io.InputStream getResource​(@NotNull
                                                      @NotNull java.io.File file,
                                                      @NotNull
                                                      @NotNull java.lang.String fileName)
        从模块中获取文件输入流
        参数:
        file - 文件
        fileName - 文件名
        返回:
        InputStream
      • getResource

        public static java.io.InputStream getResource​(@NotNull
                                                      @NotNull BootModule module,
                                                      @NotNull
                                                      @NotNull java.lang.String fileName)
        从模块中获取文件输入流
        参数:
        module - 模块
        fileName - 文件名
        返回:
        InputStream
      • loadStorage

        public static StorageBase loadStorage​(BootModule module)
        加载数据源(使用默认文件)
        参数:
        module - 模块
        返回:
        StorageBase
      • loadStorage

        public static StorageBase loadStorage​(BootModule module,
                                              java.lang.String path,
                                              java.lang.String fileName,
                                              java.lang.String root)
        加载数据源
        参数:
        module - 模块
        path - 路径
        fileName - 文件名
        root - 根
        返回:
        StorageBase
      • loadRedis

        public static RedisBase loadRedis​(BootModule module)
        加载Redis(使用默认文件)
        参数:
        module - 模块
        返回:
        RedisBase
      • loadRedis

        public static RedisBase loadRedis​(BootModule module,
                                          java.lang.String path,
                                          java.lang.String fileName,
                                          java.lang.String root)
        加载Redis
        参数:
        module - 模块
        path - 路径
        fileName - 配置文件名
        root - 根节点
        返回:
        RedisBase
      • getRedisBase

        public static RedisBase getRedisBase​(YamlBase base,
                                             java.lang.String root)
        加载Redis
        参数:
        base - 配置文件
        root - 根节点(可空)
        返回:
        RedisBase
      • loadBootModule

        public static boolean loadBootModule​(java.lang.String moduleName)
        加载模块(PlugManX)
        参数:
        moduleName - 模块名
        返回:
        boolean
      • loadBootModule

        public static boolean loadBootModule​(BootModule module)
        加载模块(PlugManX)
        参数:
        module - 模块
        返回:
        boolean
      • loadBootModules

        public static void loadBootModules()
        加载Module目录下所有模块
      • reloadBootModule

        public static void reloadBootModule​(BootModule module)
        重载模块
        参数:
        module - 模块
      • unloadBootModule

        public static boolean unloadBootModule​(BootModule module)
        卸载模块
        参数:
        module - 模块
        返回:
        boolean