我可以,找出原因。当List:[NGX-CORE,PingAPI]包含[PingAPI]
时,.contains不会返回true服务器插件返回:[PingAPI,NGX-CORE] addon.depend返回:[PingAPI]
包含代码:ServerPlugins.contains(addon.depend)
控制台输出:
System.out.println("ServerPlugins contents: " + ServerPlugins);
System.out.println("Addon Dependencies: " + addon.depend);
System.out.println("Is addon.depend empty: " + addon.depend.isEmpty());
System.out.println("Does ServerPlugins contain addon.depend: " + ServerPlugins.contains(addon.depend));
System.out.println("Does ServerPlugins contain addon.depend: " + ServerPlugins.contains(addon.depend.toString()));
if (addon.depend.isEmpty()) {
if (!(m.disabled.contains(addon.name))) {
Core.Main.m.registerCommands(commands, addon);
System.out.println("Add-on " + addon.name + " loaded! v" + addon.version);
addon.onLoad();
plugins.add(addon);
m.enabled.add(addon.name);
} else {
System.out.println("Add-on " + addon.name + " is disabled and wasn't loaded!");
}
} else {
if (ServerPlugins.contains(addon.depend)) {
if (!(m.disabled.contains(addon.name))) {
Core.Main.m.registerCommands(commands, addon);
System.out.println("Add-on " + addon.name + " loaded! v" + addon.version);
addon.onLoad();
plugins.add(addon);
m.enabled.add(addon.name);
} else {
System.out.println("Add-on " + addon.name + " is disabled and wasn't loaded!");
}
} else {
System.out.println("Add-on " + addon.name + " requires other plugins to function, required plugins: " + addon.depend.toString().replace("]", "").replace("[", ""));
}
}
答案 0 :(得分:1)
我需要做的就是:将.contains
替换为.containsAll
。
.contains
查找对象,但不比较对象。然而,.containsAll
看起来像是一个集合。
解决了Bram