2015-08-22 07:13:59 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package cn.citycraft.Yum.commands;
|
|
|
|
|
2015-08-31 13:28:02 +00:00
|
|
|
import org.bukkit.Bukkit;
|
2015-09-29 12:44:17 +00:00
|
|
|
import org.bukkit.command.Command;
|
2015-08-22 07:13:59 +00:00
|
|
|
import org.bukkit.command.CommandException;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
|
2015-09-29 12:44:17 +00:00
|
|
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
2015-08-22 07:13:59 +00:00
|
|
|
import cn.citycraft.Yum.Yum;
|
2015-11-25 07:34:35 +00:00
|
|
|
import cn.citycraft.Yum.api.YumAPI;
|
2015-08-22 07:13:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 插件删除命令类
|
2015-08-23 13:38:32 +00:00
|
|
|
*
|
2015-08-22 07:13:59 +00:00
|
|
|
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
|
|
|
*/
|
2015-08-24 12:49:31 +00:00
|
|
|
public class CommandDelete extends BaseCommand {
|
2015-08-31 13:28:02 +00:00
|
|
|
Yum main;
|
2015-08-22 07:13:59 +00:00
|
|
|
|
2015-09-24 11:02:44 +00:00
|
|
|
public CommandDelete(final Yum main) {
|
2015-12-06 09:29:10 +00:00
|
|
|
super("d");
|
2015-08-31 13:28:02 +00:00
|
|
|
this.main = main;
|
2015-09-22 12:03:59 +00:00
|
|
|
setMinimumArguments(1);
|
2015-09-29 12:44:17 +00:00
|
|
|
setDescription("删除插件");
|
2015-09-22 12:03:59 +00:00
|
|
|
setPossibleArguments("<插件名称>");
|
2015-08-22 07:13:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-09-29 12:44:17 +00:00
|
|
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
2015-09-24 11:02:44 +00:00
|
|
|
final String pluginname = args[0];
|
|
|
|
final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
|
|
|
|
if (plugin != null) {
|
2015-11-29 07:20:34 +00:00
|
|
|
final String version = plugin.getDescription().getVersion();
|
2015-11-26 11:52:08 +00:00
|
|
|
if (YumAPI.getPlugman().deletePlugin(sender, plugin)) {
|
2015-11-29 07:20:34 +00:00
|
|
|
sender.sendMessage("§c删除: §a插件 §6" + pluginname + " §a版本 §d" + version + " §a已从服务器卸载并删除!");
|
2015-09-24 11:02:44 +00:00
|
|
|
} else {
|
2015-09-21 07:18:03 +00:00
|
|
|
sender.sendMessage("§c删除: §c插件 " + pluginname + " 卸载或删除时发生错误 删除失败!");
|
2015-09-24 11:02:44 +00:00
|
|
|
}
|
|
|
|
} else {
|
2015-08-22 07:13:59 +00:00
|
|
|
sender.sendMessage("§c插件 " + pluginname + " 不存在或已卸载!");
|
2015-09-24 11:02:44 +00:00
|
|
|
}
|
2015-09-29 12:44:17 +00:00
|
|
|
}
|
2015-08-22 07:13:59 +00:00
|
|
|
}
|