feat: 移除RemoteConfig

Signed-off-by: 502647092 <admin@yumc.pw>
merge/6/HEAD
502647092 2017-07-29 14:52:00 +08:00
parent 24b81e5f00
commit 76166e88e4
3 changed files with 3 additions and 62 deletions

View File

@ -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>

View File

@ -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 2016222 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;
}
}

View File

@ -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) {