mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-12-25 07:08:52 +00:00
feat: 移除RemoteConfig
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
24b81e5f00
commit
76166e88e4
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>pw.yumc</groupId>
|
||||
<artifactId>YumCore</artifactId>
|
||||
<version>1.8.1</version>
|
||||
<version>1.8.2</version>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
|
@ -1,60 +0,0 @@
|
||||
package pw.yumc.YumCore.config.ext;
|
||||
|
||||
import pw.yumc.YumCore.bukkit.Log;
|
||||
import pw.yumc.YumCore.config.FileConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* 远程配置文件类
|
||||
*
|
||||
* @since 2016年2月22日 上午8:33:51
|
||||
* @author 喵♂呜
|
||||
*/
|
||||
public class RemoteConfig extends FileConfig {
|
||||
public RemoteConfig(String url) throws IOException {
|
||||
this(new URL(url));
|
||||
}
|
||||
|
||||
public RemoteConfig(URL url) throws IOException {
|
||||
super(url.openStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得配置文件(错误返回null)
|
||||
*
|
||||
* @param url
|
||||
* 配置文件地址
|
||||
* @return {@link FileConfig}
|
||||
*/
|
||||
public static FileConfig getConfig(String url) {
|
||||
try {
|
||||
return new RemoteConfig(url);
|
||||
} catch (IOException e) {
|
||||
Log.d("获取远程配置文件失败!", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得Yaml文件标签信息
|
||||
*
|
||||
* @param url
|
||||
* XML文件地址
|
||||
* @param tag
|
||||
* 信息标签
|
||||
* @param def
|
||||
* 默认值
|
||||
* @return 插件信息
|
||||
*/
|
||||
public static String getYamlTag(String url, String tag, String def) {
|
||||
String result = def;
|
||||
FileConfig config = getConfig(url);
|
||||
if (config != null) {
|
||||
result = config.getString(tag);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package pw.yumc.YumCore.config.ext;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
import pw.yumc.YumCore.bukkit.Log;
|
||||
import pw.yumc.YumCore.config.FileConfig;
|
||||
@ -39,7 +40,7 @@ public class YumConfig {
|
||||
public static FileConfig getRemote(String configname) {
|
||||
FileConfig config;
|
||||
try {
|
||||
config = new RemoteConfig(REMOTEFILECENTER + configname);
|
||||
config = new FileConfig(new URL(REMOTEFILECENTER + configname).openStream());
|
||||
config.save(new File(CacheFolder, configname));
|
||||
Log.i(fromYumc, configname);
|
||||
} catch (IOException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user