Skip to content

Commit 7de0621

Browse files
committed
Remove caching of getMembers()
1 parent 46068f9 commit 7de0621

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/main/java/material/clan/Clan.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,35 +62,35 @@ public Clan(long clanId, String clanName) {
6262
}
6363

6464
public String getClanID() {
65-
if(clanId == -1) {
65+
if (clanId == -1) {
6666
clanId = getDetail().get("groupId").getAsLong();
6767
}
6868
return clanId + "";
6969
}
7070

7171
public String getClanName() {
72-
if(clanName == null) {
72+
if (clanName == null) {
7373
getDetail().get("name").getAsString();
7474
}
7575
return clanName;
7676
}
7777

7878
public String getClanDescription() {
79-
if(clanDescription == null) {
79+
if (clanDescription == null) {
8080
clanDescription = getDetail().get("about").getAsString();
8181
}
8282
return clanDescription;
8383
}
8484

8585
public Date getCreationDate() {
86-
if(creationDate == null) {
86+
if (creationDate == null) {
8787
creationDate = StringUtils.valueOfZTime(getDetail().get("creationDate").getAsString());
8888
}
8989
return creationDate;
9090
}
9191

9292
public int getMemberCount() {
93-
if(memberCount == -1) {
93+
if (memberCount == -1) {
9494
memberCount = getDetail().get("memberCount").getAsInt();
9595
}
9696
return memberCount;
@@ -101,7 +101,7 @@ public boolean isPublic() {
101101
}
102102

103103
public String getMotto() {
104-
if(motto == null) {
104+
if (motto == null) {
105105
motto = getDetail().get("motto").getAsString();
106106
}
107107
return motto;
@@ -157,7 +157,7 @@ public List<BungieUser> getMostInactiveMembers(int numberOfResults, String... ex
157157
List<BungieUser> sorted = new LinkedList<>();
158158
BungieUser temp = null;
159159

160-
for(int i = 0; i < numberOfResults; i++) {
160+
for (int i = 0; i < numberOfResults; i++) {
161161
for (BungieUser bungieUser : list) {
162162
if (temp != null) {
163163
if (temp != bungieUser && !sorted.contains(bungieUser) && !exlcluded.contains(bungieUser.getBungieMembershipID())) {
@@ -200,9 +200,7 @@ public List<BungieUser> getMembers() {
200200
List<BungieUser> source = new ArrayList<>();
201201
List<String> stream = new ArrayList<>();
202202

203-
if (jj == null) {
204-
jj = hu.urlRequestGET("https://www.bungie.net/Platform/GroupV2/" + getClanID() + "/Members/").get("Response").getAsJsonObject();
205-
}
203+
jj = hu.urlRequestGET("https://www.bungie.net/Platform/GroupV2/" + getClanID() + "/Members/").get("Response").getAsJsonObject();
206204

207205
for (JsonElement jsonElement : jj.getAsJsonArray("results")) {
208206
stream.add(jsonElement.getAsJsonObject().getAsJsonObject("destinyUserInfo").get("membershipId").getAsString());
@@ -236,13 +234,7 @@ public List<BungieUser> getMembers() {
236234
public List<BungieUser> getMembersOld() {
237235
List<BungieUser> temp = new ArrayList<>();
238236

239-
if (members != null) {
240-
return members;
241-
}
242-
243-
if (jj == null) {
244-
jj = hu.urlRequestGET("https://www.bungie.net/Platform/GroupV2/" + getClanID() + "/Members/").get("Response").getAsJsonObject();
245-
}
237+
jj = hu.urlRequestGET("https://www.bungie.net/Platform/GroupV2/" + getClanID() + "/Members/").get("Response").getAsJsonObject();
246238

247239
for (JsonElement je : jj.getAsJsonArray("results")) {
248240
CompletableFuture<BungieUser> cf = new CompletableFuture<>();

0 commit comments

Comments
 (0)