mirror of
				https://e.coding.net/circlecloud/Yum.git
				synced 2025-11-04 05:06:02 +00:00 
			
		
		
		
	use java8...
This commit is contained in:
		@@ -37,7 +37,7 @@ public class Yum extends JavaPlugin {
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void onLoad() {
 | 
			
		||||
		config = new FileConfig(this, "config.yml");
 | 
			
		||||
		config = new FileConfig(this);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@ import org.bukkit.command.CommandSender;
 | 
			
		||||
import org.bukkit.plugin.Plugin;
 | 
			
		||||
 | 
			
		||||
import cn.citycraft.Yum.Yum;
 | 
			
		||||
import cn.citycraft.Yum.manager.YumManager;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 插件安装命令类
 | 
			
		||||
@@ -30,37 +31,18 @@ public class CommandInstall extends BaseCommand {
 | 
			
		||||
	public void execute(final CommandSender sender, String label, final String[] args) throws CommandException {
 | 
			
		||||
		final String pluginname = args[0];
 | 
			
		||||
		Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
 | 
			
		||||
		if (plugin == null) {
 | 
			
		||||
			Bukkit.getScheduler().runTaskAsynchronously(main, new Runnable() {
 | 
			
		||||
				@Override
 | 
			
		||||
				public void run() {
 | 
			
		||||
 | 
			
		||||
				}
 | 
			
		||||
		if (plugin == null)
 | 
			
		||||
			Bukkit.getScheduler().runTaskAsynchronously(main, () -> {
 | 
			
		||||
				if (args.length < 2)
 | 
			
		||||
					YumManager.install(sender, pluginname);
 | 
			
		||||
				else
 | 
			
		||||
					YumManager.install(sender, pluginname, args[1]);
 | 
			
		||||
			});
 | 
			
		||||
		} else {
 | 
			
		||||
		else
 | 
			
		||||
			sender.sendMessage("§c插件已安装在服务器 需要更新请使用yum update " + pluginname + "!");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	// public static boolean installFromYum(CommandSender sender, String
 | 
			
		||||
	// filename) {
 | 
			
		||||
	// if (sender == null) {
 | 
			
		||||
	// sender = Bukkit.getConsoleSender();
 | 
			
		||||
	// }
 | 
			
		||||
	// File file = new File("plugins/YumCenter", filename + ".jar");
 | 
			
		||||
	// if (!file.exists()) {
 | 
			
		||||
	// sender.sendMessage("§4错误: §c仓库不存在 " + filename + " 插件!");
 | 
			
		||||
	// return false;
 | 
			
		||||
	// }
 | 
			
		||||
	// File pluginfile = new File("plugins", filename + ".jar");
 | 
			
		||||
	// FileUtil.copyFile(file, pluginfile);
 | 
			
		||||
	// if (PluginsManager.load(sender, filename + ".jar")) {
 | 
			
		||||
	// sender.sendMessage("§6安装: §a从Yum仓库安装插件 " + filename + " 成功!");
 | 
			
		||||
	// }
 | 
			
		||||
	// return false;
 | 
			
		||||
	// }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public int getMinimumArguments() {
 | 
			
		||||
		return 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -30,19 +30,15 @@ public class CommandUpdate extends BaseCommand {
 | 
			
		||||
		final String pluginname = args[0];
 | 
			
		||||
		final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
 | 
			
		||||
		sender.sendMessage("§a开始更新插件: " + pluginname);
 | 
			
		||||
		if (plugin != null) {
 | 
			
		||||
			Bukkit.getScheduler().runTaskAsynchronously(main, new Runnable() {
 | 
			
		||||
				@Override
 | 
			
		||||
				public void run() {
 | 
			
		||||
					if (args.length < 2)
 | 
			
		||||
						YumManager.update(sender, plugin);
 | 
			
		||||
					else
 | 
			
		||||
						YumManager.update(sender, plugin, args[1]);
 | 
			
		||||
				}
 | 
			
		||||
		if (plugin != null)
 | 
			
		||||
			Bukkit.getScheduler().runTaskAsynchronously(main, () -> {
 | 
			
		||||
				if (args.length < 2)
 | 
			
		||||
					YumManager.update(sender, plugin);
 | 
			
		||||
				else
 | 
			
		||||
					YumManager.update(sender, plugin, args[1]);
 | 
			
		||||
			});
 | 
			
		||||
		} else {
 | 
			
		||||
		else
 | 
			
		||||
			sender.sendMessage("§c插件未安装或已卸载 需要安装请使用yum install " + pluginname + "!");
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user