[INACTIVE][ADMIN] MCStats v2.7 - Minecraft player statistics [868]

Discussion in 'Inactive/Unsupported Plugins' started by deltahat, Mar 15, 2011.

  1. Offline


    MCStats - Minecraft player statistics:
    Version: v2.7

    MCStats is a statistics plugin for the bukkit. MCStats periodically generates xml,
    json, js, and html files containing server statistics. Optionally, MCStats can also serve these files using an embedded web server. Using the embedded web server, the html stats report can be served directly from your Minecraft server. No need for messy apache installs.

    For group support to work you must also install and configure the Permissions plugin v2.5.4+.

    Please read the README - https://github.com/rmichela/MCStats2

    • Tracks many player statistics
    • Built in web server
    • Integrates with external systems using raw data feeds
    • Supports reading group affiliation from Permissions
    • Supports reporting iConomy account balances
    Download: https://github.com/rmichela/MCStats2/downloads
    Source: https://github.com/rmichela/MCStats2

    Changelog (open)

    Version 2.1
    • Initial port to bukkit
    Version 2.2
    • Fixed initial startup config issues. Now generates meaningful config when first initialized.
    • Fixed directory problems that forced files under Plugins directory
    Version 2.3
    Version 2.4
    • Added ignoreGroups config option
    Version 2.5
    • Fixed group name case problems
    • Created Ops group based on ops.txt
    • Only show groups player is explicitly assigned to
    • Embedded web server can now serve customized html report
    Version 2.5.1
    • Bukkit 602 support
    Version 2.6
    • Fixed bug where players in default group were erroneously ignored.
    • Fixed incompatibility with GroupManager FakePermission
    • Verified support with CB612, MC2.4, and Permissions 2.5.5
    Version 2.6.1
    • Fixed strange incompatibility with iConomy.
    Version 2.7
    • Fixed Permissions group loading bug
    • Fixed inaccurate step count bug
    • Added proper iConomy support
  2. Offline


    Kannst du mir vllt sagen wie ich das Angezeigt bekomme ??
    Hab in der Config alles geƤndert aber er zeigt keine Member auf der STats.html an
  3. Offline


  4. Offline


    Do i need to add anything to my permissions setup please?
  5. Offline


    Nope. MCStats passively reads whatever groups you assign people to in Permissions.
  6. Offline


    I have your stats plugin working, but I have a question/problem. The stats files are output to the default folder in minecraft, then I have a batch file that runs every 2 minutes to launch an ftp program that uploads the files to my website. I have been getting these errors in my log every so often,
    2011-03-20 12:20:03 [SEVERE] [MCStats] Error writing stats user files.
    java.io.FileNotFoundException: MCStats2\stats\mcstats.xml (The process cannot access the file because it is being used by another process)
    	at java.io.FileOutputStream.open(Native Method)
    	at java.io.FileOutputStream.<init>(Unknown Source)
    	at java.io.FileOutputStream.<init>(Unknown Source)
    	at java.io.PrintWriter.<init>(Unknown Source)
    	at com.ryanmichela.MCStats2.model.StatsModel.saveUserFile(StatsModel.java:154)
    	at com.ryanmichela.MCStats2.model.StatsModel.saveUserFiles(StatsModel.java:127)
    	at com.ryanmichela.MCStats2.model.StatsModel$StatsTimerTask.run(StatsModel.java:182)
    	at java.util.TimerThread.mainLoop(Unknown Source)
    	at java.util.TimerThread.run(Unknown Source)
    it seems like the plugin cant access the files cause the FTP has them open. Is there a fairly simple solution to this?
  7. Offline


    No simple solution. Two programs can't typically have the same file open at the same time. This is a relatively harmless error. The stats files will get rewritten again shortly after.
  8. Is it possible to inject custom data into the stats file? I have data from the stats and achievements plugin that I would quite like to copy over into this so it shows in the webpage table
  9. Offline


    Not really. What I really want to do (in the future) is merge MCStats with S/A. Since you already use S/A, why did you choose to also install MCStats as well?
  10. Offline


    Hey, nice plugin I like it alot. I have one question however, is it possible for me to change something to make it include money from iConomy or other currency plugins, or would that require an update of sorts?

    Edit: Oh, and is there any way to make it sort by default a column other than the first upon page load/refresh?
  11. I have been spending my time the last 2 weeks or so building a website for the server that I host (which I unexpectedly enjoyed quite a lot), and it all started out as me wanting my table of deaths to update itself automatically, instead of me having to manually edit it every now and then. But I had no idea of how to use php to parse the HeroicDeath data file, so I did a bit of googling and stumbled across your plugin. I then decided that I loved the idea of having a dedicated page for player stats (especially since it included death count). But I wanted to carry across the death count and play time etc that had already built up with the stats plugin, instead of starting from a clean slate. I tried opening the statsCache file, but Notepad++ doesn't seem to know what to do with it :p
  12. Offline


    huhu @deltahat
    Thanks for your update.

    Now I can use ignoreGrouplessPlayers: true to ignore default usersin the stats?

    Ok, don't work.
    Alternative Idea: option to insert the groupname into "playersToPurge: ''
  13. Offline


    It looks like everybody gets a group in Permissions, even "groupless" players. I am working on fixing the ignore-groupless-players function so it ignores whichever Permissions group is marked as Default. That'll be in 2.4.
  14. Offline


    Nice to see the death count correct here!! when i used it on hmod it was off quite a bit.. die once and it counted like 6 times (same with some other plugins).. This one seems accurate - My kids used to accuse me of making fake numbers lol "I didn't die 42 times yesterday!!!"

    You've made my home more peaceful :)
  15. Offline


    :) Bukkit has an actual death event. In hMod I had to infer death based on damage, which was never accurate due to problems with hMod.

    Glad I could make your children happy!

    MCStats v2.4 Released

    • Added ignoreGroups command - a space-delimited list of Permissions groups to ignore
    Note: Ignoring groups only works for the future. You will still have to purge any players you want removed using the playersToPurge option. I did this because I would rather you destroy your own data than I.

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


    Can the group colors be done if your groups aren't named "Admin", "Mod", VIP", etc? I have different names for groups. In which file would this be edited? I've tried changing the mcstats.html file and it doesn't seem to change.
  17. Offline


    Plugin suggestion

    I would love to see some flags that will help to purge players that came onto the server once.

    For example let it automatically clear player's stats if the player was last logged in x weeks ago and if their player time is less than x (This would prevent clearing out stats for those who are on vacation or something)
  18. Offline


    You have to change the css in the mcstats.html file. Create a css class with the same name as your group. You also have to turn off the overwriteHtmlReport flag in the config so your changes won't get wiped out.
  19. Offline


    That's what I'm not quite grasping; I've edited the mcstats.html file, changed the group names and the screen titles. I didn't set the overwriteHTMLReport flag, but the file isn't being overwritten. It's still the way I edited it over a day ago, but the report still appears exactly the same. I've also cleared the cache of two different browsers and tried on different computers.

    I also read the instructions at this github site that reads:

    All that says is to make a copy of the file and rename it, makes no sense.

  20. Offline


    How are you accessing the mcstats.html file? Are you simply opening it locally from your hard drive, or have you configured a web server? I've found that web browsers have caching problems when opening a static html file from the hard drive. You may need to clear your browser cache.

    If your stats are web accessible, can you point me to the url of your stats?
  21. Offline


    As I said, I've cleared my cache several times in several browsers on different systems. I'm using the embedded web server. Here's the URL:


    I basically want to have certain colors for the groups, change the heading title and maybe other cosmetic aspects. I also had to change my permissions so that there were no inheritances because all the groups inherited were being shown. I instead removed inheritances and specified each group's permissions separately. I'm not sure how to set permissions with this plugin. I have Permissions and GroupManager, which are already a bit confusing because there are so many redundant permissions files.
  22. Offline


    From what I can see, any custom changes you have made to MCStats.html are not being served. Can you attach a copy of MCStats.html and your config.yml file?
  23. Offline


    That's how it seems. Odd, because the data changes regularly.

    I left everything in the default locations. Maybe my config is wrong. I got the idea from other posts.

    playersToPurge: ''
    secondsBetweenSaves: '60'
    resourceSaveDirectory: /plugins/MCStats2/stats/
    secondsBetweenPageRefreshes: '60'
    httpServerContextRoot: /plugins/MCStats2/stats/
    httpPort: 8124
    webserverEnabled: true
    httpBacklog: 15
    ignoreGrouplessPlayers: false

    You will see where I changed the group names and colors:
            <title>The Podzone Player Statistics</title>
            <meta http-equiv='refresh' content='60' >
            <style type='text/css'>
                h1 {
                    font: bold 24px verdana, arial, helvetica, sans-serif;
                    color: #363636;
                    width: 80%;
                    margin-left: 10%;
                    margin-right: 10%;
                    min-width: 600px;
                table {
                    border-collapse: collapse;
                    border: 1px solid #666666;
                    font: normal 11px verdana, arial, helvetica, sans-serif;
                    color: #363636;
                    background: #f6f6f6;
                    width: 80%;
                    margin-left: 10%;
                    margin-right: 10%;
                    min-width: 600px;
                thead {
                    background: #cfe7fa; /* old browsers */
                    background: -moz-linear-gradient(top, #cfe7fa 0%, #6393c1 100%); /* firefox */
                    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cfe7fa), color-stop(100%,#6393c1)); /* webkit */
                    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cfe7fa', endColorstr='#6393c1',GradientType=0 ); /* ie */
                th {
                    padding: 5px;
                #stats th {
                    background-repeat: no-repeat;
                    background-position: center right;
                    cursor: pointer;
                    padding-right: 20px;
                tr.odd {
                    background: #f1f1f1;
                td {
                    border-right: 1px ridge #d2d2d2;
                th.header {
                th.headerSortDown {
                th.headerSortUp {
                .pName {
                .pOnline {
                    padding: 3px;
                #stats td {
                .King {
                    color: #CC00FF;
                .Duke {
                    color: #FF3300;
                .Baron {
                    color: #339900;
                .Citizen {
                    color: #00CCFF;
                .Peasant {
                    color: #999999;
                .center {
                    text-align: center;
                .right {
                    text-align: right;
            <h1>The Podzone Player Statistics</h1>
            <table id='online'>
                        <th>Players Online</th>
                        <td id='playersOnlineList'>
            <table id='stats'>
                        <th>Meters Traveled</th>
                        <th>Player Kills</th>
                        <th>Creature Kills</th>
                        <th>Player Since</th>
                        <th>Last Login</th>
                        <th>Total Playtime</th>
                        <th>Session Playtime</th>
                <tbody id='statsTable'></tbody>
            <script src='mcstats.js'></script>
            <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
            <script src='http://tablesorter.com/jquery.tablesorter.min.js'></script>
                //build the Players Online list
                var playersOnline = document.getElementById('playersOnlineList');
                for(i in mcStatsRawData.playersOnline)
                    var span = document.createElement('span');
                    span.setAttribute('class', 'pOnline ' + groupConcat(mcStatsRawData.playersOnline[i].groups));
                    span.innerHTML = mcStatsRawData.playersOnline[i].playerName;
                    span.innerHTML += ' ';
                //Build the player stats table
                for(j in mcStatsRawData.playerStats)
                    var col = 0;
                    var ps = mcStatsRawData.playerStats[j];
                    var tr = document.createElement('tr');
                    var playerNameTd = tr.insertCell(col++);
                    playerNameTd.setAttribute('class', 'player');
                    var playerNameSpan = document.createElement('span');
                    playerNameSpan.setAttribute('class', 'pName ' + groupConcat(ps.playerGroups));
                    playerNameSpan.innerHTML = ps.playerName;
                    var playerGroups = tr.insertCell(col++);
                    playerGroups.setAttribute('class', 'text');
                    playerGroups.innerHTML = groupConcat(ps.playerGroups);
                    var placed = tr.insertCell(col++);
                    placed.setAttribute('class', 'right number');
                    placed.innerHTML = ps.blocksPlaced;
                    var destroyed = tr.insertCell(col++);
                    destroyed.setAttribute('class', 'right number');
                    destroyed.innerHTML = ps.blocksDestroyed;
                    var traveled = tr.insertCell(col++);
                    traveled.setAttribute('class', 'right number');
                    traveled.innerHTML = ps.metersTraveled;
                    var playerKills = tr.insertCell(col++);
                    playerKills.setAttribute('class', 'right number');
                    playerKills.innerHTML = ps.playerKills ;
                    var creatureKills = tr.insertCell(col++);
                    creatureKills.setAttribute('class', 'right number');
                    creatureKills.innerHTML = ps.creatureKills;
                    var deaths = tr.insertCell(col++);
                    deaths.setAttribute('class', 'right number');
                    deaths.innerHTML = ps.deaths;
                    var playersince = tr.insertCell(col++);
                    playersince.setAttribute('class', 'center date');
                    playersince.innerHTML = formatDate(ps.playerSince);
                    var lastLogin = tr.insertCell(col++);
                    lastLogin.setAttribute('class', 'center date');
                    lastLogin.innerHTML = formatDate(ps.lastLogin);
                    var totalPlaytime = tr.insertCell(col++);
                    totalPlaytime.setAttribute('class', 'right duration');
                    totalPlaytime.innerHTML = ps.totalPlaytime;
                    var sessionPlaytime = tr.insertCell(col++);
                    sessionPlaytime.setAttribute('class', 'right duration');
                    sessionPlaytime.innerHTML = ps.sessionPlaytime;
                function strSortNoCase(a, b) {
                    a = a.toLowerCase(); b = b.toLowerCase();
                    if (a>b) return 1;
                    if (a <b) return -1;
                    return 0;
                function statsSort(a, b) {
                    return strSortNoCase(a.playerName, b.playerName);
                function groupConcat(groupArray) {
                    return groupArray == null ? '' : $.trim(' ' + groupArray.join(' '));
                function formatDate(unixTimestamp) {
                    if(unixTimestamp == '') {
                        return '';
                    } else {
                        var date = new Date(parseInt(unixTimestamp * 1000));
                        return (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
                //sortable columns
                $(document).ready(function() {
                       textExtraction: function(node) {
                            if(node.className.indexOf('player') != -1) {
                                return node.childNodes[0].innerHTML;
                            } else if(node.className.indexOf('text') != -1) {
                                return node.innerHTML;
                            } else if(node.className.indexOf('number') != -1) {
                            } else if(node.className.indexOf('date') != -1) {
                                var split =  node.innerHTML.split('/');
                                return split[2] + split[0] + split[1];                        } else if(node.className.indexOf('duration') != -1) {
                                return node.innerHTML.split(' ')[0];
                            }  {
                                return node.innerHTML;
  24. Offline


    Thanks. I'll look into it.
  25. Offline


    Would it be possible for the "inheritance" to be ignored, so players only show up under their main group name only?
  26. Offline


    Yeah, I had to remove them all and specify permissions under each group. I thought there was a permissions setting but didn't know how to do it.
  27. Offline


    Don't know what happened, but my server started to lag and the console was spaming this error.

    19:22:29 [SEVERE] [MCStats] Error writing stats user files.

    java.io.FileNotFoundException: /var/www/mcstats.xml (Permission denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
    at java.io.PrintWriter.<init>(PrintWriter.java:146)
    at com.ryanmichela.MCStats2.model.StatsModel.saveUserFile(StatsModel.java:154)
    at com.ryanmichela.MCStats2.model.StatsModel.saveUserFiles(StatsModel.java:127)
    at com.ryanmichela.MCStats2.model.StatsModel$StatsTimerTask.run(StatsModel.java:182)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)

    It was working fine before, now it keeps showing that error. :/
  28. Offline


    I just noticed that this "work-around" presents a problem with GroupManager. I can no longer promote or demote users because it says I can't demote a group that I don't inherit permissions of.

    So we need another way to fix the multiple groups in the list.
  29. Offline


    All the errors went away after I chanted permissions of statsCache, mcstats.html, mcstats.js, mcstats.json and mcstats.xml to 0777. I had to allowe "write" on "others" for it to start working.

    Is that right? Doesn't seem like it should have all those permissions.
  30. Offline


    I'll look into the group inheritance issue. This issue is difficult because Permissions does not give an easy way to determine which group is a player's "primary group" and I want to avoid reading the Permissions .yml file directly.

    Technically, when a player is assigned to a group, the player is in all the inherited groups as well.

    Seems there was a problem writing to the files. Any idea what the unix permissions were before you changed them?

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


    I know what happened now.

    It actually works perfectly fine if I use 0664 for permissions, but if I upgrade to the new 2.4 version then I get the file permissions errors.

    I am not sure which version before 2.4 I have that works.

Share This Page