master-big-events #11
@@ -53,9 +53,6 @@ public class EventScoreboardBuilder {
|
||||
objective.numberFormat(NumberFormat.blank());
|
||||
|
||||
UUID uuid = p.getUniqueId();
|
||||
scoreList.removeIf(e -> e.playerUuid().equals(uuid));
|
||||
scoreList.add(new EventScoreEntry(uuid, p.getName(), this.scorable.getScore(p)));
|
||||
|
||||
scoreList.sort(this.scoreComparator);
|
||||
|
||||
int size = scoreList.size();
|
||||
@@ -140,8 +137,19 @@ public class EventScoreboardBuilder {
|
||||
}
|
||||
|
||||
private void updateScore(Player p) {
|
||||
this.playerScores.removeIf(entry -> entry.playerUuid().equals(p.getUniqueId()));
|
||||
this.playerScores.add(new EventScoreEntry(p.getUniqueId(), p.getName(), this.scorable.getScore(p)));
|
||||
EventScoreEntry previousEntry = this.playerScores.stream()
|
||||
.filter(entry -> entry.playerUuid().equals(p.getUniqueId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if(previousEntry == null) {
|
||||
this.playerScores.add(new EventScoreEntry(p.getUniqueId(), p.getName(), this.scorable.getScore(p)));
|
||||
return;
|
||||
}
|
||||
int currentScore = this.scorable.getScore(p);
|
||||
if(previousEntry.score() < currentScore) {
|
||||
this.playerScores.removeIf(entry -> entry.playerUuid().equals(p.getUniqueId()));
|
||||
this.playerScores.add(new EventScoreEntry(p.getUniqueId(), p.getName(), currentScore));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateScoreboards() {
|
||||
|
||||
Reference in New Issue
Block a user