Skip to content

Commit

Permalink
redo the embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
Gl0W1E committed Jan 11, 2023
1 parent a967d2c commit ffec968
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 21 deletions.
11 changes: 6 additions & 5 deletions src/main/java/net/euromc/townydiscordcommands/NationCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
17 changes: 11 additions & 6 deletions src/main/java/net/euromc/townydiscordcommands/ResidentCommand.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();

}
}
27 changes: 17 additions & 10 deletions src/main/java/net/euromc/townydiscordcommands/TownCommand.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ffec968

Please sign in to comment.