Polished and finalized spleef gamemode

This commit is contained in:
2023-10-01 01:30:19 +02:00
parent 95750701f2
commit 8304b6a105
5 changed files with 32 additions and 23 deletions

View File

@@ -17,15 +17,17 @@ public class LastWinsScore extends Score {
this.ignoreLastPlayers = ignoreLastPlayers;
}
public void setIgnoreLastPlayers(int ignoreLastPlayers) {
this.ignoreLastPlayers = ignoreLastPlayers;
}
@Override
protected void checkGameEnd() {
if(this.isDone()) return;
if(!instance.isRunning()) return;
if(instance.getPlayers().isEmpty()) return;
if(scores.size() >= instance.getPlayers().size() - ignoreLastPlayers) setDone();
if(scores.size() >= instance.getPlayers().size() - ignoreLastPlayers) {
if(ignoreLastPlayers > 0) {
instance.getPlayers().stream().filter(player -> !scores.contains(player)).forEach(this::addResult);
}
setDone();
}
}
@Override