RA-DiscordProfile

A Discord bot that runs inside a Paper 1.21.x plugin and shows player profile cards, leaderboards, and stat comparisons with /profile, /leaderboard, and /compare, using PlaceholderAPI stats.

Author: RajaAditya Website: rajaaditya.my.id Version: 1.0.0 API: Paper 1.21.4 (Java 21)


Features

Profile Cards

  • /profile <player> in Discord returns a PNG profile card drawn by the plugin, with the player's skin, rank, join date, and chosen stats
  • Player names autocomplete in Discord
  • Bedrock players get a Bedrock badge, and their avatar is fetched from the GeyserMC skin API
  • Colors, size, font (.ttf), and date format of the card are configurable

Leaderboards and Comparison

  • /leaderboard <category> shows the top 10 for a stat
  • /compare <player1> <player2> compares every stat side by side

Your Own Stats

  • Any PlaceholderAPI placeholder can become a stat, for example %vault_eco_balance%, %racoins_balance%, or %statistic_seconds_played%
  • Stat formats: number, decimal, or time
  • Playtime can be tracked by the plugin itself (from join and quit plus the running session) instead of vanilla statistics
  • Stats that cannot be read as a number are kept as text and left out of leaderboards

Built for Servers

  • All players online are saved on an interval (default every 5 minutes) and when the server stops
  • A cooldown per Discord user prevents spam
  • Saving and every Discord or HTTP call run asynchronously. PlaceholderAPI, LuckPerms, and Floodgate are read only on the main thread
  • Slash commands are registered per guild, so they appear immediately

Dependencies

PluginRequiredPurpose
PlaceholderAPIPractically yesNeeded for placeholder-based stats, plus the expansions you use (for example /papi ecloud download Vault)
VaultNo (softdepend)Money stat
LuckPermsNo (softdepend)Rank on the card
FloodgateNo (softdepend)Bedrock detection

You also need a Discord bot. No privileged gateway intent is required.


Installation

1. Create the bot

  1. Open the Discord Developer Portal and create a New Application
  2. In Bot, reset the token and copy it into bot.token in config.yml
  3. In OAuth2, URL Generator, choose the scopes bot and applications.commands, and the permissions Send Messages, Embed Links, Attach Files, and Use Slash Commands
  4. Open the generated URL and add the bot to your server
  5. Turn on Developer Mode in Discord, copy your server ID, and put it in bot.guild-id

2. Install the plugin

  1. Place RA-DiscordProfile.jar into your plugins/ folder (JDA, HikariCP, and SQLite are bundled)
  2. Restart the server, fill in config.yml, and run /discordprofile reload

Keep the bot token private and never commit config.yml to a public repository.


File Structure

text
1
plugins/RA-DiscordProfile/
├── config.yml       # Token, guild, cooldowns, card look, stats
├── messages.yml     # All text: Discord replies, card labels, in-game messages
├── data.db          # SQLite (WAL): snapshots and playtime
└── *.ttf            # Optional card font

Configuration

config.yml

yaml
1
bot:
  token: "YOUR_BOT_TOKEN"
  guild-id: "YOUR_GUILD_ID"
  activity:
    type: PLAYING            # PLAYING, WATCHING, LISTENING, COMPETING, CUSTOM_STATUS
    text-key: "bot-activity" # key in messages.yml
  status: ONLINE
  shutdown-timeout-seconds: 10

settings:
  bedrock-prefix: "."        # same as username-prefix in Floodgate
  autocomplete-max: 25
  leaderboard-size: 10
  command-cooldown-seconds: 5
  snapshot-interval-minutes: 5

card:
  width: 900
  height: 400
  accent-color: "#5865F2"
  background-color: "#1E1F26"
  panel-color: "#2A2C36"
  text-color: "#FFFFFF"
  muted-color: "#9CA3AF"
  font-file: ""              # .ttf in the plugin folder, empty = first one found
  cache-minutes: 5
  skin-cache-minutes: 30
  skin-url: "https://mc-heads.net/body/{name}/right"   # supports {uuid} and {name}
  date-format: "dd MMM yyyy"
  timezone: "Asia/Jakarta"

stats:
  coins:
    placeholder: "%racoins_balance%"
    display: "Coins"
    format: "number"         # number, decimal, or time
    leaderboard: true        # show as a /leaderboard choice
  playtime:
    placeholder: "%statistic_seconds_played%"
    display: "Playtime"
    format: "time"
    leaderboard: true

On offline-mode servers, use {name} in skin-url, because the UUID is not known to the skin service. For plugin-tracked playtime use source: internal with the key playtime.

After changing the stats list, run /discordprofile reload.


Commands

Discord

CommandDescription
/profile <player>Profile card as an image
/leaderboard <category>Top 10 of a stat
/compare <player1> <player2>Compare all stats of two players

In game

CommandDescriptionAccess
/discordprofile reload (alias /dprofile)Reload the config, messages, and stats. The bot restarts only if the token or guild ID changedAdmin
/discordprofile syncSave every online player nowAdmin

Permissions

PermissionDefaultDescription
raprofile.adminopUse /discordprofile

License

Developed by RajaAditya — rajaaditya.my.id