MOC Playtime Tracker
Description:
The Minds of Chimera (MOC) Playtime Tracker tracks time players have been online (total time as well as last time on), as well as useful stats of their activity, in a MySQL or SQLite db. Gives top X reports as well (like top 5 players in time spent playing).
NOTE: Other plugins do this but they either are discontinued, buggy or use flat files. They've done a great job but didn't fit our needs so Playtime Tracker was created to fill our, and hopefully some other people's needs.
Part of the Minds of Chimera Project (dev)
MOCPlaytimeTracker | MOCDBLib | RegenBlock | MOCGoodEats | MOC3DImporter | MOCKiosk | MOCChemistry
See development versions in action on our server: isue-server.eecs.ucf.edu
Features:
- Log time players have been online.
- Report time online as a sum or as the last time they were on.
- Log player activities such as killing mobs and players, placing/destroying blocks, movement, etc.
- Report different player activities.
- Report top X charts of player activities and time online.
- Store data in a database: SQLite or MySQL.
- Uses a caching system to minimize database read/writes and avoid server blocking (darn single threads).
Media:
Demonstration video.
As of version 0.3, it logs player events per world. Here is what the output of: "/playtimetracker user cwingrav world" displays, where the user is "cwingrav" and the world name is "world".
It also lists the top performers in a category.
Commands:
/playtime - Prints amount of time you have played.
/playtime sum - Prints amount of time you have played.
/playtime sum [player] - Prints stats about time spent playing.
/playtime sumall - Prints stats about time spent playing for all players ever logged in.
/playtime laston - Lists last login times of self.
/playtime laston [player] - Lists last login times of the given player.
/playtime lastonall - Lists last login times of all players.
/playtime full - for the player, list their sum and laston
/playtime full [player] - for the given player, list their sum and laston
/playtime stats (player) (world) - prints user states about their activities in the world
/playtime debugon - spews debugging information
/playtime debugoff - stops spewing debugging information
/playtime recountall - forces the database to recount all player entries. Use if something is screwed up for 'sum'.
/playtime help|? - lists help
/playtime top [criteria] [# to print] [world] - Prints the top 5 in the categories this is tracking. Default is top 5 online time.
[criteria] currently include: online, place, destroy, die, moved, pk, hk, fk
pk=player kills, hk=hostile kills, fk=friendly kills (like cows, pigs, etc).
Permissions:
- PlaytimeTracker.admin:
- description: Access to debug and clear the log.
- default: op
- PlaytimeTracker.self:
- description: Gives access to discover the amount of time the player is online.
- default: true
- PlaytimeTracker.player:
- description: Gives access to discover the amount of time a player is online or last on.
- default: false
- PlaytimeTracker.all:
- description: Gives access to discover the amount of time all players are online or last on.
- PlaytimeTracker.top:
- description: Lets people list the top X for a given value.
Installation (and Configuration):
- add the PlaytimeTracker.jar file to your plugins directory.
- add the MOCDBLib.jar file to your plugins directory.
- follow the configuration instructions below if you connect to a MySQL database.
- create the plugins/PlaytimeTracker/DBLib.properties file (running the server once will create this)
- configure these options for your setup. This uses MOCDBLib for this so see its page for further details.
MySQL=false host=localhost database=playtimetracker username=root password=pass port=3306
Troubleshooting
- A common error is to skip the installation of the MOCDBLib.jar plugin.
- Check the server.log file for a list of errors. I try to be descriptive if it fails.
- When reporting a bug, please list a lot message error and information about your database configuration (i.e. MySQL or SQLite).
- /playtime recountall - This is useful if something gets mixed up with the online time counting.
- I'll do my best to help. Cheers.
Feature Requests
- Properties file for setting the names of the databases this is using. This will allow multiple servers to run off the same MySQL server.
- /afk support (interesting, might do but I will have to make a lot of changes to support this and to make sure it doesn't impact the server)
- Log sumall to the server file.
- Track per-world time online. so, /playtime <player> [world]
Please upgrade your plugin 1.8 regenblock!
can you please update this plugin to 1.6.2 ? I really need it, thank you :)
Hi again @cwingrav, another thing; it loads extreamly slow for me nowadays; I guess it's because of all the data. Is this something you can look at? It keeps loading for long after "Database connection succesful".
Can you please make it possible to set the table-name or at least a prefix/suffix? Cause im running this on same db on different servers. It keeps spamming errors if a user is online on both servers.
does this work with 1.5? I see it hasn't been updated in a year and while the commands are available on server anytime I try to get it to do anything I get errors....
One more comment, It doesn't calculate the total playtime in the counted column for any players in the pt_timelog table. And it doesn't calculate the total playtime in the timesum column for any players in the pt_players table. Everything else works though.
Also, I think it would be awesome if you could add a column for the players account balance for their money.
Coolest... plugin... ever...
So glad I was able to get it working with the database on my web server which the host makes things pretty confusing to connect to!
Also, I was just wondering, I noticed in the console that the plugin is constantly writing information to the database and I am the only one logged in. I can't imagine it with up to a hundred people! will this plugin be able to handle that? and better yet, would that bog down my server? it may just seem like a lot because it is constantly writing to the console.
@cwingrav
Thx for your answer. Have you already added the reconnection to MOCDBLib? I was searching for a github repository or something similar but could not find one.
Hey, getting this error running on Tekkit; would be awesome if you could fix!
http://pastebin.com/wbiGV3Wf
@Jungalist81
I'm hoping to deal with some of these problems shortly. They're building up. I just got a new worker so hopefully I can shift tasks and work on this. Thanks for the report.
@cwingrav Hello cwing its good to see you very active here. I have been using MOCplaytime tracker for some time and I cant thank you enough for this wonderful plugin. I came here today to report a bug. After I replaced MOCplaytimetracker 0.8 with 0.9, i get this error each time I restart:
What is interesting is I have MOCDLIB.jar version 8.
Some kind of version error code you might have missed when you created MOCplaytimetracker version 9. I am going to switch back to MOCplaytimetracker version 8 in the meantime :)
@BadSniper
Haven't seen this. I'll investigate. Hopefully, a change at the MOCDBLib level will manage this.
@cwingrav: We have an Issue on our Server related to MOCPlaytimeTracker/MOCDBLib. When the Plugin is not used some time because no player is on the server our MySQL closes the idling Database connection. A connection by a player some time later results in an endless output of Exception because the Plugin does not reconnect to the database and is not able to execute Queries. (Example Error message, same for all Queries from PlaytimeTracker: http://pastebin.com/CK2gfJ4i)
Is there a possibility to configure the DB Library to reconnect or is a code change from your side necessary?
@bjornleijdstrom
Sry. The onload and onshutdown warning log was overboard. It is warning about cases that used to be problematic. I can take those out in the next release. They aren't errors.
Basically, it's saying they never logged in, so we can't log them out. However, since the new version loads all people from memory at start, so all the stats can be run, then they aren't added to the system on login, but on server start. So, when it shuts down, it things having an entry for them is problematic but it isn't.
@cwingrav hi again; getting loads of errors like this when i stop the server: [WARNING] [MOCPlaytimeTracker] Hmm, player Playername was never logged in, so can't log them out.
Is there no way for you to "force them" to be logged out on stop? Or update all the users in the DB to logged out at the stop-time.
@cwingrav
Yeah, I would like a way to track your playtime per world as how long you have been in the smp world and how long in creative, etc
thanks
@lochlain000
Hmm... no it doesn't. I'd have to track a few more events which wouldn't be bad. Maybe I can add this in the future. You'd like a command of /playtime <player> [world] ... where [world] is optional.
Hi,
does this track playtime per world?
thanks
@bjornleijdstrom
Excellent! Yeah, when I first implemented this, I didn't use the default naming scheme (didn't realize there was one!). I have code to manage this but it might not work on windows or mac boxes? Cheers.
Using MySQL, and found the error; didnt notice it before on startup, I had to rename the folder for the plugin. Sorry for the extra work and thank you!