mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
fix updaterepos...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
b7c492c970
commit
5e487e769c
@ -48,7 +48,7 @@ public class RepositoryManager {
|
|||||||
plugins.clear();
|
plugins.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void updatePackage(Package pkg) {
|
public void updatePackage(Package pkg) {
|
||||||
for (Plugin plugin : pkg.plugins) {
|
for (Plugin plugin : pkg.plugins) {
|
||||||
PluginInfo pi = new PluginInfo();
|
PluginInfo pi = new PluginInfo();
|
||||||
pi.plugin = plugin;
|
pi.plugin = plugin;
|
||||||
@ -58,12 +58,12 @@ public class RepositoryManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void cacheToJson(FileConfiguration config) {
|
public void cacheToJson(FileConfiguration config) {
|
||||||
config.set("repocache", gson.toJson(repos));
|
config.set("repocache", gson.toJson(repos));
|
||||||
config.set("plugincache", gson.toJson(plugins));
|
config.set("plugincache", gson.toJson(plugins));
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean jsonToCache(FileConfiguration config) {
|
public boolean jsonToCache(FileConfiguration config) {
|
||||||
String repocache = config.getString("repocache");
|
String repocache = config.getString("repocache");
|
||||||
String plugincache = config.getString("plugincache");
|
String plugincache = config.getString("plugincache");
|
||||||
try {
|
try {
|
||||||
@ -79,10 +79,10 @@ public class RepositoryManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean updateRepositories(CommandSender sender) {
|
public boolean updateRepositories(CommandSender sender) {
|
||||||
plugins.clear();
|
plugins.clear();
|
||||||
for (String string : repos) {
|
for (String string : repos) {
|
||||||
if (addRepositories(string)) {
|
if (updateRepositories(string)) {
|
||||||
sender.sendMessage("§6源: §e" + string + " §a更新成功!");
|
sender.sendMessage("§6源: §e" + string + " §a更新成功!");
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("§6源: §e" + string + " §c更新失败!");
|
sender.sendMessage("§6源: §e" + string + " §c更新失败!");
|
||||||
@ -91,7 +91,12 @@ public class RepositoryManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean addRepositories(String urlstring) {
|
public boolean addRepositories(String urlstring) {
|
||||||
|
repos.add(urlstring);
|
||||||
|
return updateRepositories(urlstring);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateRepositories(String urlstring) {
|
||||||
String json = getHtml(urlstring);
|
String json = getHtml(urlstring);
|
||||||
if (json == "") {
|
if (json == "") {
|
||||||
return false;
|
return false;
|
||||||
@ -103,11 +108,10 @@ public class RepositoryManager {
|
|||||||
for (Repository repository : lrepo) {
|
for (Repository repository : lrepo) {
|
||||||
addPackage(repository.url);
|
addPackage(repository.url);
|
||||||
}
|
}
|
||||||
repos.add(urlstring);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized boolean addPackage(String urlstring) {
|
public boolean addPackage(String urlstring) {
|
||||||
String json = getHtml(urlstring);
|
String json = getHtml(urlstring);
|
||||||
if (json == "") {
|
if (json == "") {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user