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

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of LanToaster LanToaster Jun 25, 2014 at 09:39 UTC - 0 likes

    Weeeell, fun or not, I suppose it needs to be done.

    Well, Thanks for the Info. I will need to find a solution to that problem.

  • Avatar of Brettflan Brettflan Jun 25, 2014 at 08:22 UTC - 0 likes

    @LanToaster: Go

    The UUID column is used as the primary key for the table now, and is how existing rows are matched and updated. It needs to actually contain the user's UUID and wouldn't work otherwise.

    If you can do a lookup of all of the users' UUIDs and actually insert that for each row, and then switch the primary key for the table to be the UUID column, that should work. It wouldn't be a fun task, though, that's for sure.

  • Avatar of LanToaster LanToaster Jun 24, 2014 at 22:35 UTC - 0 likes

    Is there a way around the DataWipe?

    I added several colums to the table, to store additional UserData (Like Money, Used Title, Punishments, UserRank and stuff).
    It would be veeery inconvenient to lose that data.

    Anyway. Thanks for the Quick update.

    Edit: I just read the description on the Changelog.
    How would it react if I inserted the Userlist with an Empty UUID Column?

    Last edited Jun 24, 2014 by LanToaster
  • Avatar of Brettflan Brettflan Jun 24, 2014 at 04:38 UTC - 0 likes

    Version 1.8.0 is now released and will be available once it's approved by the BukkitDev team.

    This version adds a new database column for UUID, which is now used as the unique identifier for player data. Note that as a result all old data will be wiped. Read the changelog notes on the file listing for more details on why.

    This update doesn't affect flatfile data whatsoever, only database data.

    Last edited Jun 24, 2014 by Brettflan
  • Avatar of CrappyCow CrappyCow Sep 08, 2013 at 19:13 UTC - 0 likes

    I Can't Read Now O_O HELPZ!

  • Avatar of Brettflan Brettflan Jun 07, 2013 at 21:58 UTC - 0 likes

    @Bogblob: Go

    Flatfile doesn't. MySQL does. Of course you didn't specify.

  • Avatar of Bogblob Bogblob Jun 07, 2013 at 21:46 UTC - 0 likes

    Hey, i might be doing something wrong but this isnt counting the total time online


  • Avatar of Arthurdes Arthurdes May 16, 2013 at 10:44 UTC - 0 likes

    @Brettflan: Go my "online_users.settings"

    #Minecraft Properties File
    #Wed May 15 23:53:27 CST 2013

    2013-05-16 23:06:04 [INFO] [OnlineUsers] Disabling OnlineUsers v1.7.0
    2013-05-16 23:06:04 [SEVERE] OnlineUsers: Access denied for user 'art'@'localhost' (using password: YES)
    2013-05-16 23:06:04 [SEVERE] Could not connect to the database. Check your credentials in online-users.settings
    2013-05-16 23:06:04 [SEVERE] OnlineUsers: null
    2013-05-16 23:06:04 [SEVERE] OnlineUsers: could not execute the sql "UPDATE `users_online` SET `time_total` = IF(`online`=1, `time_total` + TIMESTAMPDIFF(SECOND, `time`, NOW()), `time_total`), `online`=0"

    i think....i will give up....

    Last edited May 16, 2013 by Arthurdes
  • Avatar of Brettflan Brettflan May 15, 2013 at 19:07 UTC - 0 likes

    @Arthurdes: Go

    If you already have a MySQL lib in Java's classpath you might not need that connector, but normally you do if you want to use MySQL with this plugin.

    This line:

    ...means it will try to connect to MySQL on localhost at port 3306 (the default MySQL port), and will use the database named "minecraft" (thus the "/minecraft" at the end). From your screenshot it looks like you already have that database set up.

    None of that should have any bearing whatsoever on using PHP to read data from MySQL. PHP and Java don't interact in any way in this instance, they both would be communicating with MySQL.

    I still don't really understand what you're asking.

  • Avatar of Arthurdes Arthurdes May 15, 2013 at 17:46 UTC - 0 likes

    @Brettflan: Go

    I mean if not use you supply Mysql soft ""
    and the setting

    "jdbc\:mysql\:localhost\:3306/minecraft" have to change?

    because i use warp soft to create the mysql in the picture you can see it

    but when i run the server,i not know how create a php.

    finaly,i'am so sorry because my broke english....(come from Taiwan


Date created
Sep 02, 2011
Last update
Mar 10, 2016
Development stage
  • enUS
BSD License
Curse link
Recent files
  • R: 1.8.1 for 1.9 Mar 10, 2016
  • R: 1.8.0 for CB 1.7.9-R0.1 Jun 24, 2014
  • R: 1.7.0 for CB 1.6.2-R0.1 Apr 25, 2013
  • R: 1.6.3 for CB 1.5.1-R0.2 May 10, 2012
  • R: 1.6.2 for CB 1.2.5-R1.2 May 08, 2012