perf: 优化代码
This commit is contained in:
@@ -27,7 +27,7 @@ public final class CoreBungeeAPI extends CoreAPI {
|
||||
Configuration config = CoreBungeeCordUtils.getPluginConfig(plugin);
|
||||
Configuration datasourceConfig = config.getSection("datasource");
|
||||
if (datasourceConfig == null) {
|
||||
throw new IllegalArgumentException("配置文件中未找到 datasource 节点!");
|
||||
throw new IllegalArgumentException("配置文件中未找到 datasource 节点");
|
||||
}
|
||||
|
||||
HikariConfig hikariConfig = new HikariConfig();
|
||||
|
@@ -19,7 +19,7 @@ public final class CoreBungeeCordUtils {
|
||||
@NotNull
|
||||
public static Configuration getConfig(@NotNull File file) {
|
||||
if (!file.exists()) {
|
||||
throw new IllegalArgumentException("文件不存在!");
|
||||
throw new IllegalArgumentException("文件不存在");
|
||||
}
|
||||
try {
|
||||
return ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);
|
||||
@@ -57,7 +57,7 @@ public final class CoreBungeeCordUtils {
|
||||
@NotNull
|
||||
public static Configuration saveDefaultConfig(@NotNull Plugin plugin) {
|
||||
if (plugin.getDataFolder().mkdir()) {
|
||||
plugin.getLogger().info("已生成插件存档文件夹...");
|
||||
plugin.getLogger().info("已生成插件存档文件夹");
|
||||
}
|
||||
File configFile = new File(plugin.getDataFolder(), "config.yml");
|
||||
try {
|
||||
@@ -72,7 +72,7 @@ public final class CoreBungeeCordUtils {
|
||||
@NotNull
|
||||
public static Configuration saveDefaultConfig(@NotNull Plugin plugin, @NotNull String filename) {
|
||||
if (plugin.getDataFolder().mkdir()) {
|
||||
plugin.getLogger().info("已生成插件存档文件夹...");
|
||||
plugin.getLogger().info("已生成插件存档文件夹");
|
||||
}
|
||||
File configFile = new File(plugin.getDataFolder(), filename);
|
||||
try {
|
||||
|
Reference in New Issue
Block a user