mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-01-23 16:41:19 +01:00
fix: string commands were erroring (#426)
So the list that is being filtered is immutable, hence doesn't work with in conjunction with removeIf. There are two solutions, either - stream it (which I've done in this PR) OR - create a new ArrayList each time for filtering since that is mutable
This commit is contained in:
parent
6847b0edb1
commit
8afbae50fb
@ -8,6 +8,7 @@ import com.sekwah.advancedportals.core.util.Lang;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class CommandWithSubCommands implements CommandTemplate {
|
public class CommandWithSubCommands implements CommandTemplate {
|
||||||
|
|
||||||
@ -171,7 +172,8 @@ public class CommandWithSubCommands implements CommandTemplate {
|
|||||||
if(tabList == null) {
|
if(tabList == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
tabList.removeIf(arg -> !arg.startsWith(lastArg));
|
return tabList.stream()
|
||||||
return tabList;
|
.filter(arg -> arg.startsWith(lastArg))
|
||||||
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user