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