Note: the original plugin and almost all of the work done on it is by croemmich. He doesn't have the time to work it any more, so he's allowed me to maintain it.

OnlineUsers is a simple plugin that maintains a flatfile or MySQL table with logged in users. Make sure to install the MySQL JDBC driver if you choose to use MySQL. You can obtain it from here:
You can simply drop it in your server root folder, alongside the CraftBukkit jar. It will need to be named mysql-connector-java-bin.jar. Alternately, if you know how, you should be able to include it in your Java path.

  • destination=mysql #[mysql|flatfile]
  • flatfile=online_users.txt #location of the flatfile to write
  • flatfile-template=online_users.template #template used for creating the flatfile
  • #data used to fill the flatfile
  • remove-offline-users=true #Set to false to keep users in table when logged off.
  • db=jdbc\:mysql\:localhost\:3306/minecraft
  • user=root
  • table=users_online#Will be created for you when the plugin is enabled
  • pass=root

Note that the new `time_total` column is only updated when players disconnect. So, if a player is currently connected, that column won't account for the additional time they've been online in their current session. If you want to get a fully up-to-date value for how long they've been online, you can account for it in your query.
For example, this query would give you the up-to-date value as `current_time_total`:

SELECT *, IF(`online`=1, `time_total` + TIMESTAMPDIFF(SECOND, `time`, NOW()), `time_total`) AS `current_time_total` FROM `users_online`

If you're using an older release that 1.6.2, the query would instead look like this due to the different data type for `time_total`:

SELECT *, IF(`online`=1, ADDTIME(`time_total`, TIMEDIFF(NOW(),  `time`)), `time_total`) AS `current_time_total` FROM  `users_online`

An example PHP script to read from file output from this plugin can be found here.


  • 1.8.0 - Player UUID is now tracked in database and used as unique key, with the player's name updated at each login in case it has changed, so that time online is properly attached to unique player account rather than (soon to be) non-unique player name. dl
  • 1.7.0 - Major efficiency boost by running a separate async task thread to handle adding/removing players from the database or flatfile. Previously this was handled entirely in the player join and quit listeners, thus holding up the main server thread for however long it took. dl
  • 1.6.3 - Fix for newly created MySQL database tables missing the 'online' column; thanks to AxxiD for pointing it out. MySQL tables which are missing that column will retroactively have it added. dl
  • 1.6.2 - IMPORTANT: BREAKING CHANGE for MySQL users: For MySQL data storage, time_total column type is changed from TIME to INT (read notes here) dl
  • 1.6.1 - Primarily a compatibility release to support the upcoming CB 1.1-R5 and above. Update to use the new Bukkit event system. Fix for timestamps showing 12-based hour instead of 24-based as it was supposed to be. Removed the plugin's "loading" and "shutting down" log messages since Bukkit now handles those itself. dl
  • 1.6 - added new database column `time_total` to track how long a player has spent on your server (MySQL only). dl
  • 1.5.5 - fix for {longtime} and {shorttime} (in flatfile template) both outputting the same thing. dl
  • 1.5.4 - Brettflan is now the owner. Updated for 612+ dl
  • 1.5 - Fix MySQL issues. Move OnlineUsers directory to plugins. dl
  • 1.4 - Initial Release dl

Source -

If you appreciate this plugin, you are welcome to


  • To post a comment, please or register a new account.
Posts Quoted:
Clear All Quotes

About This Project

  • Project ID
  • Created
    Sep 1, 2011
  • Last Released File
    Mar 9, 2016
  • Total Downloads
  • License



Recent Files