Boosters no longer stay in the GUI after expiring

This commit is contained in:
ASangarin 2020-11-15 00:50:08 +01:00
parent 608d454147
commit 9868cf2ebd

View File

@ -3,6 +3,7 @@ package net.Indyuce.mmocore.manager.social;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import net.Indyuce.mmocore.api.experience.Booster;
import net.Indyuce.mmocore.api.experience.Profession;
@ -33,6 +34,7 @@ public class BoosterManager {
}
public Booster get(int index) {
flush();
return map.get(index);
}
@ -71,4 +73,10 @@ public class BoosterManager {
public List<Booster> getBoosters() {
return map;
}
/**
* @return Same as getBoosters() but does not include timed out boosters
*/
public List<Booster> getActiveBoosters() {
return map.stream().filter((b) -> !b.isTimedOut()).collect(Collectors.toList());
}
}