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.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 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

  • Avatar of Brettflan Brettflan May 15, 2013 at 17:20 UTC - 0 likes

    @Arthurdes: Go

    I don't understand what specifically you're asking about. Do you have the plugin configured and working through MySQL and just need a PHP script to read from it? If you've done anything else where you connect to and read from MySQL using PHP, that should be straightforward.

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

    if use warp to create a mysql,
    how can i create the php and let plugin run...

  • Avatar of TanveerGT5 TanveerGT5 Apr 27, 2013 at 10:24 UTC - 0 likes

    I want a working php script to display on site can you do it?


Date created
Sep 02, 2011
Last update
Apr 25, 2013
Development stage
  • enUS
BSD License
Curse link
Recent files
  • 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
  • R: 1.6.1 for CB 1.2.5-R1.0 Feb 20, 2012
  • R: 1.6 (ZIP) for CB 1.1-R3 Sep 02, 2011