Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Commit

Permalink
are you happy now lifeknight
Browse files Browse the repository at this point in the history
  • Loading branch information
GamingGeek committed Jun 16, 2020
1 parent fcabec0 commit 50ba377
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main/java/dev/gaminggeek/mojangstatus/StatusCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class StatusCheck {

public JsonObject getServiceStatus(JsonArray arr) {
JsonObject obj = new JsonObject();
for (JsonElement element: arr.getAsJsonArray()) {
for (JsonElement element : arr.getAsJsonArray()) {
JsonObject e = element.getAsJsonObject();
for (String service: services) {
for (String service : services) {
if (e.has(service)) {
obj.addProperty(service, e.get(service).getAsString());
}
Expand All @@ -45,11 +45,13 @@ public JsonObject getStatus() throws Exception {

final JsonElement[] status = new JsonElement[1];
client.newCall(request).enqueue(new Callback() {
@Override public void onFailure(@NotNull Call call, @NotNull IOException e) {
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
e.printStackTrace();
}

@Override public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);

Expand Down Expand Up @@ -149,7 +151,7 @@ public JsonArray getChanged(JsonObject before, JsonObject after) {
JsonArray changed = new JsonArray();
if (getSize(before) == 0 || getSize(after) == 0) return changed;
StatusConfig config = MojangStatus.statusConfig;
for (String k: services) {
for (String k : services) {
if (!(before.get(k).equals(after.get(k)))) {
JsonObject placebo = new JsonObject();
placebo.addProperty(k, after.get(k).getAsString());
Expand Down Expand Up @@ -177,7 +179,7 @@ public JsonObject fakeStatus() {

public Integer getSize(JsonObject obj) {
Integer size = 0;
for (Map.Entry<String, JsonElement> e: obj.entrySet()) {
for (Map.Entry<String, JsonElement> e : obj.entrySet()) {
size++;
}
return size;
Expand All @@ -204,7 +206,7 @@ public JsonObject getServicesConfig() {
public Set<String> getServicesSet() {
JsonArray services = servicesConfig.getAsJsonArray("services");
Set<String> keys = new HashSet<>();
for (JsonElement s: services) {
for (JsonElement s : services) {
keys.add(s.getAsString());
}
return keys;
Expand Down

0 comments on commit 50ba377

Please sign in to comment.