@ -42,7 +42,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
private final Map<Pattern, PluginLoader> fileAssociations = new HashMap<Pattern, PluginLoader>();
|
||||
private final List<Plugin> plugins = new ArrayList<Plugin>();
|
||||
private final Map<String, Plugin> lookupNames = new HashMap<String, Plugin>();
|
||||
private static File updateDirectory = null;
|
||||
private File updateDirectory;
|
||||
private final SimpleCommandMap commandMap;
|
||||
private final Map<String, Permission> permissions = new HashMap<String, Permission>();
|
||||
private final Map<Boolean, Set<Permission>> defaultPerms = new LinkedHashMap<Boolean, Set<Permission>>();
|
||||
@ -187,10 +187,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
while (!plugins.isEmpty()) {
|
||||
boolean missingDependency = true;
|
||||
Iterator<String> pluginIterator = plugins.keySet().iterator();
|
||||
Iterator<Map.Entry<String, File>> pluginIterator = plugins.entrySet().iterator();
|
||||
|
||||
while (pluginIterator.hasNext()) {
|
||||
String plugin = pluginIterator.next();
|
||||
Map.Entry<String, File> entry = pluginIterator.next();
|
||||
String plugin = entry.getKey();
|
||||
|
||||
if (dependencies.containsKey(plugin)) {
|
||||
Iterator<String> dependencyIterator = dependencies.get(plugin).iterator();
|
||||
@ -205,14 +206,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
// We have a dependency not found
|
||||
} else if (!plugins.containsKey(dependency)) {
|
||||
missingDependency = false;
|
||||
File file = plugins.get(plugin);
|
||||
pluginIterator.remove();
|
||||
softDependencies.remove(plugin);
|
||||
dependencies.remove(plugin);
|
||||
|
||||
server.getLogger().log(
|
||||
Level.SEVERE,
|
||||
"Could not load '" + file.getPath() + "' in folder '" + directory.getPath() + "'",
|
||||
"Could not load '" + entry.getValue().getPath() + "' in folder '" + directory.getPath() + "'",
|
||||
new UnknownDependencyException(dependency));
|
||||
break;
|
||||
}
|
||||
@ -257,15 +257,16 @@ public final class SimplePluginManager implements PluginManager {
|
||||
if (missingDependency) {
|
||||
// We now iterate over plugins until something loads
|
||||
// This loop will ignore soft dependencies
|
||||
pluginIterator = plugins.keySet().iterator();
|
||||
pluginIterator = plugins.entrySet().iterator();
|
||||
|
||||
while (pluginIterator.hasNext()) {
|
||||
String plugin = pluginIterator.next();
|
||||
Map.Entry<String, File> entry = pluginIterator.next();
|
||||
String plugin = entry.getKey();
|
||||
|
||||
if (!dependencies.containsKey(plugin)) {
|
||||
softDependencies.remove(plugin);
|
||||
missingDependency = false;
|
||||
File file = plugins.get(plugin);
|
||||
File file = entry.getValue();
|
||||
pluginIterator.remove();
|
||||
|
||||
try {
|
||||
@ -358,7 +359,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
|
||||
public synchronized Plugin[] getPlugins() {
|
||||
return plugins.toArray(new Plugin[0]);
|
||||
return plugins.toArray(new Plugin[plugins.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user