mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-02-25 00:31:49 +01:00
Fixed Litebans ban status #608
This commit is contained in:
parent
721c8ebe44
commit
3ecddd19f4
@ -106,7 +106,7 @@ public class LiteBansData extends PluginData implements BanData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnalysisContainer getServerData(Collection<UUID> collection, AnalysisContainer analysisContainer) throws Exception {
|
public AnalysisContainer getServerData(Collection<UUID> collection, AnalysisContainer analysisContainer) {
|
||||||
TableContainer banTable = getBanTable();
|
TableContainer banTable = getBanTable();
|
||||||
TableContainer muteTable = getMuteTable();
|
TableContainer muteTable = getMuteTable();
|
||||||
TableContainer warningTable = getWarningTable();
|
TableContainer warningTable = getWarningTable();
|
||||||
@ -200,7 +200,7 @@ public class LiteBansData extends PluginData implements BanData {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isBanned(UUID uuid) {
|
public boolean isBanned(UUID uuid) {
|
||||||
try {
|
try {
|
||||||
return !db.getBans(uuid).isEmpty();
|
return db.getBans(uuid).stream().anyMatch(LiteBansDBObj::isActive);
|
||||||
} catch (DBOpException e) {
|
} catch (DBOpException e) {
|
||||||
Log.toLog(this.getClass(), e);
|
Log.toLog(this.getClass(), e);
|
||||||
}
|
}
|
||||||
@ -210,11 +210,10 @@ public class LiteBansData extends PluginData implements BanData {
|
|||||||
@Override
|
@Override
|
||||||
public Collection<UUID> filterBanned(Collection<UUID> collection) {
|
public Collection<UUID> filterBanned(Collection<UUID> collection) {
|
||||||
try {
|
try {
|
||||||
List<LiteBansDBObj> bans = db.getBans();
|
Set<UUID> banned = db.getBans().stream()
|
||||||
Set<UUID> banned = new HashSet<>();
|
.filter(LiteBansDBObj::isActive)
|
||||||
for (LiteBansDBObj ban : bans) {
|
.map(LiteBansDBObj::getUuid)
|
||||||
banned.add(ban.getUuid());
|
.collect(Collectors.toSet());
|
||||||
}
|
|
||||||
|
|
||||||
return collection.stream().filter(banned::contains).collect(Collectors.toSet());
|
return collection.stream().filter(banned::contains).collect(Collectors.toSet());
|
||||||
} catch (DBOpException e) {
|
} catch (DBOpException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user