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

    Valrix

    Netstats v5:
    COMPLETE!
    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 [Web.zip] (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

    Gryphon

    Host should not be "www.websitename.net", it should most likely "localhost" or IP address if remote.
     
  3. Offline

    Nolig

  4. I think it's clear Oo
     
  5. Offline

    LuigiPeace

    Hello, I just try to install your plugin.
    But when I run the page index.php, I've got this error message :
    Thank you for the plugin, when it will works, it will be perfect :p !

    (Sorry for the English)
    Luigi.
     
  6. Offline

    Valrix

    No need to apologize. I'm still not sure why that error happens, but I hope the next update will solve this odd problem or I can do a bit more research and find out what causes this to occur.
     
  7. Offline

    wesleydeman

  8. Offline

    szczena

    Hello.
    Sorry for my english and actually google translator for English.
    I get this error when entering the statistics
    Code:
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/clients/client9/web13/web/netstats/data.php on line 153
    What changed to make it work. It seems to me that the code in this place is good but apparently not.
    Can you help? Greetings from Polish.
     
  9. Offline

    wesleydeman

  10. Offline

    Valrix

    No I can't. I don't know what's wrong.
     
  11. Offline

    LuigiPeace

    I re-install the Web archive and reconfigure it again. And this time I just had this error :
    So I check the line which is :
    That I put as a comment and so it doesn't display the error message anymore.
    Displaying is absolutely not like Wesleydeman because there is only the border of the table with entire black and white table. The pictures for asc / desc don't appears... Weird :s
    This is not the problem, I will made my own page...

    Which is weird (it already happen to someone before, in this topic) : one of my players already play for a year, which is not the case.

    At szczena, I think this error message (at the same line as me) is a problem of configuration.
     
  12. Offline

    Valrix

    Well it looks like the folder it was trying to save to didn't have write permissions so it couldn't save the flag.
     
  13. Offline

    LuigiPeace

    I already try but I wasn't sure so I didn't insist. So I try again and it works fine ;) Thank you !
     
  14. Offline

    Valrix

    You're welcome.
     
  15. Offline

    Spathizilla

    Is there a fix or cause for years being added to the total play time? Some people are at around 124 years of total playing time. Now I'm not 100% sure but I dont think I've been running the server that long :D... I don't know if it was Netstats 4.7 or an earlier version though.

    Would rather not have to reset all the stats (well, except that one for those who have it broken)

    Currently using: Netstats 4.7 on CB766

    config.txt (open)

    # Netstats Properties File
    admin=*********
    wipePass=**********
    host=localhost
    database=*********
    username=**********
    password=****************************************************
    # Both oldTable and newTable are optional
    oldTable=
    newTable=
    actions=32
    updateRate=90
    # Optional things to track. True = track, False = don't track
    trackIP=true
    trackBroken=true
    trackPlaced=true
    trackDeaths=true
    trackMonsterKills=true
    trackPlayerKills=true
    trackDistanceWalked=true
    revised=true


    Table Structure (open)

    CREATE TABLE `netstats` (
    `id` int(11) NOT NULL auto_increment,
    `player` varchar(50) NOT NULL,
    `enter` bigint(20) NOT NULL default '0',
    `seen` bigint(20) NOT NULL default '0',
    `total` bigint(20) NOT NULL default '0',
    `logged` tinyint(1) NOT NULL default '0',
    `ip` varchar(40) NOT NULL,
    `broken` int(11) NOT NULL default '0',
    `placed` int(11) NOT NULL default '0',
    `deaths` int(11) NOT NULL default '0',
    `mobskilled` int(11) NOT NULL default '0',
    `playerskilled` int(11) NOT NULL default '0',
    `joindate` bigint(20) NOT NULL default '0',
    `distance` double NOT NULL default '0',
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
     
  16. Offline

    Valrix

    I've already addressed that I don't know what the cause is for the play time being so wrong. The only fix I can think up is updating to v5. Until it's ready you'll just need to wait it out and pretty much just ignore play time stats for now. Everything else should be fine though.
     
  17. Offline

    Spathizilla

    Yeh I've no idea what it is. I reset all the x year people to 0 and since last night we've had another 82 year guy turn up into the database. I might look into your code and see if I can spot any place it could go wrong and corrupt like that.
     
  18. Offline

    Lord Chaos

    Moar stats!!! :D
     
  19. Offline

    Valrix

    After some research I found out that my thought of using PHP to handle back-ups and MySQL intensive tasks was plausible. This means that instead of having the plugin trying to work with MySQL and having to use connectors and a giant class specifically to manage the database I can just make a much smaller, easier to use, class that will instead make very small POST calls to a PHP script. This way the plugin can be even lighter, faster, more efficient in memory usage, and will allow for more to be added (like advanced tracking!) without stressing the hell out of your server.

    On the PHP side I've improved some code and when v5 is ready it'll bring with it even better web code including an Admin page, better updating procedures (that you can watch in real time) and should make the whole process of tracking users faster and much, much more accurate.

    I'll explain more as time goes on, but as a quick "peek" I've updated how all my plugins handle player data and config files, etc. to be less complex in how they handle data to speed up data process times and use less memory since I noticed some variables and functions could be removed without taking a performance hit.
     
  20. Offline

    ghost0001

    I am getting an error when I load the website:
    Parse error: syntax error, unexpected '*' in C:\xampp\htdocs\playerstats\netstats_config.php on line 11

    line 10 and 11 reads:
    # Auto-update the web code for you
    $update = *0;

    let me know what you need so you can help me troubleshoot this problem. thanks in advance.

    ok, PEBKAC error...i removed the '*' from the config file and volia. now i have other errors...
     
  21. Offline

    Valrix

    Change it to false. It didn't properly parse in the old option which is fixed in the newer version I'm working on.
     
  22. Offline

    bradgillap

    Valrix that sounds awesome! My VPS could always use a boost as Ive noticed chunks loading more slowly lately.
     
  23. Offline

    Valrix

    Yeah, it'll run a lot smoother after the update since all database will be handled via PHP instead of being handled by the plugin. Plus since it'll just be running a small socket server inside to handle calls by PHP pages then the data will be accurate down to exactly how many blocks at the time the plugin was asked and the PHP will make direct calls to the plugin unless it notices that the plugin is disabled or the server is down which it will then ask the database for data instead. This makes the PHP a little more complicated in some areas, but also means getting data faster when directly asking the database AND being able to send commands to your server. The thing I'm going to be most happy about is how data will be managed so I won't have to worry about it being so messed up like it is now.
     
  24. Offline

    Sluijsens

    Okay thanks, i'll give it a try:)
     
  25. Offline

    Oscarius

    I'm having some problems getting the Web interface to work. The page doesn't load and the following error pops up in Apache2's error.log:
    Code:
    [Mon May 16 14:51:18 2011] [error] [client 80.202.xx.xx] PHP Warning:  copy(img/flags/.png): failed to open stream: No such file or directory in /var/www/stats/data.php on line 216
    netstats_config.php
    Code:
    <?php
    /* ----------------------------------------------
    File Created by Josh Devecka(Jdev19)
    You may use the code as you wish,
    but please give me some credit.
    ------------------------------------------------- */
    # Netstats Web version (do not alter)
    $version = "2.1";
    
    # Auto-update the web code for you
    $update = 0;
    /* ----------------------------------------------
    Depth options:
        ~ "full" - Replaces old files with new ones
        ~ "default" - Keeps new files in /tmp/
    ------------------------------------------------- */
    $depth = "default";
    
    # Localization (language).
    # Supported: American English (en_US), German (de_DE), Luxembourgish (lu_LU), Finnish (fi_FI), Norwegian (no_NO)
    # Portuguese (pt_PT), French (fr_FR)
    $language = "en_US";
    
    # Database connection info
    $mysql = array(
        'host'  => 'localhost',
        'user'  => 'xx',
        'pass'  => 'xx',
        'db'    => 'xx',
        'table' => 'netstats'
    );
    mysql_connect($mysql['host'],$mysql['user'],$mysql['pass']) or die (mysql_error());
    mysql_select_db($mysql['db']) or die (mysql_error());
    
    # What you want to be shown, change to false if you want it hidden
    $track = array(
        'ip'       => true, # IP address
        'broken'   => true, # Number of blocks broken by player
        'placed'   => true, # Number of blocks placed by player
        'deaths'   => true, # Number of times player died
        'mobs'     => true, # Number of Monsters killed by player
        'player'   => true, # Number of Players killed by player
        'joined'   => true, # Date of when player first joined the server (with Netstats running)
        'distance' => true  # Total distance player has traveled
    );
    ?>
     
  26. Offline

    Exidous

    I worked on this quite a bit yesterday to get it working with no luck. i installed the plugin and its writing to the database just fine. I put your netstats web files under my IIS web directory, edited the config files to connect and i get a 500 internal server error. I have phpbb installed and working fine. I am stumpted. here is my net config:

    Code:
    <?php
    /* ----------------------------------------------
    File Created by Josh Devecka(Jdev19)
    You may use the code as you wish,
    but please give me some credit.
    ------------------------------------------------- */
    # Netstats Web version (do not alter)
    $version = "2.1";
    
    # Auto-update the web code for you
    $update = *0;
    /* ----------------------------------------------
    Depth options:
        ~ "full" - Replaces old files with new ones
        ~ "default" - Keeps new files in /tmp/
    ------------------------------------------------- */
    $depth = "default";
    
    # Localization (language).
    # Supported: American English (en_US), German (de_DE), Luxembourgish (lu_LU), Finnish (fi_FI), Norwegian (no_NO)
    # Portuguese (pt_PT), French (fr_FR)
    $language = "en_US";
    
    # Database connection info
    $mysql = array(
        'host'  => 'localhost',
        'user'  => 'root',
        'pass'  => '*******',
        'db'    => 'stats',
        'table' => 'netstats'
    );
    mysql_connect($mysql['host'],$mysql['user'],$mysql['pass']) or die (mysql_error());
    mysql_select_db($mysql['db']) or die (mysql_error());
    
    # What you want to be shown, change to false if you want it hidden
    $track = array(
        'ip'      => false, # IP address
        'broken'  => true, # Number of blocks broken by player
        'placed'  => true, # Number of blocks placed by player
        'deaths'  => true, # Number of times player died
        'mobs'    => true, # Number of Monsters killed by player
        'player'  => true, # Number of Players killed by player
        'joined'  => true, # Date of when player first joined the server (with Netstats running)
        'distance' => true  # Total distance player has traveled
    );
    ?>
     
  27. Offline

    verboseone

    I withdrawer my offer to help with php. I loved this script to begin with. However, my server has started experiencing block lag. With 20+ plugins it was hard to locate the culprit. Turns out it was netstat. I'm not saying this causes lag for everyone. Especially since my SQL server is on a different server than my minecraft. Just saying it is no longer a fit for me. Thanks anyway!
     
  28. Offline

    Exidous

    Fixed my issue.

    in the config you have to make sure all * are taken out. I was tired last night and missed this:

    Code:
    $update = *0;
    should be:

    Code:
    $update = 1;
    @Oscarius make sure to use either a 1 or 0 in your update or it will throw an error. at leasts thats what it looks like from your config.... ahh coffee is your friend.
     
  29. Offline

    Valrix

    Don't throw it under the bus just yet, when it goes up to v5 then it'll work a lot better than it does now.
     
  30. Offline

    Exidous

    Every one of my players has 41 years as time played. All of them. This is obviously a problem.
     
  31. Offline

    Valrix

    Which I've already answered.

    Alright people, that's enough. If you can't take the time to read a few posts back before posting your "problem" or you just like to complain, then don't post at all. I'm usually a nice, calm guy, but not when I keep seeing alerts that are the same damn message over and over again from different people. It's cool to let me know there's a problem, but only before I make an outright message to everyone stating that I KNOW it's a bug and have given my reasoning and plan to fix it, after that it only pisses me off to see the same thing over and over and over. Life has been getting busy for me, that can't be helped, but I am still working on updating my plugins and working on getting this to v5, just wait for me to get it out and post about the progress I'm making. If you end up pissing me off then I'll lose interest and development will go slower. Work with me guys/girls, I'm doing this for you (trust me, I never actually get to just sit and play Minecraft anymore, it's always testing).

    Furthermore, if I can get some help then more progress can be made and I'll be more willing to work since I won't be doing it alone.

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

Share This Page