mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
重载所有插件时忽略部分已注册服务插件...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
4480b0fb3d
commit
88e655e6fc
4
pom.xml
4
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>cn.citycraft</groupId>
|
<groupId>cn.citycraft</groupId>
|
||||||
<artifactId>Yum</artifactId>
|
<artifactId>Yum</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
<name>Yum</name>
|
<name>Yum</name>
|
||||||
<description>Minecraft 服务器插件管理系统</description>
|
<description>Minecraft 服务器插件管理系统</description>
|
||||||
<build>
|
<build>
|
||||||
@ -57,9 +57,9 @@
|
|||||||
<jenkins.url>http://hs.yumc.pw:8080</jenkins.url>
|
<jenkins.url>http://hs.yumc.pw:8080</jenkins.url>
|
||||||
<update.description>&a全新 2.0 版本 震撼发布...</update.description>
|
<update.description>&a全新 2.0 版本 震撼发布...</update.description>
|
||||||
<update.changes>
|
<update.changes>
|
||||||
|
&b2.0.3 &6- &a重载所有插件时忽略部分已注册服务插件...;
|
||||||
&b2.0.2 &6- &c修复检查可更新插件功能导致全局更新失效问题...;
|
&b2.0.2 &6- &c修复检查可更新插件功能导致全局更新失效问题...;
|
||||||
&b &6- &d新增全局更新限制 无法同时进行 防止错误...;
|
&b &6- &d新增全局更新限制 无法同时进行 防止错误...;
|
||||||
&b2.0.1 &6- &c插件在upgrade时自动重命名为原有名称...;
|
|
||||||
</update.changes>
|
</update.changes>
|
||||||
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
@ -40,6 +40,7 @@ public class YumAPI {
|
|||||||
plugman = new PluginsManager(main);
|
plugman = new PluginsManager(main);
|
||||||
download = new DownloadManager(main);
|
download = new DownloadManager(main);
|
||||||
repo = new RepositoryManager(main);
|
repo = new RepositoryManager(main);
|
||||||
|
plugman.addIgnore(main.getConfig().getStringList("ignorelist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -100,7 +101,12 @@ public class YumCommand implements HandlerCommands, Listener {
|
|||||||
final Map<String, Map<String, Object>> clist = desc.getCommands();
|
final Map<String, Map<String, Object>> clist = desc.getCommands();
|
||||||
if (clist != null) {
|
if (clist != null) {
|
||||||
sender.sendMessage("§6插件注册命令: §3" + (clist.isEmpty() ? "无" : ""));
|
sender.sendMessage("§6插件注册命令: §3" + (clist.isEmpty() ? "无" : ""));
|
||||||
StringUtil.sendStringArray(sender, clist.keySet(), "§6 - §a");
|
for (final Entry<String, Map<String, Object>> entry : clist.entrySet()) {
|
||||||
|
sender.sendMessage("§6 - §a" + entry.getKey());
|
||||||
|
sendEntry(sender, "§6 描述: §a", entry.getValue(), "description");
|
||||||
|
sendEntry(sender, "§6 权限: §a", entry.getValue(), "permission");
|
||||||
|
sendEntry(sender, "§6 用法: §a", entry.getValue(), "usage");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final List<Permission> plist = desc.getPermissions();
|
final List<Permission> plist = desc.getPermissions();
|
||||||
if (plist != null) {
|
if (plist != null) {
|
||||||
@ -260,6 +266,25 @@ public class YumCommand implements HandlerCommands, Listener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发生实体消息
|
||||||
|
*
|
||||||
|
* @param sender
|
||||||
|
* 命令发送者
|
||||||
|
* @param prefix
|
||||||
|
* 实体前缀
|
||||||
|
* @param map
|
||||||
|
* 实体
|
||||||
|
* @param key
|
||||||
|
* 实体Key
|
||||||
|
*/
|
||||||
|
public void sendEntry(final CommandSender sender, final String prefix, final Map<String, Object> map, final String key) {
|
||||||
|
final Object value = map.get(key);
|
||||||
|
if (value != null) {
|
||||||
|
sender.sendMessage(prefix + (String) value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@HandlerCommand(name = "unload", minimumArguments = 1, description = "卸载插件", possibleArguments = "<插件名称>")
|
@HandlerCommand(name = "unload", minimumArguments = 1, description = "卸载插件", possibleArguments = "<插件名称>")
|
||||||
public void unload(final InvokeCommandEvent e) {
|
public void unload(final InvokeCommandEvent e) {
|
||||||
final String pluginname = e.getArgs()[0];
|
final String pluginname = e.getArgs()[0];
|
||||||
|
@ -8,6 +8,7 @@ import java.net.URL;
|
|||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -53,6 +54,17 @@ public class PluginsManager {
|
|||||||
return StringUtils.substring(plugin.getDescription().getVersion(), 0, 15);
|
return StringUtils.substring(plugin.getDescription().getVersion(), 0, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加到忽略列表
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* - 插件名称
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
public boolean addIgnore(final Collection<? extends String> name) {
|
||||||
|
return ignoreList.addAll(name);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加到忽略列表
|
* 添加到忽略列表
|
||||||
*
|
*
|
||||||
@ -458,18 +470,25 @@ public class PluginsManager {
|
|||||||
public void reloadAll() {
|
public void reloadAll() {
|
||||||
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
||||||
if (!isIgnored(plugin)) {
|
if (!isIgnored(plugin)) {
|
||||||
reload(plugin);
|
unload(plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Bukkit.getPluginManager().loadPlugins(Bukkit.getUpdateFolderFile().getParentFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重载所有插件
|
* 重载所有插件
|
||||||
*/
|
*/
|
||||||
public void reloadAll(final CommandSender sender) {
|
public void reloadAll(final CommandSender sender) {
|
||||||
for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
final Plugin[] plist = Bukkit.getPluginManager().getPlugins();
|
||||||
|
for (final Plugin plugin : plist) {
|
||||||
if (!isIgnored(plugin)) {
|
if (!isIgnored(plugin)) {
|
||||||
reload(sender, plugin);
|
unload(sender, plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final Plugin plugin : plist) {
|
||||||
|
if (!isIgnored(plugin)) {
|
||||||
|
load(sender, plugin.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Version: 1.2
|
Version: 2.0
|
||||||
#是否只允许控制台执行插件命令
|
#是否只允许控制台执行插件命令
|
||||||
onlyCommandConsole: false
|
onlyCommandConsole: false
|
||||||
#是否只允许控制台执行插件文件命令
|
#是否只允许控制台执行插件文件命令
|
||||||
@ -7,3 +7,9 @@ onlyFileCommandConsole: true
|
|||||||
blacklist:
|
blacklist:
|
||||||
- 'plugins'
|
- 'plugins'
|
||||||
- 'worlds'
|
- 'worlds'
|
||||||
|
#全体重载忽略列表(##请不要删除原有插件##)
|
||||||
|
ignorelist:
|
||||||
|
- 'Yum'
|
||||||
|
- 'Vault'
|
||||||
|
- 'iConomy'
|
||||||
|
- 'GroupManager'
|
Loading…
Reference in New Issue
Block a user