-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pablo Herrera <[email protected]>
- Loading branch information
1 parent
f02940c
commit 3a54971
Showing
8 changed files
with
202 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
core/src/main/java/tc/oc/pgm/score/ScoreBoxDefinition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package tc.oc.pgm.score; | ||
|
||
import static tc.oc.pgm.util.Assert.assertNotNull; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import tc.oc.pgm.api.filter.Filter; | ||
import tc.oc.pgm.api.match.Match; | ||
import tc.oc.pgm.api.region.Region; | ||
import tc.oc.pgm.util.material.MaterialMatcher; | ||
|
||
public record ScoreBoxDefinition( | ||
Region region, | ||
int score, | ||
Filter filter, | ||
ImmutableMap<MaterialMatcher, Double> redeemables, | ||
boolean silent) { | ||
public ScoreBoxDefinition { | ||
assertNotNull(region, "region"); | ||
assertNotNull(filter, "filter"); | ||
} | ||
|
||
public ScoreBox createScoreBox(Match match) { | ||
return new ScoreBox(this); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,57 @@ | ||
package tc.oc.pgm.score; | ||
|
||
import static net.kyori.adventure.text.Component.empty; | ||
import static net.kyori.adventure.text.Component.space; | ||
import static net.kyori.adventure.text.Component.text; | ||
|
||
import net.kyori.adventure.text.Component; | ||
import net.kyori.adventure.text.format.NamedTextColor; | ||
import tc.oc.pgm.api.filter.Filter; | ||
import tc.oc.pgm.api.party.Competitor; | ||
import tc.oc.pgm.util.named.NameStyle; | ||
|
||
public record ScoreConfig( | ||
int scoreLimit, | ||
int deathScore, | ||
int killScore, | ||
int mercyLimit, | ||
int mercyLimitMin, | ||
Display display, | ||
Filter scoreboardFilter) { | ||
|
||
public enum Display { | ||
NUMERICAL(null, Integer.MAX_VALUE) { | ||
@Override | ||
public Component format(Competitor competitor, int score, int limit) { | ||
return text() | ||
.append(text(score, NamedTextColor.WHITE)) | ||
.append(limit > 0 ? text("/", NamedTextColor.DARK_GRAY) : empty()) | ||
.append(limit > 0 ? text(limit, NamedTextColor.GRAY) : empty()) | ||
.append(space()) | ||
.append(competitor.getName(NameStyle.SIMPLE_COLOR)) | ||
.build(); | ||
} | ||
}, | ||
CIRCLE("\u2B24", 16), // ⬤ | ||
SQUARE("\u2b1b", 16), // ⬛ | ||
PIPE("|", 24); | ||
|
||
public final String symbol; | ||
public final int max; | ||
|
||
public class ScoreConfig { | ||
public final int scoreLimit; | ||
public final int deathScore; | ||
public final int killScore; | ||
public final int mercyLimit; | ||
public final int mercyLimitMin; | ||
public final Filter scoreboardFilter; | ||
Display(String symbol, int max) { | ||
this.symbol = symbol; | ||
this.max = max; | ||
} | ||
|
||
public ScoreConfig( | ||
int scoreLimit, | ||
int deathScore, | ||
int killScore, | ||
int mercyLimit, | ||
int mercyLimitMin, | ||
Filter scoreboardFilter) { | ||
this.scoreLimit = scoreLimit; | ||
this.deathScore = deathScore; | ||
this.killScore = killScore; | ||
this.mercyLimit = mercyLimit; | ||
this.mercyLimitMin = mercyLimitMin; | ||
this.scoreboardFilter = scoreboardFilter; | ||
public Component format(Competitor competitor, int score, int limit) { | ||
if (score < 0 || score > max || limit > max) | ||
return NUMERICAL.format(competitor, score, limit); | ||
return text() | ||
.append(text("\u2794 ", competitor.getTextColor())) // ➔ | ||
.append(text(symbol.repeat(score), competitor.getTextColor())) | ||
.append(limit > score ? text(symbol.repeat(limit - score), NamedTextColor.GRAY) : empty()) | ||
.build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.