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-08-22 07:13:59 +00:00
|
|
|
import org.bukkit.command.CommandException;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
|
|
|
|
import cn.citycraft.Yum.Yum;
|
2015-09-01 11:09:29 +00:00
|
|
|
import cn.citycraft.Yum.manager.YumManager;
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* @param name
|
|
|
|
*/
|
2015-08-24 12:49:31 +00:00
|
|
|
public CommandDelete(Yum main) {
|
2015-09-22 12:21:55 +00:00
|
|
|
super("delete", "删除插件");
|
2015-08-31 13:28:02 +00:00
|
|
|
this.main = main;
|
2015-09-22 12:03:59 +00:00
|
|
|
setMinimumArguments(1);
|
|
|
|
setPossibleArguments("<插件名称>");
|
2015-08-22 07:13:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
|
|
|
String pluginname = args[0];
|
2015-08-31 13:28:02 +00:00
|
|
|
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
|
2015-09-07 14:58:26 +00:00
|
|
|
if (plugin != null)
|
2015-09-21 07:18:03 +00:00
|
|
|
if (YumManager.plugman.deletePlugin(sender, plugin))
|
|
|
|
sender.sendMessage("§c删除: §a插件 " + pluginname + " 已从服务器卸载并删除!");
|
|
|
|
else
|
|
|
|
sender.sendMessage("§c删除: §c插件 " + pluginname + " 卸载或删除时发生错误 删除失败!");
|
2015-09-07 14:58:26 +00:00
|
|
|
else
|
2015-08-22 07:13:59 +00:00
|
|
|
sender.sendMessage("§c插件 " + pluginname + " 不存在或已卸载!");
|
2015-08-23 13:38:32 +00:00
|
|
|
};
|
2015-08-22 07:13:59 +00:00
|
|
|
}
|