Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@Getter
public class Duel extends Match implements Team {
Expand Down Expand Up @@ -108,9 +109,11 @@ public DuelRound getCurrentRound() {

@Override
public int getWonRounds(Player player) {
UUID playerUuid = player.getUniqueId();
int wonRounds = 0;
for (Round round : this.rounds.values()) {
if (((DuelRound) round).getRoundWinner() == player)
Player winner = ((DuelRound) round).getRoundWinner();
if (winner != null && winner.getUniqueId().equals(playerUuid))
wonRounds++;
}
return wonRounds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,17 @@ public static Component getRoundString(int rounds, int wonRounds, Component wonC
}

Component component = Component.empty();
boolean firstNotWon = true;
String roundSymbol = getRoundSymbol();
Component wonSymbol = wonColor == null
? Component.text(roundSymbol)
: wonColor.append(Component.text(roundSymbol));
Component notWonSymbol = Component.text(roundSymbol, NamedTextColor.GRAY);

for (int i = 1; i <= rounds; i++) {
if (i <= clampedWonRounds) {
component = component.append(wonSymbol);
} else if (firstNotWon) {
component = component.append(Component.text(roundSymbol, NamedTextColor.GRAY));
firstNotWon = false;
} else {
component = component.append(Component.text(roundSymbol));
component = component.append(notWonSymbol);
}
}

Expand Down