Inactive [INFO/WEB] Netstats v5.0.4 - Keeps track of player playtime and online status [RB 1.1-R3]

Discussion in 'Inactive/Unsupported Plugins' started by Valrix, Feb 13, 2011.

  1. Offline


    Netstats v5:
    Keep up with development in BukkitDev!
    Netstats - Player Monitoring Plugin:
    Plugin Version: v5.0
    Web Version: v3.0

    Netstats watches players as they join and leave the server and keeps track of how long they've been logged into the server as well as keeping track of their current online/offline status while using very little system resources. The information is stored in a database which is defined by the user. First time using Netstats it will create the config file then disable itself until you change the config to match your database. Then you can reload or restart the server and it'll start collecting information immediately.
    Source Code: Netstats

    OLD CHANGELOG (open)

    Version 4.7
    • Bug fixes
    • If you don't supply a "database" in the config it will attempt to make it's own database named "NetStats" then create the table "netstats" inside it.
    • Fixed repetitive code and unnecessary MySQL connections when doing multiple queries one-after-another (reduces database calls, speeds up the code, and uses less resources).
    • Reduced code complexity (simplified certain calls and removed hacky functions to improve code performance by around 5-10% in my tests)
    Version 4.6
    • Fixed the bug that happened when trying to change the name of your stats table.
    • Fixed the bug that messed up everyone's total play time (sorry)
    • Code improvements and uses less code for database calls
    Version 4.5
    • Fixed the bug where folders weren't being made.
    Version 4.4
    • Converts the total play time to be saved as seconds instead of milliseconds to increase maximum play time. This will now match the PHP code, so if you changed it, change it back.
    • Now disables and re-enables itself instead of reloading the server when doing a wipe
    • Some code improvements
    Version 4.3
    • No longer requires the /lib/ folder since CB already contains the needed drivers
    • v5 is close to being ready and will bring large speed improvements
    Version 4.2
    • Fixes the bug that creates .stats folders instead of files.
    Version 4.1
    • Many code improvements to improve speed and memory usage.
    • Thanks to @jascotty2 for the code to fix how player and mob kills are handled
    Version 4.0
    • Many bug fixes
    • Changed how total play time was saved to the database
    • Fixed a bug with timed events
    • A new and improved Web update is nearly finished
    Version 3.9
    • Should work with RB 617
    Version 3.8
    • Fixed an issue with how files were handled.
    Version 3.7
    • Fixes issue of logged-in users being shown as offline after a reload
    • Fixed file creation bug where .stat files weren't being made properly
    Version 3.6
    • Fixed a bug where, depending on your region, your IP address was logged twice in the database. This was more of an issue with how the IP address was being grabbed than a problem with how it was stored.
    • Few other small fixes to prevent possible future bugs.
    Version 3.5
    • Changed how paths are managed by the plugin to be more OS-independent, hopefully fixing all "file not found" errors.
    • Removed checking if a database password exists or not.
    Version 3.4
    • Improved error logger that create a special log file with the exact info I'll need to find out what caused the problem.
    • Numerous bug fixes and speed tweaks
    Version 3.3
    • Added tracking of distance traveled
    • Added tracking of number of monsters a player has killed
    • Added tracking of number of other players a player has killed
    • Added the date of when the player first joined the server (after this version of Netstats has been installed, will only be correct after a full wipe of other stats)
    • Database will auto-build if it doesn't exist, otherwise it'll add columns if they're needed (so you don't have to do anything to update your database)
    • Config file now auto-updates and allows for comments (they need their own line however)
    • Many other code improvements and fixes to help it run faster and more efficiently.
    Version 3.2
    • Fixed the problem with saving to the database that everyone's been getting. (Only need the JAR)
    Version 3.1
    • Changed the namespace to com.sparkedia.valrix since I did the Java bit.
    Version 3.0
    • Rebuild of v1 to be more efficient.
    • Customized tracking based on "true" or "false"
    • What you don't want tracked won't be watched which improves performance
    • Timed updates (default is 90 seconds)
    • Fixed updating based on total actions user has done (default is 32)
    • Numerous performance tweaks
    • A "pretty" config file
    • Improved web script performance and added customized tracking (make it match your main config, variables are named the same for simplicity)
    • Web view tells when a player is still online and makes their name green if online, red if offline
    • Uses the "hybrid" method of player data saving like v1 to put less strain on the database
    • When saving to a database it is done dynamically so that only changed things are saved to cut down on the code needed and make smaller, faster calls to the database when saving (this was a big improvement on all previous versions)
    • Table name has been changed to "netstats" to not conflict with any other tables
    • NOTICE: You will need to remove your old data since it is outdated and the table is named differently with a few field name changes so make sure to use the .sql file to add it to your database. Please, before complaining about losing all the old data, realize that there's a 99% chance that it's wrong.
    Version 2.0
    • Complete revamp!
    • Now uses only flatfiles to store data, no more database issues!
    • Lots of code removed and improved for faster speed and less resource use
    • Customizable timed updates (default is every 30 seconds)
    • Customized tracking also reduces resource use by registering (or not registering) events as per your config so it only watches events that you want it to.
    • Web script will search for your CraftBukkit server when you first look at the web page.
    • You can choose where the server will save every player's .stats file by setting the "path" option in the config. The path is relative to your main server folder (where the world folder should be at). So if you set "path=../players/" then the .stats files will be in a folder called "players" in the folder that your server is in.
    • Table of player data is built depending on what your tracking and will change as you change the Netstats config file, nice and easy!
    • There are a few rules to setting paths that are listed above, make sure to read them!
    Version 1.8
    • Various code fixes and changes to improve how it runs.
    • Creates a new blank config file if it can't find one.
    • Only JAR has been changed. Get the newest one above, which I'll just reference from now on since it's faster than posting the same link over and over again.
    Version 1.7
    • Changed how files are accessed which should fix the "Too many files open" bug on Linux machines. Update the [JAR]
    Version 1.6
    • Hopefully fixed bug with connecting multiple times to a property file for each user. Only [JAR] needs updating.
    Version 1.5
    • Fixed a critical bug where user property files (where it saved your data before moving it to the database) wasn't re-defined when the plugin was reloaded. Now it looks for it after everything you do to make sure your data is always being recorded. Only the [JAR] needs to be updated.
    Version 1.4
    • Updated the files to work with the new constructor. You'll need only the [JAR] for this update.
    Version 1.3
    • Fixed a bug with how the plugin saves user data after a server crash
    • Added an Update.sql to add new columns to database table [] (only for those upgrading from v1.2)
    Version 1.2
    • Added tracking of blocks broken
    • Added tracking of blocks placed
    • Added tracking of player deaths
    • Added more frequent tracking of total time online
    • Implemented new "safety" storage system
    • New storage system reduces number of database calls
    • Improved the way data is stored to database to take less code
    • The table of data is now ordered by who is online
    Version 1.1
    • Added tracking of player's last used IP address
    Version 1.0
    • Release of Netstats
    WEB CHANGELOG (open)

    Version 2.1
    • Some code cleanup and fixes as well as a better auto-updater that makes sure that the updater is the latest version before doing the actual update process.
    • Localization support for 7 different languages.
    • File name changes to be more netstats-specific which will prevent clashes of CSS and other pages.
    • Better include() and require() calls so a page is only added once which speeds up all the pages and keeps them from destroying each other.
    Version 2.0
    • Improved layout
    • Automatic code updates
    Version 1.0
    • Initial release of web code

    Donations: Don't forget to give amd3th some love too since he helped in making Netstats and came up with the idea (you rock!) as well as @marshall007 since he's been awesome by helping me in his spare time.
    Phaedrus, Niemand, D-Lew and 5 others like this.
  2. Offline


    Hey you, don't do that until something as good as yours is out to beat it :)
  3. Offline


    [SEVERE] null loading Netstats v3.8 (Is it up to date?)
    at com.sparkedia.valrix.Netstats.Property.isEmpty(
    at com.sparkedia.valrix.Netstats.Netstats.onEnable(
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(
    at org.bukkit.craftbukkit.CraftServer.loadPlugin(
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(
    at net.minecraft.server.MinecraftServer.e(
    at net.minecraft.server.MinecraftServer.a(
    at net.minecraft.server.MinecraftServer.d(

    with Craftbukkit version git-Bukkit-0.0.0-609-g39996e1-b612jnks (MC: 1.4)? :(
  4. Offline


    I'm using the same version and I don't get that error. You sure that the file exists and if not then there are write permissions for that directory?
  5. Offline


    Hello again. 617 sup?
  6. Offline

    Lord Chaos

    Running Craftbukkit 617 and Netstats 3.8. It seems to be running ok, but it gives errors when I stop the servers and they seem to be Netstats related:

    2011-04-02 18:20:26 [SEVERE] java.util.ConcurrentModificationException
    2011-04-02 18:20:26 [SEVERE]     at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
    2011-04-02 18:20:26 [SEVERE]     at java.util.HashMap$ Source)
    2011-04-02 18:20:26 [SEVERE]     at java.util.HashMap$ Source)
    2011-04-02 18:20:26 [SEVERE]     at com.sparkedia.valrix.Netstats.NetRepeater.out(
    2011-04-02 18:20:26 [SEVERE]     at com.sparkedia.valrix.Netstats.Netstats.onDisable(
    2011-04-02 18:20:26 [SEVERE]     at
    2011-04-02 18:20:26 [SEVERE]     at
    2011-04-02 18:20:26 [SEVERE]     at org.bukkit.plugin.SimplePluginManager.disablePlugin(
    2011-04-02 18:20:26 [SEVERE]     at org.bukkit.plugin.SimplePluginManager.disablePlugins(
    2011-04-02 18:20:26 [SEVERE]     at org.bukkit.craftbukkit.CraftServer.disablePlugins(
    2011-04-02 18:20:26 [SEVERE]     at net.minecraft.server.MinecraftServer.g(
    2011-04-02 18:20:26 [SEVERE]     at
    2011-04-02 18:20:26 [SEVERE]     at
  7. Offline


    Yeah, I'm busy working on all my plugins. Don't worry guys, today I'll have all day to work on them without interruptions.
  8. Offline


    well its missing the SQL file to make the database:) so i can't update the database:(
  9. Offline


    It doesn't need the .sql files anymore, I have it update the database as it needs to as well as creating it the first time it runs. Once you run it, it should create/update the table.
  10. Offline


    ok so in the config file what is
    then bc i am getting errors in the php file but i want to make sure this is working but its not going to submit yet i do not belive until i figure out what you have new and old table for in there?
  11. Offline


    Those are optional settings. They're so you can rename your table to something besides "netstats".
  12. Offline


    how can i block the spamming in console?

    16:42:18 [INFO] SQL Statement: UPDATE netstats SET seen=1301841738921, total=149407595 WHERE player='darkwarriors'
    16:42:48 [INFO] SQL Statement: UPDATE netstats SET seen=1301841768921, total=149437595 WHERE player='darkwarriors'
    16:43:18 [INFO] SQL Statement: UPDATE netstats SET seen=1301841798871, total=149467545 WHERE player='darkwarriors'
    16:43:48 [INFO] SQL Statement: UPDATE netstats SET seen=1301841828871, total=149497545 WHERE player='darkwarriors'
    16:44:18 [INFO] SQL Statement: UPDATE netstats SET seen=1301841858871, total=149527545 WHERE player='darkwarriors'
    16:44:48 [INFO] SQL Statement: UPDATE netstats SET seen=1301841888871, total=149557545 WHERE player='darkwarriors'
    16:45:18 [INFO] SQL Statement: UPDATE netstats SET seen=1301841918921, total=149587595 WHERE player='darkwarriors'
    v3.8 cb 617
  13. Offline


    Haha, oops. I forgot to get rid of that. I was using it to tell what statements were being passed so I could see if there were any errors in the statement as it was being sent to the MySQL server. I'll get rid of that real quick.
  14. Offline


    Is that removed? I just noticed that on my server and went over here to ask about it.
  15. Offline

    Lord Chaos

    I updated to 3.9 and now I am getting this in my console:

    2011-04-04 02:37:47 [INFO] Snippelip [/] logged in with entity id 235
    2011-04-04 02:37:47 [INFO] SQL Statement: UPDATE netstats SET placed=placed+6, enter=1301877467061, seen=1301877467061, ip='', total=21244782, logged=1 WHERE player='Snippelip'
    2011-04-04 02:38:18 [INFO] SQL Statement: UPDATE netstats SET broken=broken+1, placed=placed+7, seen=1301877498643, total=20397880 WHERE player='Uliest'
    2011-04-04 02:38:18 [INFO] SQL Statement: UPDATE netstats SET broken=broken+1, placed=placed+7, seen=1301877498643, total=20397880 WHERE player='Uliest'
    2011-04-04 02:38:58 [INFO] SQL Statement: UPDATE netstats SET broken=broken+26, placed=placed+6, seen=1301877538149, total=21315870 WHERE player='Snippelip'
    2011-04-04 02:39:16 [INFO] xmico [/] logged in with entity id 4149
    2011-04-04 02:39:16 [INFO] SQL Statement: UPDATE netstats SET enter=1301877556159, seen=1301877556159, ip='', logged=1 WHERE player='xmico'
    2011-04-04 02:39:27 [INFO] SQL Statement: UPDATE netstats SET placed=placed+26, broken=broken+6, seen=1301877567952, total=21344573 WHERE player='Snippelip'
  16. Offline


    It's removed, I'm updating the .jar now, one minute
  17. Offline


    Netstats has to be updated was a debug thing added in there is all just wait till post comes up with a "fix" for it:)

    lol you posted just after i start :) lol yea what Valrix stated above;)
  18. Offline


    Yeah, it was debug code and sorry, I'm just swamped at the moment. Trying to help out family at home remotely and debug my new plugin and a bunch of stuff at once. I'll post when it's ready

    Ok there we go. Grab the jar and you shouldn't see any more of the debug messages.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 8, 2016
  19. Offline

    Lord Chaos

    Seems to be all working I just need to figure out how to get the stats on the webpage, as I can't get anything to connect to the mySQL DB. Though thats not a netstats problem.
  20. Offline


    Good to hear, as I find time I'm still working on the PHP too which will have a nice little surprise that took me a while to figure out, but is something I find to be really cool :)

    Depending on how Notch does statistics and achievements Netstats may end up dying or just turn into a way to customize how the statistics are saved and shown online so you guys can then have every statistic (like you've been asking for) but only show what you want and have the individual player pages with achievements, and so on. I really don't want it to die, but if I can't end up hooking into it as I will need to, Netstats will die. It all really depends on Notch and the rest of the Mojang team.
  21. Offline

    Lord Chaos

    I honestly don't think what notch will be making will be all that cool. It will likely be similar to the stats&achievements plugin and nothing more. Netstats will still be awesome, especially because it allows for those stats on the web...btw, have you thought about tying into the stats&achievements plugin and displaying those too optionally?

    I look forward to your new feature. :)
  22. Offline


    I'm trying to tie in as little as possible, but there will be a few things I'm going to tie into like iConomy will be optional and will be done through PHP. I actually feel a spark to keep working on Netstats so be ready guys! :D I will pump out some great stuff for you and I will make Netstats BETTER than any kind of stats and achievements Notch will try to do >:3
  23. Offline


    Perhaps a bit more detail on how to post these stats online?

    I have a web server on my network but it's not on the Minecraft server's system. I've tried creating a PHP file using this:

    <?php include("PATH TO get.php"); ?>
    But inserted a networking path like:

    <?php include("<minecraft_folder>/plugins/Web/get.php"); ?>
    But I get a blank white page. I've also tried replacing the internal IP with my external domain name.

    I even get a blank page when I copy the get.php file, place it on the web server, and call that from a php file.
  24. Offline


    Since it just uses the MySQL server to fetch from you can have the Web folder anywhere, it doesn't have to be inside the Minecraft server's directory at all.
  25. Offline

    Lord Chaos

    Well, stats and achievements would be nice, as it doesn't have its own net statstic. Maybe you two could merge your products into one? Then you could truly beat the hell out of anything that notch has. :)

    Looking forward to your new surprise.
  26. Offline


    After some trial and error I have managed to get Netstats to send the data to the mySQL database I have set up on a webhost I rent space from. I can see the stats using phpMyAdmin.

    I uploaded the get.php and config.php files, however I get:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mysite/public_html/mc/get.php on line 46
    NameBlocks BrokenBlocks PlacedDeathsMonsters KilledPlayers KilledDistance TraveledLast LoginLast SeenPlay TimePlayer IP

    when i access get.php now.
    Any idea why?


    /* ----------------------------------------------
    File Created by Josh Devecka(Jdev19)
    You may use the code as you wish,
    but please give me some credit.
    ------------------------------------------------- */
    $mysql_host = 'localhost';
    $mysql_user = 'user';
    $mysql_pass = 'pass';
    $mysql_db = 'minecraftstats';
    $mysql_table = '';
    This is my config.php settings. Do I need to define/create a table? Is that the same as creating the database?
  27. Offline


    Yes, you have to define a table otherwise it doesn't know where to get the data from. That's why it failed.
  28. Offline


    Thanks for the quick reply. I thought that since I can see the data in phpMyAdmin in the minecraftstats database, that that is all it needs.
    I see now that there is a table called 'netstats' within it and have added that.
    Now it works!

    Thanks again
  29. Offline


    Welcome :)
  30. Offline


    Ok, I have no idea about MySQL or how to set this up.

    Could somebody please guide me through it? I already hve the jar file in the plugins directory and the Netstats folder is in there. I just need the database.
  31. Offline


    Hi, I would like to use ur plugin. But my bukkit (v. 617) throws this exception:

    Could you help me to fix that?
    I downloaded your bundle-package for bukkit 617 and edit the config
    files with the right data:

    (change data user/pass/db with false entries)

    The following is my config.txt in Netstats-Folder (auto-generated)
    (changed database/username/password)

    Thank u!

Share This Page