Plugin Addon: bbStats for BigBrother!

Discussion in 'Bukkit Tools' started by theoutrider, Feb 2, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    theoutrider

    [​IMG]

    I've written a little PHP webapp that will gather statistics from BigBrother's tracking database. It includes awards and stuff! bbStats will run on any BigBrother database, SQLite or MySQL (although I recommend MySQL due to SQLite having serious performance issues with large databases).

    Screenshots: 1, 2

    Download HERE - current version: v2 (2011/02/03)

    Please note: if you are updating from an earlier version of bbStats, make a backup copy of your config_base.php before extracting this. If you don't, you'll need to enter your database settings again. Obviously, any other files you've changed should also be backed up.


    Requirements:
    • A web server with access to your BigBrother database, either remotely via MySQL or locally via SQLite3
    • PHP 5.0.0 with MySQL or SQLite3 extensions (note that SQLite3 requires at least PHP 5.3.0)
    Basic setup:
    Copy the contents of the bbStats folder to somewhere on your web server and edit config_base.php to reflect your database configuration. That's it!

    If you have ideas for new features, awards or random stats, let me know and I'll see about adding them! :)

    bbStats has now been updated to v2, codenamed "I Should Have Used An IDE"! v2 fixes a PHP bug and introduces the following new features:
    • Better error handling for PHP configurations lacking database support!
    • Hide the header text by setting SERVER_NAME to ""!
    • Set limits for how far back to trawl the database for info for awards!
    • Still has CSS bugs because I've lost my CSS-fu!
    • No new awards!
    Planned features for v3 and beyond, ordered by priority:
    • Toplists for world statistics and per-player total stats (re-added from prerelease)!
    • Fix those bloody CSS problems!
    • Minimum amounts of blocks manipulated for awards!
    • Persistent awards using a support table in the main BigBrother database!
     
  2. Offline

    ShaDooM

    Great Plugin!

    I'm on IIS at the moment and its taking aaaaaaaaages to connect. I checked the config, I checked logs etc. Didn't find anything which could cause this. I'm having Forums/Blogs/Websites on the same server which access the same MySQL Server and it works flawless... is it my stupidity or why doesnt it connect or just load forever?
    i can send you the link in a PM if needed

    Nevermind, I just saw the options for the big databases (im at 500mb) I set it to 1 day, it still takes a pretty long time to connect. But well at least it kinda works. It's hardcore resource needing now and I guess if 20 ppl hammer the reload button on that its gonna screw the server up ^^
     
  3. Offline

    Pulec

    I dont have the bbdata db on localhost
    And this does not work
    Code:
    define('MYSQL_HOST',		'mysql://***.***.***.***\:3306/minecraft');
    
    * is IP of course
    Which is the proper format for remote mysql?
     
  4. Offline

    theoutrider

    @ShaDooM Once I've implemented the support database for persistent awards, I'll be doing the full update more rarely (say, once every 30 minutes or so) which should save a load of resources. Right now it literally checks back through the entire database (as far back as you'll allow it to) for every single award, every time the main page or any player page is loaded.

    Keep in mind that if you're running SQLite, it'll start falling over much earlier - in my personal experience, the achievement check takes about five times as long on SQLite than on MySQL.

    @Pulec I've no way to test it with remote databases sadly - try leaving out the protocol and just go for ip:port/minecraft. I'll look at making this more usable by making bbStats strip unnecessary info from full URLs.
     
  5. Offline

    ShaDooM

    I'm on MySQL not on sqlite ^^
    i doubt that every 30 mintues will be enough ive heard of databases with the size of 1.9gb, since my 500mb took ages, i dont wanna try 1.9gigs :S
    I hope for the best though I like it so far :D
     
  6. Offline

    skater40165

    suggestion could you make it where it shows not just the player on the award but also the number of whatever it is the did. like number of blocks destroyed.
     
  7. Offline

    Rhodri

    Works like a treet, just one thing im gonna work out (as i havent seen anyone with this) is the gap between awards bar and the top bar :p but other than that AMAZING :p

    EDIT:
    Forgot to add, would it be possible for some sort of UI to add awards?
     
  8. Offline

    tenach

    Whoa, thanks for this man. I am currently adding some features to the copy I downloaded - I will be making all of my source available to you if you wish to take a gander. That said, do you mind if I start a git repository (or perhaps you create one that I fork)? I'd love to submit patches against this piece of work.
     
  9. Offline

    fffizzz

    Took 13 sec to get award list. Total active awards: 15
    600k rows
    122 megs


    Cant we add some index's to speed things up a bit? I dont mind the extra storage space being gone..
    --- merged: Feb 4, 2011 12:04 PM ---
    also, small bug.. with chrome, awards are aligned at the bottom of the page rather thamn the top, so if you have 200 users in the list, you scroll a while to get to the stats.
     
  10. Offline

    Mattie112

    Nice plugin but it looks terrible in IE 8 :)
     
  11. Offline

    Glorificus

    no offence dude, but your script is a totall performance killer..

    first of all you should create temporary tables, where to save all data and make daily cronjob updates to it, not to query whole bbdata database each time user runs the webpage..
     
  12. Offline

    Rhodri

    it runs smoothley on mine woth no hicks and from a remote source it said took 0 seconds to get the data, and im on 1meg upload and its running on a dual-core lappy (server not fully made yet)
     
  13. Offline

    Glorificus

    well it runs smoothly because you just started your server and its not full yet, LOL
     
  14. Offline

    Nipper

    Yeah, A system that would read the data like once hr or something like that. Then write the infomations would be nice. Keeps the SQL info and slow loading to little to none.
     
  15. Offline

    crameep

    Well, as for performance, is it really necessary to keep the WHOLE bb database for the entire life of your server? wouldn't it make more sense to purge it once in a while?
     
  16. Offline

    Luis

    i have my DB running
    these are my setting

    define('jdbc:mysql://localhost:3306/minecraft', 'mysql');
    define('localhost', 'localhost');
    define('****', 'username');
    define('****', 'password');
    define('bbdata', 'bigbrother');

    then i get this error:
    There is no database connection set up

    i have no clue how to fix this

    any help is appreciated thanks :)
     
  17. Offline

    Rhodri

    it should loook something like this, you have well, wrecked the setup
    Code:
    // Edit these to match your MySQL configuration.
    define('DB_MODE',        'mysql');
    define('MYSQL_HOST',        'localhost');
    define('MYSQL_USER',        'root');
    define('MYSQL_PASSWORD',    'PASSWORD');
    define('MYSQL_DATABASE',    'minecraft');
    
    this is in the config_base.php
     
  18. Offline

    Luis

    awesome thanks for the help
    --- merged: Feb 5, 2011 10:15 PM ---
    sorry now i have this message on the web page

    Notice: Undefined offset: 0 in C:\wamp\www\bbStats\support.php on line 124

    thanks
     
  19. Offline

    MeoW

    I love these stats. :)

    I am a web developer and I can help you will the CSS issues. I can also help with PHP coding if you need it. I love to code and I have a lot of free time.
     
  20. Offline

    Pulec

    I tried everything else but not just the ip, and that worked. :)
    And I had few problems with define('MYSQL_DATABASE'
    Then coworker explained that bbdata is the table in the database so it has to be set for the name of the database not the table.

    It works http://majncraft.cz/bb/
    but it needs work!

    seems fast for database with 988 155 rows, for now...

    And we have so many players that the page cant list them all, could it just be sorted by recent active players? Or other way..
     
  21. Offline

    PeopleSaw

    got this error:
    PHP:
    Warningmysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/server/www/bbStats/support.php on line 73

    Warning
    mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/server/www/bbStats/support.php on line 81

    Warning
    mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/server/www/bbStats/support.php on line 73

    Warning
    mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/server/www/bbStats/support.php on line 81
    pache VersionApache/2.2.9 (Debian) PHP/5.2.6-1+lenny9 with Suhosin-Patch
     
  22. Offline

    Sp4rc0

    Same here!
     
  23. Offline

    thempc

    Getting the same error,
    running Wamp with apache 2.2.* and mySQL5.5
     
  24. Offline

    MrJangles

    This is a great plugin, but too resource intensive to run on a large mysql database. There are also CSS issues in every browser. I'm anticipating an update!
     
  25. Offline

    MeoW

    I offered to help him with those CSS issues and to help out with the coding but he never got back to me :<
     
  26. Offline

    jessenic

    This looks like a good addon, but as a web developer I suggest you to use PDO in handling database things. If you give me permission to publish a version that uses PDO I could upload it.

    I have working PDO version, should work with CUBRID, MS SQL Server, Firebird/Interbase, IBM, Informix, MySQL, Oracle, ODBC and DB2, PostgreSQL, SQLite, 4D (BB supports only MySQL and SQLite though)

    Tested with: MySQL and SQLite
     
  27. Offline

    N3X15

    I've done some serious changes to this in order to improve performance and make it somewhat useful. Here's a preview.

    http://www.nexisonline.net/7chanistan/

    If you'd like the code, please notify me.
     
  28. Offline

    Colecf

    I get "There is no database set up". I'm using sqlite, so I set DB_MODE to 'sqlite' and since I don't think sqlite uses authentication, I left all the mysql settings the same. I changed the server path too, but It gives me this error.
     
  29. Offline

    kazimir

    Hmm...is it still in development?
    I realy like this!! The idea is so simple and so much fun :D

    N3X15...can you please please upload your source? Really cool what you did there.
    Your thing combined with the archievements oO Oo.
    I fell in love :D
     
  30. Offline

    maehze

    yes, i would like :)
    --- merged: Feb 18, 2011 1:55 AM ---
    and here's a little css-fix:
    main.css
    Code:
    #sidebar {
      width: 14em;
      position:relative;
      float: left;
    
      max-width: 400px;
      width:20%;
    }
    
    #loadTime {
        position: relative;
        float: right;
        bottom: 0px;
        width: 100%;
    }
    
    #sidebarleft {
      position: relative;
      float: right;
      width:80%;
    }
    index.php:
    Code:
    $awardHTML=$awardHTML.'<p id="loadTime" align="right" style="font-size: 8pt; min-width:200px;">Took '.$time.' sec to get award list. Total active awards: '.count(explode(',',ACTIVE_AWARDS)).'</p>';
    it changes it's size on different screen-resolutions

    [​IMG]

    and before anyone complains.... i know its dirty, but im tired and it works :p
     
Thread Status:
Not open for further replies.

Share This Page