Bugfix in plugin manager returning disabled plugins
This commit is contained in:
parent
4f4bc3674a
commit
dea137fe48
1 changed files with 11 additions and 5 deletions
|
|
@ -182,19 +182,25 @@ public class PluginManager<T> implements Iterable<PluginData>{
|
||||||
this.pluginList = pluginList;
|
this.pluginList = pluginList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public int getNextIndex() {
|
||||||
public boolean hasNext() {
|
|
||||||
for (int i = nextIndex; i < pluginList.size(); i++) {
|
for (int i = nextIndex; i < pluginList.size(); i++) {
|
||||||
if (pluginList.get(i).isEnabled())
|
if (pluginList.get(i).isEnabled())
|
||||||
return true;
|
return i;
|
||||||
}
|
}
|
||||||
return false;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return getNextIndex() >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PluginData next() {
|
public PluginData next() {
|
||||||
if(!hasNext())
|
nextIndex = getNextIndex();
|
||||||
|
if(nextIndex < 0)
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
|
|
||||||
return pluginList.get(nextIndex++);
|
return pluginList.get(nextIndex++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue