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

    Valrix

    1. Yes. That's only needed for when you'd need to wipe player stats from the server. You shouldn't need to worry about that since you're using the beta. But if the data isn't being saved, then you might have to after all.
    2. Host doesn't need a port, that's just the IP if the database isn't on the same server otherwise "localhost" (no quotes) should work
     
  3. Offline

    Bambo

    the problem im having is its a remote mysql server, lemmie try it with a free one to test. Will post results
     
  4. Offline

    Valrix

    ok, I'll be waiting ^^
     
  5. Offline

    Bambo

    even when i use a database from freesql.org it doesnt load :(
     
  6. Offline

    Valrix

    Weird. Are any error logs being created?
     
  7. Offline

    Bambo

  8. Offline

    Valrix

    Can you post what the console looks like or the server.log when you first start up the server?
     
  9. Offline

    Bambo

    what should the "$mysql_table" be on the web side?
     
  10. Offline

    Valrix

    As long as you don't change it from netstats, that's what it should be. So, simply "netstats".
     
  11. Offline

    Bambo

    still it doesn't work!
     
  12. Offline

    Valrix

    Well, what's not working exactly? Is it the Java plugin or the web? Both work differently. Are you able to look inside the actual database and see if there's anything there? If not then let me see your server.log, but if data is being saved, then it's the Web part that isn't getting the data from the database. You'll need to be a little more specific for me to help you out.
     
  13. Offline

    Bambo

    Ok, nothing is being created in the database, nothing has setup and the web side is fine its just not finding anything because the java side hasnt made anything. gunna try reinstall
     
  14. Offline

    Valrix

    Ok, if that doesn't work then post the server.log from when the server is starting up. Maybe that'll tell us something.
     
  15. Offline

    Bambo

    nothing.

    it says "# Netstats Error Log
    CraftBukkit Version: git-Bukkit-0.0.0-646-gb61ef8c-b670jnks (MC: 1.4)
    Netstats Version: b4.0
    MySQL Error: java.sql.SQLException: Access denied for user 'rbamford_bambofy'@'50.22.36.137' (using password: YES)
    Offending Statement: placed=placed+9, distance=distance+25.88416116358392, seen=1302820047441, total=total+1302820047441 WHERE player='bambo123';
    "

    however the settings are fine...

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

    Valrix

    MySQL Error: java.sql.SQLException: Access denied for user 'rbamford_bambofy'@'50.22.36.137' (using password: YES)

    That line says it all. The user you gave it isn't able to log into the MySQL server. So either the password is wrong, or the username is wrong. It tries to connect and send data, but it literally can't make the connection.
     
  17. Offline

    Bambo

    hmm, i'll post more tomorrow. It's 12 here now -.-'
     
  18. Offline

    Valrix

    Haha, ok then.
     
  19. Offline

    Bambo

    it has not created the tables when trying to insert, is there anyway i could get a raw .sql file to add?
     
  20. Offline

    Valrix

    Yeah, I'll make one for you. Though I have a feeling if it's not working when trying to create the table, it's not going to be able to save anything to the table.
     
  21. Offline

    Ratchet

    I've setup the config file and then uploaded config and get.php to a remote webhost, I put the IP of the server with the database in the config file like so:

    $mysql_host = 'deep.phpwebhosting.com';
    $mysql_user = 'user';
    $mysql_pass = 'pass';
    $mysql_db = 'minecraft';
    $mysql_table = 'netstats';

    the tables were successfully created in the DB so I know it can connect fine,

    however when I go to get.php I am just seeing this:

    Code:
    Fatal error: Call to undefined function: date_default_timezone_set() in /home/paradox/www/minecraft/Web/get.php on line 10
    The Web config file is setup with the same info, except localhost as the hostname since it's on the same server with the DB

    this is from the netstats log file:

    Code:
    # Netstats Error Log
    
    CraftBukkit Version: git-Bukkit-0.0.0-653-g9992fff-b677jnks (MC: 1.4)
    
    Netstats Version: b4.0
    
    MySQL Error: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    
    Offending Statement: seen=1302922397780, total=total+90192 WHERE player='sunwind';
    
    What am I doing wrong?
     
  22. Offline

    Valrix

    I'm betting the first error is from a PHP version that doesn't support that command. You can remove it and it shouldn't mess up anything.

    The plugin error means it's not connecting to the database properly from what I can tell. I'm going to add a bit more to the error logger to see if it can tell us anything more about the problem.

    EDIT: I've changed the error logger a little to show a bit more data about the error which may help. You'll need to grab the latest jar.
     
  23. Offline

    maxsteele

    Hm, interesting... I'm running Netstats v3.9 and CB #617. When I start up my server, I get the message:

    Code:
    2011-04-15 17:54:20 [INFO] [Netstats] v3.9 has been disabled.
    I changed nothing with the database or the config file for Netstats. Here is my config file:

    Code:
    # Netstats Properties File
    host=localhost
    database=minecraft
    username=BLOCKED
    password=BLOCKED
    oldTable=
    newTable=
    actions=0
    updateRate=32
    # Optional things to track. True = track, False = don't track
    trackIP=false
    trackBroken=false
    trackPlaced=false
    trackDeaths=false
    trackMonsterKills=false
    trackPlayerKills=false
    trackDistanceWalked=false
    My database name, username, and password are all correct. Netstats doesn't say why it's disabled, but it certainly is. Any ideas?
     
  24. Offline

    Valrix

    I'm really not sure, but you should be using the beta to make the transition to the official 4.0 easier on yourself. I may just make it official since I haven't found any problems with it yet and nobody has told me otherwise except one user who's having MySQL problems not related to Netstats.

    http://dl.dropbox.com/u/1449544/deps/netstats.sql

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

    Ratchet

    I deleted that line and now it's working, haven't had any errors in the console either since
     
  26. Offline

    Valrix

    Very good. Be sure to have the official release too by the way.
     
  27. Offline

    crysis992

    Doesnt work....
    Code:
    SEVERE] Could not pass event PLAYER_JOIN to Netstats
    java.lang.NullPointerException
        at com.sparkedia.valrix.Netstats.Database.hasData(Database.java:72)
        at com.sparkedia.valrix.Netstats.NetPlayerListener.onPlayerJoin(NetPlayerListener.java:104)
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:204)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:59)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:255)
        at net.minecraft.server.ServerConfigurationManager.a(ServerConfigurationManager.java:98)
        at net.minecraft.server.NetLoginHandler.b(NetLoginHandler.java:87)
        at net.minecraft.server.NetLoginHandler.a(NetLoginHandler.java:68)
        at net.minecraft.server.Packet1Login.a(SourceFile:46)
        at net.minecraft.server.NetworkManager.a(NetworkManager.java:198)
        at net.minecraft.server.NetLoginHandler.a(NetLoginHandler.java:34)
        at net.minecraft.server.NetworkListenThread.a(SourceFile:87)
        at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:368)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:375)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:283)
    [code]
    
    [code]
    # Netstats Error Log
    CraftBukkit Version: git-Bukkit-0.0.0-654-geba6623-b678jnks (MC: 1.4)
    Netstats Version: 4.0
    MySQL Error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Incorrect table name ''
    Offending Statement: UPDATE `` SET seen=1302933212405, total=total+1302933212405 WHERE player='crysis992'
    Stack Trace: [Ljava.lang.StackTraceElement;@6f3e49a8
    
    What does that mean?
    Table name is correct, its netstats. Username is correct, database name is correct. And password isnt used since its locked to localhost.
     
  28. Offline

    Valrix

    What does your config look like?
     
  29. Offline

    crysis992

    This is my config:
    Code:
    # Netstats Properties File
    admin=crysis992
    wipePass=BiGb9@WV&e
    host=localhost
    database=minecraft
    username=minecraft
    password=
    oldTable=
    newTable=netstats
    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
    
    I also tried to delete the old netstats table, it doesnt even create a new one.
    I tried to set this:
    oldTable=
    also to netstats, same error messages.
    I tried to set localhost to 127.0.0.1, same...
     
  30. Offline

    Valrix

    You don't need to set newTable. If there's no value it defaults to netstats
     
  31. Offline

    crysis992

    thank you, it works now.
     

Share This Page