From ffec968ad6ca79cb8ddd5e4de9266974fa1f4f90 Mon Sep 17 00:00:00 2001 From: peti Date: Wed, 11 Jan 2023 17:11:42 +0200 Subject: [PATCH] redo the embeds --- .../townydiscordcommands/NationCommand.java | 11 ++++---- .../townydiscordcommands/ResidentCommand.java | 17 +++++++----- .../townydiscordcommands/TownCommand.java | 27 ++++++++++++------- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/main/java/net/euromc/townydiscordcommands/NationCommand.java b/src/main/java/net/euromc/townydiscordcommands/NationCommand.java index ebdc6a1..81b45fa 100644 --- a/src/main/java/net/euromc/townydiscordcommands/NationCommand.java +++ b/src/main/java/net/euromc/townydiscordcommands/NationCommand.java @@ -25,12 +25,13 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) { } EmbedBuilder emb = new EmbedBuilder(); - emb.setTitle("Nation Statistics"); - emb.addField("Nation:", n.getName(), false); - emb.addField("Leader:", n.getKing().getName(), false); - emb.addField("Capital:", n.getCapital().getName(), false); - emb.addField("Town Count:", String.valueOf(n.getNumTowns()), false); emb.setColor(Color.GREEN); + emb.setThumbnail("https://static.wikia.nocookie.net/minecraft_gamepedia/images/1/1a/Diamond_Ore_JE1_BE1.png"); + emb.setTitle(n.getName()); + emb.setDescription("**Board:** " + n.getBoard()); + emb.addField("Leader:", n.getKing().getName(), true); + emb.addField("Capital:", n.getCapital().getName(), true); + emb.addField("Town Count:", String.valueOf(n.getNumTowns()), true); event.replyEmbeds(emb.build()).queue(); } diff --git a/src/main/java/net/euromc/townydiscordcommands/ResidentCommand.java b/src/main/java/net/euromc/townydiscordcommands/ResidentCommand.java index d37f349..a57205d 100644 --- a/src/main/java/net/euromc/townydiscordcommands/ResidentCommand.java +++ b/src/main/java/net/euromc/townydiscordcommands/ResidentCommand.java @@ -1,6 +1,7 @@ package net.euromc.townydiscordcommands; import com.palmergames.bukkit.towny.TownyAPI; +import com.palmergames.bukkit.towny.TownyEconomyHandler; import com.palmergames.bukkit.towny.object.Resident; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; @@ -27,17 +28,21 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) { } EmbedBuilder emb = new EmbedBuilder(); - emb.setTitle("Resident Statistics"); - emb.addField("Resident:", r.getName(), false); + emb.setTitle(r.getName()); + emb.setDescription("**Activity:** " + (r.isOnline() ? "ONLINE" : "OFFLINE")); + emb.setThumbnail("https://cravatar.eu/helmhead/" + r.getName() + "/600.png"); + emb.setColor(Color.GREEN); if (r.hasTown()) { - emb.addField("Town:", r.getTownOrNull().getName(), false); + emb.addField("Town:" , r.getTownOrNull().getName(), true); } if (r.hasNation()) { - emb.addField("Nation:" , r.getNationOrNull().getName(), false); + emb.addField("Nation: " , r.getNationOrNull().getName(), true); + } + if (TownyEconomyHandler.isActive()) { + emb.addField("Balance:", String.valueOf(r.getAccountOrNull().getHoldingBalance()), true); } - emb.addField("Activity:", r.isOnline() ? "ONLINE" : "OFFLINE" , false); - emb.setColor(Color.GREEN); event.replyEmbeds(emb.build()).queue(); + } } diff --git a/src/main/java/net/euromc/townydiscordcommands/TownCommand.java b/src/main/java/net/euromc/townydiscordcommands/TownCommand.java index e304ea8..f1c1e4f 100644 --- a/src/main/java/net/euromc/townydiscordcommands/TownCommand.java +++ b/src/main/java/net/euromc/townydiscordcommands/TownCommand.java @@ -1,6 +1,9 @@ package net.euromc.townydiscordcommands; import com.palmergames.bukkit.towny.TownyAPI; +import com.palmergames.bukkit.towny.TownyEconomyHandler; +import com.palmergames.bukkit.towny.TownySettings; +import com.palmergames.bukkit.towny.TownyUniverse; import com.palmergames.bukkit.towny.object.Town; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; @@ -28,18 +31,22 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) { } EmbedBuilder emb = new EmbedBuilder(); - emb.setTitle("Town Statistics"); - emb.addField("Town:", event.getInteraction().getOption("name").getAsString(), false); - emb.addField("Mayor:", t.getMayor().getName(), false); - emb.addField("Board:", t.getBoard(), false); + emb.setColor(Color.GREEN); + emb.setTitle(t.getName()); + emb.setDescription("**Board:** " + t.getBoard()); + emb.addField("Mayor:", t.getMayor().getName(), true); if (t.hasNation()) { - emb.addField("Nation:", t.getNationOrNull().getName(), false); + emb.addField("Nation:", t.getNationOrNull().getName(), true); } - emb.addField("Fire:", t.isFire() ? "ON" : "OFF", false); - emb.addField("Explosions:", t.isExplosion() ? "ON" : "OFF", false); - emb.addField("Mob Spawns:", t.hasMobs() ? "ON" : "OFF", false); - emb.addField("Resident Count:" , String.valueOf(t.getNumResidents()), false); - emb.setColor(Color.GREEN); + if (TownyEconomyHandler.isActive()) { + emb.addField("Bank:", String.valueOf(t.getAccount().getHoldingBalance()), true); + } + emb.addField("PVP:", t.isPVP() ? "ON" : "OFF", true); + emb.addField("Fire:", t.isFire() ? "ON" : "OFF", true); + emb.addField("Explosions:", t.isExplosion() ? "ON" : "OFF", true); + emb.addField("Mob Spawns:", t.hasMobs() ? "ON" : "OFF", true); + emb.addField("Resident Count:" , String.valueOf(t.getNumResidents()), true); + emb.setThumbnail("https://static.wikia.nocookie.net/minecraft_gamepedia/images/9/93/Grass_Block_JE7_BE6.png"); event.replyEmbeds(emb.build()).queue(); // success