简化插件版本...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2016-02-17 00:47:23 +08:00
parent 4218ab13ec
commit 43799a0b24
5 changed files with 8 additions and 8 deletions

View File

@ -35,7 +35,7 @@ public class CommandDelete extends BaseCommand {
final String pluginname = args[0]; final String pluginname = args[0];
final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname); final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
if (plugin != null) { if (plugin != null) {
final String version = plugin.getDescription().getVersion(); final String version = plugin.getDescription().getVersion().substring(0, 15);
if (YumAPI.getPlugman().deletePlugin(sender, plugin)) { if (YumAPI.getPlugman().deletePlugin(sender, plugin)) {
sender.sendMessage("§c删除: §a插件 §6" + pluginname + " §a版本 §d" + version + " §a已从服务器卸载并删除!"); sender.sendMessage("§c删除: §a插件 §6" + pluginname + " §a版本 §d" + version + " §a已从服务器卸载并删除!");
} else { } else {

View File

@ -35,7 +35,7 @@ public class CommandFullDelete extends BaseCommand {
final String pluginname = args[0]; final String pluginname = args[0];
final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname); final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
if (plugin != null) { if (plugin != null) {
final String version = plugin.getDescription().getVersion(); final String version = plugin.getDescription().getVersion().substring(0, 15);
if (YumAPI.getPlugman().fullDeletePlugin(sender, plugin)) { if (YumAPI.getPlugman().fullDeletePlugin(sender, plugin)) {
sender.sendMessage("§c删除: §a插件 §6" + pluginname + " §a版本 §d" + version + " §a已从服务器卸载并删除!"); sender.sendMessage("§c删除: §a插件 §6" + pluginname + " §a版本 §d" + version + " §a已从服务器卸载并删除!");
} else { } else {

View File

@ -47,7 +47,7 @@ public class CommandInfo extends BaseCommand {
if (plugin != null) { if (plugin != null) {
final PluginDescriptionFile desc = plugin.getDescription(); final PluginDescriptionFile desc = plugin.getDescription();
sender.sendMessage("§6插件名称: §3" + plugin.getName()); sender.sendMessage("§6插件名称: §3" + plugin.getName());
sender.sendMessage("§6插件版本: §3" + desc.getVersion()); sender.sendMessage("§6插件版本: §3" + desc.getVersion().substring(0, 15));
sender.sendMessage("§6插件作者: §3" + StringUtils.join(desc.getAuthors(), " ")); sender.sendMessage("§6插件作者: §3" + StringUtils.join(desc.getAuthors(), " "));
sender.sendMessage("§6插件描述: §3" + (desc.getDescription() == null ? "" : desc.getDescription())); sender.sendMessage("§6插件描述: §3" + (desc.getDescription() == null ? "" : desc.getDescription()));
sender.sendMessage("§6插件依赖: §3" + (desc.getDepend().isEmpty() ? "" : "")); sender.sendMessage("§6插件依赖: §3" + (desc.getDepend().isEmpty() ? "" : ""));

View File

@ -138,7 +138,7 @@ public class DownloadManager {
String pVer = null; String pVer = null;
try { try {
final PluginDescriptionFile desc = plugin.getPluginLoader().getPluginDescription(file); final PluginDescriptionFile desc = plugin.getPluginLoader().getPluginDescription(file);
pVer = desc.getVersion(); pVer = desc.getVersion().substring(0, 15);
} catch (final Exception e) { } catch (final Exception e) {
pVer = ""; pVer = "";
} }

View File

@ -166,7 +166,7 @@ public class PluginsManager {
final ChatColor color = plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED; final ChatColor color = plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED;
String pluginName = color + plugin.getName(); String pluginName = color + plugin.getName();
if (includeVersions) { if (includeVersions) {
pluginName = pluginName + " (" + plugin.getDescription().getVersion() + ")"; pluginName = pluginName + " (" + plugin.getDescription().getVersion().substring(0, 15) + ")";
} }
return pluginName; return pluginName;
} }
@ -233,7 +233,7 @@ public class PluginsManager {
public String getPluginVersion(final String name) { public String getPluginVersion(final String name) {
final Plugin plugin = getPluginByName(name); final Plugin plugin = getPluginByName(name);
if ((plugin != null) && (plugin.getDescription() != null)) { if ((plugin != null) && (plugin.getDescription() != null)) {
return plugin.getDescription().getVersion(); return plugin.getDescription().getVersion().substring(0, 15);
} }
return null; return null;
} }
@ -330,7 +330,7 @@ public class PluginsManager {
} }
target.onLoad(); target.onLoad();
Bukkit.getPluginManager().enablePlugin(target); Bukkit.getPluginManager().enablePlugin(target);
sender.sendMessage("§6载入: §a插件 §b" + target.getName() + " §a版本 §d" + target.getDescription().getVersion() + " §a已成功载入到服务器!"); sender.sendMessage("§6载入: §a插件 §b" + target.getName() + " §a版本 §d" + target.getDescription().getVersion().substring(0, 15) + " §a已成功载入到服务器!");
return true; return true;
} }
@ -548,7 +548,7 @@ public class PluginsManager {
if (next.getName().equals(name)) { if (next.getName().equals(name)) {
pluginManager.disablePlugin(next); pluginManager.disablePlugin(next);
if ((plugins != null) && (plugins.contains(next))) { if ((plugins != null) && (plugins.contains(next))) {
pluginVersion = next.getDescription().getVersion(); pluginVersion = next.getDescription().getVersion().substring(0, 15);
plugins.remove(next); plugins.remove(next);
sender.sendMessage("§6卸载: §a从服务器插件列表删除 §b" + name + " §a的实例!"); sender.sendMessage("§6卸载: §a从服务器插件列表删除 §b" + name + " §a的实例!");
} }