use of de.c0debase.bot.database.model.User in project c0debaseBot by Biospheere.
the class RankCommand method execute.
@Override
public void execute(final String[] args, final Message message) {
final Member member = DiscordUtils.getAddressedMember(message);
final EmbedBuilder embedBuilder = getEmbed(message.getGuild(), member.getUser());
final User user = bot.getDatabase().getUserDao().getOrCreateUser(member.getGuild().getId(), member.getUser().getId());
embedBuilder.addField("Level", String.valueOf(user.getLevel()), false);
embedBuilder.addField("Exp", user.getXp() + "/" + (user.getLevel() == 0 ? "1000" : (1000 * user.getLevel() * 1.2)), false);
if (user.getLevel() == 0 || user.getLevel() == 1) {
embedBuilder.addField("Total Exp", String.valueOf(user.getLevel() == 0 ? user.getXp() : user.getXp() + 1000), false);
} else {
embedBuilder.addField("Total Exp", String.valueOf(Double.valueOf(((1000 * (user.getLevel() - 1) * 1.2) * user.getLevel()) / 2 + 1000 + user.getXp())), false);
}
message.getTextChannel().sendMessage(embedBuilder.build()).queue();
}
Aggregations