Skip to content

Commit 46a2366

Browse files
authored
Merge pull request #25 from FrostHexABG/24-add-medals
Version 2.0
2 parents a4cd407 + 6173c9b commit 46a2366

File tree

6 files changed

+124
-24
lines changed

6 files changed

+124
-24
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
/.idea/modules.xml
77
/timingsystem.restapi.iml
88
/.idea/vcs.xml
9+
/.idea/timingsystem.restapi.iml

dependency-reduced-pom.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.frosthex</groupId>
55
<artifactId>timingsystem.restapi</artifactId>
66
<name>timingsystem.restapi</name>
7-
<version>1.2</version>
7+
<version>2.0-SNAPSHOT+2025.november.6</version>
88
<url>http://maven.apache.org</url>
99
<build>
1010
<sourceDirectory>src</sourceDirectory>
@@ -52,13 +52,13 @@
5252
<dependency>
5353
<groupId>com.github.FrostHexABG</groupId>
5454
<artifactId>TimingSystem</artifactId>
55-
<version>2.3</version>
55+
<version>3.0.6</version>
5656
<scope>provided</scope>
5757
</dependency>
5858
<dependency>
5959
<groupId>io.papermc.paper</groupId>
6060
<artifactId>paper-api</artifactId>
61-
<version>1.20.1-R0.1-SNAPSHOT</version>
61+
<version>1.21.4-R0.1-SNAPSHOT</version>
6262
<scope>provided</scope>
6363
<exclusions>
6464
<exclusion>
@@ -69,10 +69,6 @@
6969
<artifactId>gson</artifactId>
7070
<groupId>com.google.code.gson</groupId>
7171
</exclusion>
72-
<exclusion>
73-
<artifactId>bungeecord-chat</artifactId>
74-
<groupId>net.md-5</groupId>
75-
</exclusion>
7672
<exclusion>
7773
<artifactId>snakeyaml</artifactId>
7874
<groupId>org.yaml</groupId>
@@ -93,10 +89,22 @@
9389
<artifactId>log4j-api</artifactId>
9490
<groupId>org.apache.logging.log4j</groupId>
9591
</exclusion>
92+
<exclusion>
93+
<artifactId>brigadier</artifactId>
94+
<groupId>com.mojang</groupId>
95+
</exclusion>
96+
<exclusion>
97+
<artifactId>bungeecord-chat</artifactId>
98+
<groupId>net.md-5</groupId>
99+
</exclusion>
96100
<exclusion>
97101
<artifactId>maven-resolver-provider</artifactId>
98102
<groupId>org.apache.maven</groupId>
99103
</exclusion>
104+
<exclusion>
105+
<artifactId>jspecify</artifactId>
106+
<groupId>org.jspecify</groupId>
107+
</exclusion>
100108
<exclusion>
101109
<artifactId>adventure-api</artifactId>
102110
<groupId>net.kyori</groupId>
@@ -125,14 +133,6 @@
125133
<artifactId>checker-qual</artifactId>
126134
<groupId>org.checkerframework</groupId>
127135
</exclusion>
128-
<exclusion>
129-
<artifactId>asm</artifactId>
130-
<groupId>org.ow2.asm</groupId>
131-
</exclusion>
132-
<exclusion>
133-
<artifactId>asm-commons</artifactId>
134-
<groupId>org.ow2.asm</groupId>
135-
</exclusion>
136136
</exclusions>
137137
</dependency>
138138
</dependencies>

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.frosthex</groupId>
55
<artifactId>timingsystem.restapi</artifactId>
6-
<version>1.2</version>
6+
<version>2.0</version>
77
<packaging>jar</packaging>
88
<name>timingsystem.restapi</name>
99
<url>http://maven.apache.org</url>
@@ -47,13 +47,13 @@
4747
<dependency>
4848
<groupId>com.github.FrostHexABG</groupId>
4949
<artifactId>TimingSystem</artifactId>
50-
<version>2.3</version>
50+
<version>3.0.6</version>
5151
<scope>provided</scope>
5252
</dependency>
5353
<dependency>
5454
<groupId>io.papermc.paper</groupId>
5555
<artifactId>paper-api</artifactId>
56-
<version>1.20.1-R0.1-SNAPSHOT</version>
56+
<version>1.21.4-R0.1-SNAPSHOT</version>
5757
<scope>provided</scope>
5858
</dependency>
5959
<dependency>

