Skip to content

Commit

Permalink
Update stored stats and and rank enums
Browse files Browse the repository at this point in the history
  • Loading branch information
Pugzy committed Oct 7, 2023
1 parent 7fb3549 commit 80d0f8c
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/main/java/rip/bolt/ingame/api/APIManager.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package rip.bolt.ingame.api;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.UUID;
Expand All @@ -24,6 +25,7 @@ public APIManager() {

ObjectMapper objectMapper = new ObjectMapper().registerModule(new DateModule());
objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS);
objectMapper.enable(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE);

OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.addInterceptor(
Expand Down
42 changes: 33 additions & 9 deletions src/main/java/rip/bolt/ingame/api/definitions/BoltRank.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,41 @@
package rip.bolt.ingame.api.definitions;

import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
import java.util.Locale;

public enum BoltRank {
S("S"),
A_PLUS("A+"),
A("A"),
B_PLUS("B+"),
B("B"),
C_PLUS("C+"),
C("C"),
D_PLUS("D+"),
D("D"),
GRANDMASTER("Grandmaster"),
MASTER_5("Master 5"),
MASTER_4("Master 4"),
MASTER_3("Master 3"),
MASTER_2("Master 2"),
MASTER_1("Master 1"),
DIAMOND_5("Diamond 5"),
DIAMOND_4("Diamond 4"),
DIAMOND_3("Diamond 3"),
DIAMOND_2("Diamond 2"),
DIAMOND_1("Diamond 1"),
PLATINUM_5("Platinum 5"),
PLATINUM_4("Platinum 4"),
PLATINUM_3("Platinum 3"),
PLATINUM_2("Platinum 2"),
PLATINUM_1("Platinum 1"),
GOLD_5("Gold 5"),
GOLD_4("Gold 4"),
GOLD_3("Gold 3"),
GOLD_2("Gold 2"),
GOLD_1("Gold 1"),
SILVER_5("Silver 5"),
SILVER_4("Silver 4"),
SILVER_3("Silver 3"),
SILVER_2("Silver 2"),
SILVER_1("Silver 1"),
BRONZE_5("Bronze 5"),
BRONZE_4("Bronze 4"),
BRONZE_3("Bronze 3"),
BRONZE_2("Bronze 2"),
BRONZE_1("Bronze 1"),
@JsonEnumDefaultValue
UNRANKED("Unranked");

private final String displayName;
Expand Down
42 changes: 42 additions & 0 deletions src/main/java/rip/bolt/ingame/api/definitions/Stats.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public class Stats {
private double damageReceivedBow;
private int arrowsHit;
private int arrowsShot;
private int wools;
private int woolsTouched;
private int monuments;
private int cores;
private int flags;
private int flagsPicked;
private double score;

public Stats() {}
Expand All @@ -29,6 +35,12 @@ public Stats(
double damageReceivedBow,
int arrowsHit,
int arrowsShot,
int wools,
int woolsTouched,
int monuments,
int cores,
int flags,
int flagsPicked,
double score) {
this.kills = kills;
this.deaths = deaths;
Expand All @@ -39,6 +51,12 @@ public Stats(
this.damageReceivedBow = damageReceivedBow;
this.arrowsHit = arrowsHit;
this.arrowsShot = arrowsShot;
this.wools = wools;
this.woolsTouched = woolsTouched;
this.monuments = monuments;
this.cores = cores;
this.flags = flags;
this.flagsPicked = flagsPicked;
this.score = score;
}

Expand Down Expand Up @@ -114,6 +132,30 @@ public void setArrowsShot(int arrowsShot) {
this.arrowsShot = arrowsShot;
}

public int getWools() {
return wools;
}

public int getWoolsTouched() {
return woolsTouched;
}

public int getMonuments() {
return monuments;
}

public int getCores() {
return cores;
}

public int getFlags() {
return flags;
}

public int getFlagsPicked() {
return flagsPicked;
}

public double getScore() {
return score;
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/rip/bolt/ingame/managers/StatsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public void populatePlayerStats(
stats.getBowDamageTaken(),
stats.getShotsHit(),
stats.getShotsTaken(),
stats.getWoolsCaptured(),
stats.getWoolsTouched(),
stats.getMonumentsDestroyed(),
stats.getCoresLeaked(),
stats.getFlagsCaptured(),
stats.getFlagPickups(),
scoreModule != null ? scoreModule.getContribution(uuid) : 0));
}
}

0 comments on commit 80d0f8c

Please sign in to comment.