From 0bbf2635b76352c241dcfe0f85c14e2e9a73405b Mon Sep 17 00:00:00 2001 From: bowser0000 Date: Sat, 12 Sep 2020 22:16:26 -0400 Subject: Add amount of pets and guild members to commands --- src/main/java/me/Danker/commands/GuildOfCommand.java | 3 +++ src/main/java/me/Danker/commands/PetsCommand.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java/me/Danker') diff --git a/src/main/java/me/Danker/commands/GuildOfCommand.java b/src/main/java/me/Danker/commands/GuildOfCommand.java index 238ba81..dca1974 100644 --- a/src/main/java/me/Danker/commands/GuildOfCommand.java +++ b/src/main/java/me/Danker/commands/GuildOfCommand.java @@ -83,12 +83,14 @@ public class GuildOfCommand extends CommandBase { String guildName = "N/A"; String guildMaster = "N/A"; + int players = 0; // Check if player is in guild if (!guildResponse.get("guild").isJsonNull()) { guildName = guildResponse.get("guild").getAsJsonObject().get("name").getAsString(); // Loop through members to find guildmaster JsonArray guildMembers = guildResponse.get("guild").getAsJsonObject().get("members").getAsJsonArray(); + players = guildMembers.size(); for (JsonElement member : guildMembers) { JsonObject memberObject = member.getAsJsonObject(); String memberRank = memberObject.get("rank").getAsString(); @@ -109,6 +111,7 @@ public class GuildOfCommand extends CommandBase { EnumChatFormatting.AQUA + " " + username + "'s Guild:\n" + EnumChatFormatting.GREEN + " Guild: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + guildName + "\n" + EnumChatFormatting.GREEN + " Guildmaster: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + guildMaster + "\n" + + EnumChatFormatting.GREEN + " Members: " + EnumChatFormatting.DARK_GREEN + EnumChatFormatting.BOLD + players + "\n" + EnumChatFormatting.AQUA + " " + EnumChatFormatting.BOLD + "-------------------")); }).start(); } diff --git a/src/main/java/me/Danker/commands/PetsCommand.java b/src/main/java/me/Danker/commands/PetsCommand.java index c697689..2ad196e 100644 --- a/src/main/java/me/Danker/commands/PetsCommand.java +++ b/src/main/java/me/Danker/commands/PetsCommand.java @@ -159,8 +159,9 @@ public class PetsCommand extends CommandBase { } } + int totalPets = commonPets.size() + uncommonPets.size() + rarePets.size() + epicPets.size() + legendaryPets.size(); String finalMessage = EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD + "-------------------\n" + - EnumChatFormatting.AQUA + " " + username + "'s Pets:\n"; + EnumChatFormatting.AQUA + " " + username + "'s Pets (" + totalPets + "):\n"; // Loop through pet rarities for (JsonObject legPet : legendaryPets) { -- cgit