Skip to main content

AstroPlayerStats

v1.0.01.20+

AstroPlayerStats tracks player statistics including playtime, blocks broken, blocks placed, mob kills, and deaths. Stores data in SQLite and provides PlaceholderAPI placeholders.

Utility

Overview

AstroPlayerStats keeps a running record of what each player does on your server: how long they have played, how many blocks they have broken and placed, how many mobs they have killed and how many times they have died. Players check their own numbers with /stats, and staff can look up anyone, which turns vague impressions of who is active into concrete figures you can point at.

The data is stored in a local SQLite file, so there is no MySQL server to stand up and no database credentials to manage. That makes it genuinely drop-in for a single server: install the jar and it starts recording. Saves happen on a configurable interval and on shutdown, so a clean restart keeps the totals intact. Each tracked statistic can be switched off individually if you would rather not count, say, deaths.

Where it becomes powerful is the PlaceholderAPI integration. Every tracked value is exposed as a placeholder such as %astrostats_playtime%, which any PlaceholderAPI-aware plugin can read. That means you can surface playtime on a scoreboard, show kills in the tab list, build a top-players hologram, or gate a rank-up behind a playtime threshold, all without this plugin needing to know about those other plugins. It records the numbers; the rest of your setup decides how to display and use them.

Who it is for

Servers that reward or rank players by playtime or activity, communities that want a /stats command and leaderboards, and any setup that needs player metrics fed into scoreboards, tab lists or holograms through PlaceholderAPI.

Features

  • Tracks playtime per player
  • Counts blocks broken, blocks placed, mob kills, deaths
  • PlaceholderAPI integration (%astrostats_playtime%, etc.)
  • SQLite storage (no MySQL required)
  • Configurable: enable/disable specific stats

Commands

CommandDescriptionPermission
/statsShow your own statsastrostats.see
/stats <player>Show another player's statsastrostats.see.others
/astrostats reloadReload configastrostats.admin

Permissions

NodeDescriptionDefault
astrostats.seeUse /stats commandtrue
astrostats.see.othersView other players' statstrue
astrostats.adminUse reloadop

Example Config

# AstroPlayerStats Configuration
auto-save-interval: 300
track:
  playtime: true
  blocks-broken: true
  blocks-placed: true
  mob-kills: true
  deaths: true

auto-save-interval is in seconds and controls how often stats are flushed to the SQLite file (300 is every five minutes); data is also saved on shutdown. The track section turns each statistic on or off independently, so you can record playtime and kills while ignoring blocks placed, for example. Disabling a stat stops new data being counted for it without deleting existing records.

Installation

Drop AstroPlayerStats.jar into /plugins and restart. It uses an embedded SQLite database, so no MySQL is required and nothing extra needs configuring to start storing data. To display the stats elsewhere, install PlaceholderAPI; the plugin registers its placeholders automatically when PAPI is present. A config.yml is generated where you set the save interval and toggle individual stats.

Download

Frequently Asked Questions

Does this plugin require MySQL?

No. AstroPlayerStats stores everything in a local SQLite database file that it creates and manages itself, so there is no MySQL server to install or credentials to configure. This keeps it fully drop-in for a single server while still persisting data across restarts.

Which statistics does it track?

It records playtime, blocks broken, blocks placed, mob kills and deaths per player. Each one can be toggled on or off in the config under the track section, so you only count the metrics you actually care about.

How do I show stats on a scoreboard or tab list?

Install PlaceholderAPI. AstroPlayerStats registers placeholders such as %astrostats_playtime% that any PAPI-aware plugin can read, so a scoreboard, tab-list or hologram plugin can display the values. This plugin tracks the numbers; the display plugin renders them via the placeholders.

How does a player check their stats?

Players run /stats to see their own figures. Staff with the astrostats.see.others permission can run /stats <player> to view anyone else's. Both commands read straight from the stored data, so the numbers are current as of the last save.

Is the data lost when the server restarts?

No. Stats are written to the SQLite file on a configurable interval (auto-save-interval) and again on a clean shutdown, so a normal restart preserves all totals. A hard crash could lose changes since the last interval save, which is why the default save window is short.

Can I build a leaderboard with it?

Yes. Because the stats are exposed as PlaceholderAPI placeholders, a leaderboard or top-list plugin that reads PAPI placeholders can rank players by playtime, kills or any tracked value. AstroPlayerStats supplies the per-player numbers and the leaderboard plugin handles the ordering and display.

Tags

statsplaytimetrackerplaceholderapisqlite