src/com/frosthex/timingsystem/restapi/TimingSystemRESTApiPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
/**
1717
* TimingSystemRESTApi - Provides a basic JSON REST API for the TimingSystem plugin.
18-
* Copyright (C) 2023 Justin "JustBru00" Brubaker
18+
* Copyright (C) 2025 Justin "JustBru00" Brubaker
1919
*
2020
* This program is free software: you can redistribute it and/or modify
2121
* it under the terms of the GNU Affero General Public License as published
@@ -37,7 +37,7 @@ public class TimingSystemRESTApiPlugin extends JavaPlugin {
3737

3838
private static TimingSystemRESTApiPlugin instance;
3939
private static final int BSTATS_PLUGIN_ID = 18069;
40-
private static final String[] TIMING_SYSTEM_SUPPORTED_VERSIONS = {"2.0","2.1","2.2","2.3","3.0"};
40+
private static final String[] TIMING_SYSTEM_SUPPORTED_VERSIONS = {"3.0"};
4141

4242
public static ConsoleCommandSender clogger = Bukkit.getServer().getConsoleSender();
4343
public static Logger log = Bukkit.getLogger();

src/com/frosthex/timingsystem/restapi/network/SparkManager.java

Lines changed: 101 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.util.UUID;
1212

1313
import me.makkuusen.timing.system.round.RoundType;
14+
import me.makkuusen.timing.system.track.medals.TrackMedals;
1415
import org.bukkit.Bukkit;
1516
import org.bukkit.Location;
1617
import org.bukkit.OfflinePlayer;
@@ -38,7 +39,7 @@
3839

3940
/**
4041
* TimingSystemRESTApi - Provides a basic JSON REST API for the TimingSystem plugin.
41-
* Copyright (C) 2023 Justin "JustBru00" Brubaker
42+
* Copyright (C) 2025 Justin "JustBru00" Brubaker
4243
*
4344
* This program is free software: you can redistribute it and/or modify
4445
* it under the terms of the GNU Affero General Public License as published
@@ -179,6 +180,38 @@ public static void initSpark() {
179180
tagsArray.add(trackTag.getValue());
180181
}
181182
trackObj.add("tags", tagsArray);
183+
184+
// Issue #24 - Add Medals
185+
JsonObject medalsObject = new JsonObject();
186+
TrackMedals tm = track.getTrackMedals();
187+
medalsObject.addProperty("active", tm.isActive());
188+
189+
JsonObject netheriteObject = new JsonObject();
190+
netheriteObject.addProperty("time", tm.getNetherite().getTime());
191+
medalsObject.add("netherite", netheriteObject);
192+
193+
JsonObject emeraldObject = new JsonObject();
194+
emeraldObject.addProperty("time", tm.getEmerald().getTime());
195+
medalsObject.add("emerald", emeraldObject);
196+
197+
JsonObject diamondObject = new JsonObject();
198+
diamondObject.addProperty("time", tm.getDiamond().getTime());
199+
medalsObject.add("diamond", diamondObject);
200+
201+
JsonObject goldObject = new JsonObject();
202+
goldObject.addProperty("time", tm.getGold().getTime());
203+
medalsObject.add("gold", goldObject);
204+
205+
JsonObject silverObject = new JsonObject();
206+
silverObject.addProperty("time", tm.getSilver().getTime());
207+
medalsObject.add("silver", silverObject);
208+
209+
JsonObject copperObject = new JsonObject();
210+
copperObject.addProperty("time", tm.getCopper().getTime());
211+
medalsObject.add("copper", copperObject);
212+
213+
trackObj.add("medals", medalsObject);
214+
// END - Issue #24
182215

183216
tracksListObject.add(trackObj);
184217
}
@@ -234,6 +267,39 @@ public static void initSpark() {
234267
tagsArray.add(trackTag.getValue());
235268
}
236269
responseObject.add("tags", tagsArray);
270+
271+
// Issue #24 - Add Medals
272+
JsonObject medalsObject = new JsonObject();
273+
TrackMedals tm = track.getTrackMedals();
274+
medalsObject.addProperty("active", tm.isActive());
275+
276+
JsonObject netheriteObject = new JsonObject();
277+
netheriteObject.addProperty("time", tm.getNetherite().getTime());
278+
medalsObject.add("netherite", netheriteObject);
279+
280+
JsonObject emeraldObject = new JsonObject();
281+
emeraldObject.addProperty("time", tm.getEmerald().getTime());
282+
medalsObject.add("emerald", emeraldObject);
283+
284+
JsonObject diamondObject = new JsonObject();
285+
diamondObject.addProperty("time", tm.getDiamond().getTime());
286+
medalsObject.add("diamond", diamondObject);
287+
288+
JsonObject goldObject = new JsonObject();
289+
goldObject.addProperty("time", tm.getGold().getTime());
290+
medalsObject.add("gold", goldObject);
291+
292+
JsonObject silverObject = new JsonObject();
293+
silverObject.addProperty("time", tm.getSilver().getTime());
294+
medalsObject.add("silver", silverObject);
295+
296+
JsonObject copperObject = new JsonObject();
297+
copperObject.addProperty("time", tm.getCopper().getTime());
298+
medalsObject.add("copper", copperObject);
299+
300+
responseObject.add("medals", medalsObject);
301+
// END - Issue #24
302+
237303
JsonArray topListArray = new JsonArray();
238304
for (TimeTrialFinish finish : track.getTimeTrials().getTopList()) {
239305
JsonObject timeTrialFinishObject = new JsonObject();
@@ -294,6 +360,39 @@ public static void initSpark() {
294360
tagsArray.add(trackTag.getValue());
295361
}
296362
responseObject.add("tags", tagsArray);
363+
364+
// Issue #24 - Add Medals
365+
JsonObject medalsObject = new JsonObject();
366+
TrackMedals tm = track.getTrackMedals();
367+
medalsObject.addProperty("active", tm.isActive());
368+
369+
JsonObject netheriteObject = new JsonObject();
370+
netheriteObject.addProperty("time", tm.getNetherite().getTime());
371+
medalsObject.add("netherite", netheriteObject);
372+
373+
JsonObject emeraldObject = new JsonObject();
374+
emeraldObject.addProperty("time", tm.getEmerald().getTime());
375+
medalsObject.add("emerald", emeraldObject);
376+
377+
JsonObject diamondObject = new JsonObject();
378+
diamondObject.addProperty("time", tm.getDiamond().getTime());
379+
medalsObject.add("diamond", diamondObject);
380+
381+
JsonObject goldObject = new JsonObject();
382+
goldObject.addProperty("time", tm.getGold().getTime());
383+
medalsObject.add("gold", goldObject);
384+
385+
JsonObject silverObject = new JsonObject();
386+
silverObject.addProperty("time", tm.getSilver().getTime());
387+
medalsObject.add("silver", silverObject);
388+
389+
JsonObject copperObject = new JsonObject();
390+
copperObject.addProperty("time", tm.getCopper().getTime());
391+
medalsObject.add("copper", copperObject);
392+
393+
responseObject.add("medals", medalsObject);
394+
// END - Issue #24
395+
297396
JsonArray topListArray = new JsonArray();
298397
for (TimeTrialFinish finish : track.getTimeTrials().getTopList()) {
299398
JsonObject timeTrialFinishObject = new JsonObject();
@@ -421,7 +520,7 @@ public static void initSpark() {
421520
return "";
422521
});
423522
}
424-
523+
425524
public static void stopSpark() {
426525
stop();
427526
}

src/plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: TimingSystemRESTApi
2-
version: 1.2
2+
version: 2.0
33
authors: [Justin Brubaker (JustBru00)]
44
softdepend: [TimingSystem]
55
main: com.frosthex.timingsystem.restapi.TimingSystemRESTApiPlugin
6-
api-version: 1.19
6+
api-version: 1.21.4
77

88
commands:
99
timingsystemrestapi:

0 commit comments

Comments
 (0)