类 ModuleUtil
- java.lang.Object
-
- cn.fxcraft.module.ModuleUtil
-
public class ModuleUtil extends java.lang.Object模块工具类- 作者:
- FzmXer 2023年02月03日 20时59分
-
-
构造器概要
构造器 构造器 说明 ModuleUtil()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static doubledownload(@NotNull java.lang.String urlStr, @NotNull java.io.File dir)远程下载static RedisBasegetRedisBase(YamlBase base, java.lang.String root)加载Redisstatic java.io.InputStreamgetResource(@NotNull BootModule module, @NotNull java.lang.String fileName)从模块中获取文件输入流static java.io.InputStreamgetResource(@NotNull java.io.File file, @NotNull java.lang.String fileName)从模块中获取文件输入流static booleanhasJarFile(BootModule module, java.lang.String fileName)Jar中是否存在该文件static booleanhasJarFile(java.io.File file, java.lang.String fileName)Jar中是否存在该文件static booleanloadBootModule(BootModule module)加载模块(PlugManX)static booleanloadBootModule(java.lang.String moduleName)加载模块(PlugManX)static voidloadBootModules()加载Module目录下所有模块static RedisBaseloadRedis(BootModule module)加载Redis(使用默认文件)static RedisBaseloadRedis(BootModule module, java.lang.String path, java.lang.String fileName, java.lang.String root)加载Redisstatic StorageBaseloadStorage(BootModule module)加载数据源(使用默认文件)static StorageBaseloadStorage(BootModule module, java.lang.String path, java.lang.String fileName, java.lang.String root)加载数据源static com.google.gson.JsonObjectreadGson(@NotNull BootModule module, java.lang.String path, @NotNull java.lang.String fileName)读取Json文件static com.google.gson.JsonArrayreadGsonArr(@NotNull BootModule module, java.lang.String path, @NotNull java.lang.String fileName)读取Json文件static YamlBasereadJarYml(BootModule module, java.lang.String fileName)从Jar中读取.yml文件static YamlBasereadJarYml(java.io.File file, java.lang.String fileName)从Jar中读取.yml文件static YamlBasereadJarYml(org.bukkit.plugin.Plugin plugin, java.lang.String fileName)从Jar中读取.yml文件static com.alibaba.fastjson2.JSONObjectreadJson(@NotNull BootModule module, java.lang.String path, @NotNull java.lang.String fileName)读取Json文件static com.alibaba.fastjson2.JSONArrayreadJsonArr(@NotNull BootModule module, java.lang.String path, @NotNull java.lang.String fileName)读取Json文件static YamlBasereadYaml(@NotNull BootModule module, java.lang.String path, @NotNull java.lang.String fileName)读取Yaml文件static YamlBasereadYaml(@NotNull org.bukkit.plugin.Plugin plugin, java.lang.String path, @NotNull java.lang.String fileName)读取Yaml文件static voidreloadBootModule(BootModule module)重载模块static booleansaveConfig(@NotNull BootModule module, @NotNull java.lang.String filePath, @NotNull java.lang.String fileName)保存配置文件static booleansaveConfig(org.bukkit.plugin.Plugin plugin, @NotNull BootModule module, @NotNull java.lang.String filePath, @NotNull java.lang.String fileName)保存配置文件static booleanunloadBootModule(BootModule module)卸载模块
-
-
-
方法详细资料
-
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
-
-