Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ProfileCommand): remove name history #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/main/java/org/manjot/commands/minecraft/ProfileCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,10 @@ private static MessageEmbed getAsEmbed(JsonObject profile) {
embed.setTitle("Profile");
embed.addField("IGN", "```fix\n" + profile.get("name").getAsString() + "```", true);
embed.addField("UUID", "```" + profile.get("id").getAsString() + "```", true);
embed.addField("Name History", getNameHistory(profile.get("name_history").getAsJsonArray()), false);
embed.setThumbnail("https://mc-heads.net/head/" + profile.get("id").getAsString() + "/left");
return embed.build();
}

private static String getNameHistory(JsonArray history) {
String nameHistory = "";
for (int i = history.size() - 1; i >= 0; i--) {
JsonObject nameObject = history.get(i).getAsJsonObject();
SimpleDateFormat formatter = new SimpleDateFormat("(dd/MM/yyyy)");
String nameString = nameObject.get("name").getAsString();
String dateString = nameObject.get("changedToAt") != null
? formatter.format(new Date(nameObject.get("changedToAt").getAsLong()))
: "(Original Name)";
nameHistory += "```" + nameString + " " + dateString + "```";
}
return nameHistory;
}

@Override
public void onCommand(JDA jda, MessageReceivedEvent event, User author, Member member, Guild guild,
MessageChannel channel, Message message, String prefix, String[] args) {
Expand Down