Skip to content

Commit dad48c6

Browse files
committed
More monthlies
1 parent 4f48ffb commit dad48c6

24 files changed

+637
-64
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package pw.roccodev.beezig.hiveapi.wrapper.monthly;
2+
3+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject;
4+
5+
public class PvPMonthlyProfile extends RoccoDevMonthlyProfile {
6+
7+
public PvPMonthlyProfile(JObject source) {
8+
super(source);
9+
}
10+
11+
public long getKills() {
12+
return source.getLong("kills");
13+
}
14+
15+
public long getDeaths() {
16+
return source.getLong("deaths");
17+
}
18+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package pw.roccodev.beezig.hiveapi.wrapper.monthly;
2+
3+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject;
4+
5+
public class RoccoDevMonthlyProfile extends MonthlyProfile {
6+
7+
public RoccoDevMonthlyProfile(JObject source) {
8+
super(source);
9+
}
10+
11+
@Override
12+
public long getPoints() {
13+
return source.getLong("points");
14+
}
15+
16+
@Override
17+
public long getPlace() {
18+
return source.getLong("place");
19+
}
20+
21+
public String getUsername() {
22+
return source.getString("username");
23+
}
24+
25+
26+
}

src/main/java/pw/roccodev/beezig/hiveapi/wrapper/monthly/bed/BedMonthlyProfile.java

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package pw.roccodev.beezig.hiveapi.wrapper.monthly.bed;
22

3-
import pw.roccodev.beezig.hiveapi.wrapper.monthly.MonthlyProfile;
3+
import pw.roccodev.beezig.hiveapi.wrapper.monthly.PvPMonthlyProfile;
44
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject;
55

6-
public class BedMonthlyProfile extends MonthlyProfile {
6+
public class BedMonthlyProfile extends PvPMonthlyProfile {
77

88

99
private JObject source;
@@ -13,16 +13,6 @@ public BedMonthlyProfile(JObject source) {
1313
this.source = source;
1414
}
1515

16-
@Override
17-
public long getPoints() {
18-
return source.getLong("points");
19-
}
20-
21-
@Override
22-
public long getPlace() {
23-
return source.getLong("place");
24-
}
25-
2616
public long getVictories() {
2717
return source.getLong("victories");
2818
}
@@ -31,14 +21,6 @@ public String getUsername() {
3121
return source.getString("name");
3222
}
3323

34-
public long getKills() {
35-
return source.getLong("kills");
36-
}
37-
38-
public long getDeaths() {
39-
return source.getLong("deaths");
40-
}
41-
4224
public long getGamesPlayed() {
4325
return source.getLong("played");
4426
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package pw.roccodev.beezig.hiveapi.wrapper.monthly.bp;
2+
3+
import org.json.simple.JSONObject;
4+
import pw.roccodev.beezig.hiveapi.wrapper.monthly.MonthlyLeaderboard;
5+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject;
6+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.LazyObject;
7+
8+
import java.util.ArrayList;
9+
import java.util.List;
10+
import java.util.Map;
11+
12+
public class BpMonthlyLeaderboard extends MonthlyLeaderboard {
13+
14+
private JObject source;
15+
16+
public BpMonthlyLeaderboard(JObject source) {
17+
super(source);
18+
this.source = source;
19+
}
20+
21+
@Override
22+
public List<BpMonthlyProfile> getProfiles() {
23+
if(source instanceof LazyObject) ((LazyObject)source).fetch();
24+
25+
List<BpMonthlyProfile> profiles = new ArrayList<>();
26+
27+
JSONObject rawData = source.getInput();
28+
for(Object profile : rawData.entrySet()) {
29+
Map.Entry<String, JSONObject> entry = (Map.Entry<String, JSONObject>) profile;
30+
31+
profiles.add(new BpMonthlyProfile(new JObject(entry.getValue())));
32+
}
33+
34+
return profiles;
35+
}
36+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package pw.roccodev.beezig.hiveapi.wrapper.monthly.bp;
2+
3+
import pw.roccodev.beezig.hiveapi.wrapper.monthly.RoccoDevMonthlyProfile;
4+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject;
5+
6+
public class BpMonthlyProfile extends RoccoDevMonthlyProfile {
7+
8+
private JObject source;
9+
10+
public BpMonthlyProfile(JObject source) {
11+
super(source);
12+
this.source = source;
13+
}
14+
15+
public long getVictories() {
16+
return source.getLong("victories");
17+
}
18+
19+
public long getGamesPlayed() {
20+
return source.getLong("played");
21+
}
22+
23+
public long getPlacings() {
24+
return source.getLong("placings");
25+
}
26+
27+
public long getEliminations() {
28+
return source.getLong("eliminations");
29+
}
30+
31+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package pw.roccodev.beezig.hiveapi.wrapper.monthly.cai;
2+
3+
import org.json.simple.JSONObject;
4+
import pw.roccodev.beezig.hiveapi.wrapper.monthly.MonthlyLeaderboard;
5+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject;
6+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.LazyObject;
7+
8+
import java.util.ArrayList;
9+
import java.util.List;
10+
import java.util.Map;
11+
12+
public class CaiMonthlyLeaderboard extends MonthlyLeaderboard {
13+
14+
private JObject source;
15+
16+
public CaiMonthlyLeaderboard(JObject source) {
17+
super(source);
18+
this.source = source;
19+
}
20+
21+
@Override
22+
public List<CaiMonthlyProfile> getProfiles() {
23+
if(source instanceof LazyObject) ((LazyObject)source).fetch();
24+
25+
List<CaiMonthlyProfile> profiles = new ArrayList<>();
26+
27+
JSONObject rawData = source.getInput();
28+
for(Object profile : rawData.entrySet()) {
29+
Map.Entry<String, JSONObject> entry = (Map.Entry<String, JSONObject>) profile;
30+
31+
profiles.add(new CaiMonthlyProfile(new JObject(entry.getValue())));
32+
}
33+
34+
return profiles;
35+
}
36+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package pw.roccodev.beezig.hiveapi.wrapper.monthly.cai;
2+
3+
import pw.roccodev.beezig.hiveapi.wrapper.monthly.RoccoDevMonthlyProfile;
4+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject;
5+
6+
public class CaiMonthlyProfile extends RoccoDevMonthlyProfile {
7+
8+
private JObject source;
9+
10+
public CaiMonthlyProfile(JObject source) {
11+
super(source);
12+
this.source = source;
13+
}
14+
15+
public long getVictories() {
16+
return source.getLong("victories");
17+
}
18+
19+
public long getGamesPlayed() {
20+
return source.getLong("played");
21+
}
22+
23+
public long getCaptures() {
24+
return source.getLong("captures");
25+
}
26+
27+
public long getCaught() {
28+
return source.getLong("caught");
29+
}
30+
31+
}
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package pw.roccodev.beezig.hiveapi.wrapper.monthly.dr;
22

3-
import pw.roccodev.beezig.hiveapi.wrapper.monthly.MonthlyProfile;
3+
import pw.roccodev.beezig.hiveapi.wrapper.monthly.PvPMonthlyProfile;
44
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject;
55

6-
public class DrMonthlyProfile extends MonthlyProfile {
6+
public class DrMonthlyProfile extends PvPMonthlyProfile {
77

88
private JObject source;
99

@@ -12,20 +12,6 @@ public DrMonthlyProfile(JObject source) {
1212
this.source = source;
1313
}
1414

15-
@Override
16-
public long getPoints() {
17-
return source.getLong("points");
18-
}
19-
20-
public String getUsername() {
21-
return source.getString("username");
22-
}
23-
24-
@Override
25-
public long getPlace() {
26-
return source.getLong("place");
27-
}
28-
2915
public long getVictories() {
3016
return source.getLong("victories");
3117
}
@@ -34,12 +20,4 @@ public long getGamesPlayed() {
3420
return source.getLong("played");
3521
}
3622

37-
public long getKills() {
38-
return source.getLong("kills");
39-
}
40-
41-
public long getDeaths() {
42-
return source.getLong("deaths");
43-
}
44-
4523
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package pw.roccodev.beezig.hiveapi.wrapper.monthly.gnt;
2+
3+
import org.json.simple.JSONObject;
4+
import pw.roccodev.beezig.hiveapi.wrapper.monthly.MonthlyLeaderboard;
5+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject;
6+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.LazyObject;
7+
8+
import java.util.ArrayList;
9+
import java.util.List;
10+
import java.util.Map;
11+
12+
public class GntMonthlyLeaderboard extends MonthlyLeaderboard {
13+
14+
private JObject source;
15+
16+
public GntMonthlyLeaderboard(JObject source) {
17+
super(source);
18+
this.source = source;
19+
}
20+
21+
@Override
22+
public List<GntMonthlyProfile> getProfiles() {
23+
if(source instanceof LazyObject) ((LazyObject)source).fetch();
24+
25+
List<GntMonthlyProfile> profiles = new ArrayList<>();
26+
27+
JSONObject rawData = source.getInput();
28+
for(Object profile : rawData.entrySet()) {
29+
Map.Entry<String, JSONObject> entry = (Map.Entry<String, JSONObject>) profile;
30+
31+
profiles.add(new GntMonthlyProfile(new JObject(entry.getValue())));
32+
}
33+
34+
return profiles;
35+
}
36+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package pw.roccodev.beezig.hiveapi.wrapper.monthly.gnt;
2+
3+
import pw.roccodev.beezig.hiveapi.wrapper.monthly.PvPMonthlyProfile;
4+
import pw.roccodev.beezig.hiveapi.wrapper.utils.json.JObject;
5+
6+
public class GntMonthlyProfile extends PvPMonthlyProfile {
7+
8+
private JObject source;
9+
10+
public GntMonthlyProfile(JObject source) {
11+
super(source);
12+
this.source = source;
13+
}
14+
15+
public long getVictories() {
16+
return source.getLong("victories");
17+
}
18+
19+
public long getGamesPlayed() {
20+
return source.getLong("played");
21+
}
22+
}

0 commit comments

Comments
 (0)