diff --git a/src/main/java/net/earthmc/emcapi/endpoint/ServerEndpoint.java b/src/main/java/net/earthmc/emcapi/endpoint/ServerEndpoint.java index c7491f7..8606544 100644 --- a/src/main/java/net/earthmc/emcapi/endpoint/ServerEndpoint.java +++ b/src/main/java/net/earthmc/emcapi/endpoint/ServerEndpoint.java @@ -4,13 +4,16 @@ import com.palmergames.bukkit.towny.TownyAPI; import com.palmergames.bukkit.towny.TownySettings; import io.minimum.minecraft.superbvote.SuperbVote; +import io.minimum.minecraft.superbvote.votes.VoteParty; import net.earthmc.emcapi.object.endpoint.GetEndpoint; import net.earthmc.emcapi.util.EndpointUtils; +import au.lupine.quarters.object.entity.Quarter; import au.lupine.quarters.api.manager.QuarterManager; import org.bukkit.Bukkit; import org.bukkit.World; import java.time.LocalTime; +import java.util.List; public class ServerEndpoint extends GetEndpoint { @@ -37,7 +40,7 @@ public JsonObject getJsonElement() { JsonObject statusObject = new JsonObject(); statusObject.addProperty("hasStorm", overworld.hasStorm()); - statusObject.addProperty("isThundering", overworld.hasStorm()); + statusObject.addProperty("isThundering", overworld.isThundering()); serverObject.add("status", statusObject); JsonObject statsObject = new JsonObject(); @@ -51,12 +54,16 @@ public JsonObject getJsonElement() { statsObject.addProperty("numTowns", townyAPI.getTowns().size()); statsObject.addProperty("numTownBlocks", townyAPI.getTownBlocks().size()); statsObject.addProperty("numNations", townyAPI.getNations().size()); - statsObject.addProperty("numQuarters", quarterManager.getAllQuarters().size()); - statsObject.addProperty("numCuboids", quarterManager.getAllQuarters().stream().mapToInt(quarter -> quarter.getCuboids().size()).sum()); + + List quarters = quarterManager.getAllQuarters(); + statsObject.addProperty("numQuarters", quarters.size()); + statsObject.addProperty("numCuboids", quarters.parallelStream().mapToInt(q -> q.getCuboids().size()).sum()); + serverObject.add("stats", statsObject); - int target = SuperbVote.getPlugin().getVoteParty().votesNeeded(); - int currentVotes = SuperbVote.getPlugin().getVoteParty().getCurrentVotes(); + VoteParty voteParty = SuperbVote.getPlugin().getVoteParty(); + int target = voteParty.votesNeeded(); + int currentVotes = voteParty.getCurrentVotes(); JsonObject votePartyObject = new JsonObject(); votePartyObject.addProperty("target", target); @@ -65,4 +72,4 @@ public JsonObject getJsonElement() { return serverObject; } -} +} \ No newline at end of file