mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-12-23 05:08:47 +00:00
refactor: 调整项目包结构
This commit is contained in:
parent
d298c2c6a6
commit
fe04035658
@ -13,8 +13,8 @@ import pw.yumc.Yum.api.YumAPI;
|
||||
import pw.yumc.Yum.commands.FileCommand;
|
||||
import pw.yumc.Yum.commands.NetCommand;
|
||||
import pw.yumc.Yum.commands.YumCommand;
|
||||
import pw.yumc.Yum.listeners.SecurityListener;
|
||||
import pw.yumc.Yum.manager.NetworkManager;
|
||||
import pw.yumc.Yum.manager.SecurityManager;
|
||||
|
||||
/**
|
||||
* MC插件仓库
|
||||
@ -42,7 +42,7 @@ public class Yum extends JavaPlugin {
|
||||
new YumCommand(this);
|
||||
new NetCommand(this);
|
||||
new FileCommand(this);
|
||||
new SecurityManager(this);
|
||||
new SecurityListener(this);
|
||||
new VersionChecker(this);
|
||||
YumAPI.updaterepo(Bukkit.getConsoleSender());
|
||||
YumAPI.updatecheck(Bukkit.getConsoleSender());
|
||||
|
@ -12,9 +12,9 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import cn.citycraft.CommonData.UpdatePlugin;
|
||||
import pw.yumc.Yum.manager.DownloadManager;
|
||||
import pw.yumc.Yum.manager.PluginInfo;
|
||||
import pw.yumc.Yum.manager.PluginsManager;
|
||||
import pw.yumc.Yum.manager.RepositoryManager;
|
||||
import pw.yumc.Yum.manager.module.PluginInfo;
|
||||
|
||||
/**
|
||||
* Yum管理中心
|
||||
|
@ -25,8 +25,8 @@ import cn.citycraft.PluginHelper.utils.StringUtil;
|
||||
import pw.yumc.Yum.Yum;
|
||||
import pw.yumc.Yum.api.YumAPI;
|
||||
import pw.yumc.Yum.manager.PluginsManager;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.Repositories;
|
||||
import pw.yumc.Yum.manager.RepositoryManager;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.Repositories;
|
||||
|
||||
/**
|
||||
* Yum命令基类
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pw.yumc.Yum.manager;
|
||||
package pw.yumc.Yum.listeners;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -14,11 +14,11 @@ import pw.yumc.injected.event.SetOpEvent;
|
||||
* @since 2016年3月31日 下午3:01:22
|
||||
* @author 喵♂呜
|
||||
*/
|
||||
public class SecurityManager implements Listener {
|
||||
public class SecurityListener implements Listener {
|
||||
public String warn = "§6[§bYum §a安全系统§6] §c插件 §e%s §c已设置玩家 §a%s §c为OP §4请注意服务器安全!";
|
||||
public String prevent = "§6[§bYum §a安全系统§6] §c黑名单插件 §e%s §c尝试设置玩家 §a%s §c为OP §a安全系统已成功拦截!";
|
||||
|
||||
public SecurityManager(final Yum yum) {
|
||||
public SecurityListener(final Yum yum) {
|
||||
Bukkit.getPluginManager().registerEvents(this, yum);
|
||||
}
|
||||
|
@ -14,14 +14,16 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import cn.citycraft.PluginHelper.PluginHelperLogger;
|
||||
import cn.citycraft.PluginHelper.jsonresult.JsonHandle;
|
||||
import cn.citycraft.PluginHelper.utils.IOUtil;
|
||||
import cn.citycraft.PluginHelper.utils.StringUtil;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.PackageInfo;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.Plugin;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.Repositories;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.Repository;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.TagInfo;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.URLType;
|
||||
import cn.citycraft.PluginHelper.kit.HttpKit;
|
||||
import cn.citycraft.PluginHelper.kit.StrKit;
|
||||
import pw.yumc.Yum.manager.module.PluginInfo;
|
||||
import pw.yumc.Yum.manager.module.RepoCache;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.PackageInfo;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.Plugin;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.Repositories;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.Repository;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.TagInfo;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.URLType;
|
||||
|
||||
/**
|
||||
* 仓库管理类
|
||||
@ -40,7 +42,7 @@ public class RepositoryManager {
|
||||
}
|
||||
|
||||
public boolean addPackage(final CommandSender sender, final String urlstring) {
|
||||
final String json = IOUtil.getData(urlstring);
|
||||
final String json = HttpKit.get(urlstring);
|
||||
if (json == null || json.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@ -135,7 +137,7 @@ public class RepositoryManager {
|
||||
}
|
||||
|
||||
public Repositories getRepoCache(final String urlstring) {
|
||||
return repocache.repos.get(handerRepoUrl(urlstring));
|
||||
return repocache.getRepos().get(handerRepoUrl(urlstring));
|
||||
}
|
||||
|
||||
public Map<String, Repositories> getRepos() {
|
||||
@ -168,10 +170,10 @@ public class RepositoryManager {
|
||||
public void updatePackage(final CommandSender sender, final PackageInfo pkg) {
|
||||
for (final Plugin plugin : pkg.plugins) {
|
||||
final PluginInfo pi = new PluginInfo();
|
||||
pi.name = StringUtil.getNotNull(plugin.name, plugin.artifactId);
|
||||
pi.branch = StringUtil.getNotNull(plugin.branch, "master");
|
||||
pi.pom = StringUtil.getNotNull(plugin.pom, pkg.pom);
|
||||
pi.url = StringUtil.getNotNull(plugin.url, pkg.url);
|
||||
pi.name = StrKit.getNotNull(plugin.name, plugin.artifactId);
|
||||
pi.branch = StrKit.getNotNull(plugin.branch, "master");
|
||||
pi.pom = StrKit.getNotNull(plugin.pom, pkg.pom);
|
||||
pi.url = StrKit.getNotNull(plugin.url, pkg.url);
|
||||
pi.type = plugin.type != null ? plugin.type : pkg.type;
|
||||
pi.type = pi.type != null ? pi.type : URLType.Maven;
|
||||
pi.plugin = plugin;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package pw.yumc.Yum.manager;
|
||||
package pw.yumc.Yum.manager.module;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -7,9 +7,9 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import cn.citycraft.PluginHelper.PluginHelperLogger;
|
||||
import cn.citycraft.PluginHelper.utils.IOUtil;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.Plugin;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.TagInfo;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.URLType;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.Plugin;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.TagInfo;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.URLType;
|
||||
|
||||
public class PluginInfo implements Serializable {
|
||||
public static final String NMSVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
|
@ -1,4 +1,4 @@
|
||||
package pw.yumc.Yum.manager;
|
||||
package pw.yumc.Yum.manager.module;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@ -10,7 +10,7 @@ import java.util.Map.Entry;
|
||||
import cn.citycraft.PluginHelper.PluginHelperLogger;
|
||||
import cn.citycraft.PluginHelper.jsonresult.JsonHandle;
|
||||
import cn.citycraft.PluginHelper.utils.IOUtil;
|
||||
import pw.yumc.Yum.manager.RepoSerialization.Repositories;
|
||||
import pw.yumc.Yum.manager.module.RepoSerialization.Repositories;
|
||||
|
||||
public class RepoCache implements Serializable {
|
||||
PluginHelperLogger logger = PluginHelperLogger.getLogger();
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package pw.yumc.Yum.manager;
|
||||
package pw.yumc.Yum.manager.module;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
Loading…
Reference in New Issue
Block a user