mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-12-22 20:58:47 +00:00
feat: 添加源错误提示
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
e4e0c5509f
commit
10bdef4763
@ -12,7 +12,6 @@ import java.util.Map.Entry;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import cn.citycraft.PluginHelper.PluginHelperLogger;
|
||||
import cn.citycraft.PluginHelper.jsonresult.JsonHandle;
|
||||
import cn.citycraft.PluginHelper.kit.HttpKit;
|
||||
import cn.citycraft.PluginHelper.kit.StrKit;
|
||||
@ -32,7 +31,6 @@ import pw.yumc.Yum.models.RepoSerialization.URLType;
|
||||
* @since 2016年1月9日 上午10:02:57
|
||||
*/
|
||||
public class RepositoryManager {
|
||||
PluginHelperLogger logger = PluginHelperLogger.getLogger();
|
||||
org.bukkit.plugin.Plugin main;
|
||||
RepoCache repocache;
|
||||
|
||||
@ -207,7 +205,7 @@ public class RepositoryManager {
|
||||
sender = Bukkit.getConsoleSender();
|
||||
}
|
||||
if (repocenter == null || repocenter.repos.isEmpty()) {
|
||||
logger.debug("源地址为Null或源列表为空!");
|
||||
sender.sendMessage("源地址为Null或源列表为空!");
|
||||
return false;
|
||||
}
|
||||
for (final Repository repo : repocenter.repos) {
|
||||
|
@ -7,13 +7,12 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import cn.citycraft.PluginHelper.PluginHelperLogger;
|
||||
import cn.citycraft.PluginHelper.jsonresult.JsonHandle;
|
||||
import cn.citycraft.PluginHelper.kit.PluginKit;
|
||||
import cn.citycraft.PluginHelper.utils.IOUtil;
|
||||
import pw.yumc.Yum.models.RepoSerialization.Repositories;
|
||||
|
||||
public class RepoCache implements Serializable {
|
||||
PluginHelperLogger logger = PluginHelperLogger.getLogger();
|
||||
Map<String, PluginInfo> plugins = new HashMap<String, PluginInfo>();
|
||||
Map<String, Repositories> repos = new HashMap<String, Repositories>();
|
||||
|
||||
@ -27,7 +26,6 @@ public class RepoCache implements Serializable {
|
||||
|
||||
public Repositories addRepo(final String repo) {
|
||||
if (repos.containsKey(repo) || repo.isEmpty()) {
|
||||
logger.debug("源地址为空或已存在 " + repo);
|
||||
return null;
|
||||
}
|
||||
final Repositories reposes = getRepo(repo);
|
||||
@ -53,12 +51,12 @@ public class RepoCache implements Serializable {
|
||||
public Repositories getRepo(final String repo) {
|
||||
final String json = IOUtil.getData(repo);
|
||||
if (json == null || json.isEmpty()) {
|
||||
logger.debug("源地址获取数据为空 " + repo);
|
||||
PluginKit.sc("§c源地址获取数据为空 §b" + repo);
|
||||
return null;
|
||||
}
|
||||
final Repositories reposes = JsonHandle.fromJson(json, Repositories.class);
|
||||
if (reposes == null || reposes.repos.isEmpty()) {
|
||||
logger.debug("源地址解析Json为空 " + repo);
|
||||
PluginKit.sc("§c源地址解析Json为空 §b" + repo);
|
||||
return null;
|
||||
}
|
||||
return reposes;
|
||||
|
Loading…
Reference in New Issue
Block a user